From 65e7f934e71dfca0efd341e023f7eed96d09964b Mon Sep 17 00:00:00 2001 From: chinthalapalli Date: Mon, 6 Nov 2023 11:26:26 +0530 Subject: [PATCH] adding vendor changes --- bigip.go | 2 +- fastbigip.go | 132 +++++++++++++++++++++++++++---------------------- ltm.go | 137 +++++++++++++++++++++++++++++++++++---------------- 3 files changed, 167 insertions(+), 104 deletions(-) diff --git a/bigip.go b/bigip.go index 5b1d22c..5b7f995 100644 --- a/bigip.go +++ b/bigip.go @@ -527,7 +527,7 @@ func (b *BigIP) getForEntity(e interface{}, path ...string) (error, bool) { var reqError RequestError json.Unmarshal(resp, &reqError) if reqError.Code == 404 { - return nil, false + return err, false } return err, false } diff --git a/fastbigip.go b/fastbigip.go index 2dde0f2..464dd90 100644 --- a/fastbigip.go +++ b/fastbigip.go @@ -46,25 +46,31 @@ type TmplArrType struct { } type FastTCPJson struct { - Tenant string `json:"tenant_name,omitempty"` - Application string `json:"app_name,omitempty"` - VirtualAddress string `json:"virtual_address,omitempty"` - VirtualPort interface{} `json:"virtual_port,omitempty"` - SnatEnable bool `json:"enable_snat,omitempty"` - SnatAutomap bool `json:"snat_automap"` - MakeSnatPool bool `json:"make_snatpool"` - SnatPoolName string `json:"snatpool_name,omitempty"` - SnatAddresses []string `json:"snat_addresses,omitempty"` - PoolEnable bool `json:"enable_pool"` - MakePool bool `json:"make_pool"` - PoolName string `json:"pool_name,omitempty"` - PoolMembers []FastHttpPool `json:"pool_members,omitempty"` - LoadBalancingMode string `json:"load_balancing_mode,omitempty"` - SlowRampTime int `json:"slow_ramp_time,omitempty"` - MonitorEnable bool `json:"enable_monitor,omitempty"` - MakeMonitor bool `json:"make_monitor"` - TCPMonitor string `json:"monitor_name,omitempty"` - MonitorInterval int `json:"monitor_interval,omitempty"` + Tenant string `json:"tenant_name,omitempty"` + Application string `json:"app_name,omitempty"` + VirtualAddress string `json:"virtual_address,omitempty"` + VirtualPort interface{} `json:"virtual_port,omitempty"` + SnatEnable bool `json:"enable_snat,omitempty"` + SnatAutomap bool `json:"snat_automap"` + MakeSnatPool bool `json:"make_snatpool"` + SnatPoolName string `json:"snatpool_name,omitempty"` + SnatAddresses []string `json:"snat_addresses,omitempty"` + PoolEnable bool `json:"enable_pool"` + MakePool bool `json:"make_pool"` + PoolName string `json:"pool_name,omitempty"` + PoolMembers []FastHttpPool `json:"pool_members,omitempty"` + LoadBalancingMode string `json:"load_balancing_mode,omitempty"` + SlowRampTime int `json:"slow_ramp_time,omitempty"` + MonitorEnable bool `json:"enable_monitor,omitempty"` + MakeMonitor bool `json:"make_monitor"` + TCPMonitor string `json:"monitor_name,omitempty"` + MonitorInterval int `json:"monitor_interval,omitempty"` + EnablePersistence bool `json:"enable_persistence"` + PersistenceProfile string `json:"persistence_profile,omitempty"` + PersistenceType string `json:"persistence_type,omitempty"` + UseExistingPersistenceProfile bool `json:"use_existing_persistence_profile,omitempty"` + EnableFallbackPersistence bool `json:"enable_fallback_persistence"` + FallbackPersistenceType string `json:"fallback_persistence_type,omitempty"` } type FastUDPJson struct { @@ -110,47 +116,53 @@ type FastUDPJson struct { } type FastHttpJson struct { - Tenant string `json:"tenant_name,omitempty"` - Application string `json:"app_name,omitempty"` - VirtualAddress string `json:"virtual_address,omitempty"` - VirtualPort interface{} `json:"virtual_port,omitempty"` - SnatEnable bool `json:"enable_snat,omitempty"` - SnatAutomap bool `json:"snat_automap"` - MakeSnatPool bool `json:"make_snatpool"` - SnatPoolName string `json:"snatpool_name,omitempty"` - SnatAddresses []string `json:"snat_addresses,omitempty"` - PoolEnable bool `json:"enable_pool"` - MakePool bool `json:"make_pool"` - TlsServerEnable bool `json:"enable_tls_server"` - TlsClientEnable bool `json:"enable_tls_client"` - TlsServerProfileCreate bool `json:"make_tls_server_profile"` - TlsClientProfileCreate bool `json:"make_tls_client_profile"` - TlsServerProfileName string `json:"tls_server_profile_name,omitempty"` - TlsClientProfileName string `json:"tls_client_profile_name,omitempty"` - TlsCertName string `json:"tls_cert_name,omitempty"` - TlsKeyName string `json:"tls_key_name,omitempty"` - PoolName string `json:"pool_name,omitempty"` - PoolMembers []FastHttpPool `json:"pool_members,omitempty"` - SdEnable bool `json:"use_sd"` - ServiceDiscovery []interface{} `json:"service_discovery,omitempty"` - LoadBalancingMode string `json:"load_balancing_mode,omitempty"` - SlowRampTime int `json:"slow_ramp_time,omitempty"` - MonitorEnable bool `json:"enable_monitor,omitempty"` - MakeMonitor bool `json:"make_monitor"` - HTTPMonitor string `json:"monitor_name_http,omitempty"` - HTTPSMonitor string `json:"monitor_name,omitempty"` - MonitorAuth bool `json:"monitor_credentials"` - MonitorUsername string `json:"monitor_username,omitempty"` - MonitorPassword string `json:"monitor_passphrase,omitempty"` - MonitorInterval int `json:"monitor_interval,omitempty"` - MonitorSendString string `json:"monitor_send_string,omitempty"` - MonitorResponse string `json:"monitor_expected_response,omitempty"` - WafPolicyEnable bool `json:"enable_waf_policy"` - MakeWafpolicy bool `json:"make_waf_policy"` - WafPolicyName string `json:"asm_waf_policy,omitempty"` - EndpointPolicyNames []string `json:"endpoint_policy_names,omitempty"` - AsmLoggingEnable bool `json:"enable_asm_logging"` - LogProfileNames []string `json:"log_profile_names,omitempty"` + Tenant string `json:"tenant_name,omitempty"` + Application string `json:"app_name,omitempty"` + VirtualAddress string `json:"virtual_address,omitempty"` + VirtualPort interface{} `json:"virtual_port,omitempty"` + SnatEnable bool `json:"enable_snat,omitempty"` + SnatAutomap bool `json:"snat_automap"` + MakeSnatPool bool `json:"make_snatpool"` + SnatPoolName string `json:"snatpool_name,omitempty"` + SnatAddresses []string `json:"snat_addresses,omitempty"` + PoolEnable bool `json:"enable_pool"` + MakePool bool `json:"make_pool"` + TlsServerEnable bool `json:"enable_tls_server"` + TlsClientEnable bool `json:"enable_tls_client"` + TlsServerProfileCreate bool `json:"make_tls_server_profile"` + TlsClientProfileCreate bool `json:"make_tls_client_profile"` + TlsServerProfileName string `json:"tls_server_profile_name,omitempty"` + TlsClientProfileName string `json:"tls_client_profile_name,omitempty"` + TlsCertName string `json:"tls_cert_name,omitempty"` + TlsKeyName string `json:"tls_key_name,omitempty"` + PoolName string `json:"pool_name,omitempty"` + PoolMembers []FastHttpPool `json:"pool_members,omitempty"` + SdEnable bool `json:"use_sd"` + ServiceDiscovery []interface{} `json:"service_discovery,omitempty"` + LoadBalancingMode string `json:"load_balancing_mode,omitempty"` + SlowRampTime int `json:"slow_ramp_time,omitempty"` + MonitorEnable bool `json:"enable_monitor,omitempty"` + MakeMonitor bool `json:"make_monitor"` + HTTPMonitor string `json:"monitor_name_http,omitempty"` + HTTPSMonitor string `json:"monitor_name,omitempty"` + MonitorAuth bool `json:"monitor_credentials"` + MonitorUsername string `json:"monitor_username,omitempty"` + MonitorPassword string `json:"monitor_passphrase,omitempty"` + MonitorInterval int `json:"monitor_interval,omitempty"` + MonitorSendString string `json:"monitor_send_string,omitempty"` + MonitorResponse string `json:"monitor_expected_response,omitempty"` + EnablePersistence bool `json:"enable_persistence"` + UseExistingPersistence bool `json:"use_existing_persistence_profile,omitempty"` + EnableFallbackPersistence bool `json:"enable_fallback_persistence"` + FallbackPersistenceType string `json:"fallback_persistence_type,omitempty"` + PersistenceProfile string `json:"persistence_profile,omitempty"` + PersistenceType string `json:"persistence_type,omitempty"` + WafPolicyEnable bool `json:"enable_waf_policy"` + MakeWafpolicy bool `json:"make_waf_policy"` + WafPolicyName string `json:"asm_waf_policy,omitempty"` + EndpointPolicyNames []string `json:"endpoint_policy_names,omitempty"` + AsmLoggingEnable bool `json:"enable_asm_logging"` + LogProfileNames []string `json:"log_profile_names,omitempty"` } type FastHttpPool struct { diff --git a/ltm.go b/ltm.go index 5530761..190540c 100644 --- a/ltm.go +++ b/ltm.go @@ -1861,6 +1861,23 @@ type Enforcement struct { UnknownMethod string `json:"unknownMethod,omitempty"` } +type WebAccelerationProfileService struct { + Name string `json:"name,omitempty"` + DefaultsFrom string `json:"defaultsFrom,omitempty"` + CacheSize int `json:"cacheSize,omitempty"` + CacheMaxEntries int `json:"cacheMaxEntries,omitempty"` + CacheMaxAge int `json:"cacheMaxAge,omitempty"` + CacheObjectMinSize int `json:"cacheObjectMinSize,omitempty"` + CacheObjectMaxSize int `json:"cacheObjectMaxSize,omitempty"` + CacheUriExclude []string `json:"cacheUriExclude,omitempty"` + CacheUriInclude []string `json:"cacheUriInclude,omitempty"` + CacheUriIncludeOverride []string `json:"cacheUriIncludeOverride,omitempty"` + CacheUriPinned []string `json:"cacheUriPinned,omitempty"` + CacheClientCacheControlMode string `json:"cacheClientCacheControlMode,omitempty"` + CacheInsertAgeHeader string `json:"cacheInsertAgeHeader,omitempty"` + CacheAgingRate int `json:"cacheAgingRate,omitempty"` +} + type OneconnectProfiles struct { OneconnectProfiles []OneconnectProfile `json:"items"` } @@ -1919,49 +1936,50 @@ type CipherRule struct { } const ( - uriLtm = "ltm" - uriNode = "node" - uriPool = "pool" - uriPoolMember = "members" - uriProfile = "profile" - uriCipher = "cipher" - uriServerSSL = "server-ssl" - uriClientSSL = "client-ssl" - uriVirtual = "virtual" - uriVirtualAddress = "virtual-address" - uriSnatPool = "snatpool" - uriMonitor = "monitor" - uriIRule = "rule" - uriDatagroup = "data-group" - uriInternal = "internal" - uriExternal = "external" - uriPolicy = "policy" - uriOneconnect = "one-connect" - uriPersistence = "persistence" - ENABLED = "enable" - DISABLED = "disable" - CONTEXT_SERVER = "serverside" - CONTEXT_CLIENT = "clientside" - CONTEXT_ALL = "all" - uriTcp = "tcp" - uriFtp = "ftp" - uriFasthttp = "fasthttp" - uriFastl4 = "fastl4" - uriHttpcompress = "http-compression" - uriHttp2 = "http2" - uriSnat = "snat" - uriSnatpool = "snatpool" - uriCookie = "cookie" - uriDestAddr = "dest-addr" - uriHash = "hash" - uriHost = "host" - uriMSRDP = "msrdp" - uriSIP = "sip" - uriSourceAddr = "source-addr" - uriSSL = "ssl" - uriUniversal = "universal" - uriCreateDraft = "?options=create-draft" - uriRule = "rule" + uriLtm = "ltm" + uriNode = "node" + uriPool = "pool" + uriPoolMember = "members" + uriProfile = "profile" + uriCipher = "cipher" + uriServerSSL = "server-ssl" + uriClientSSL = "client-ssl" + uriVirtual = "virtual" + uriVirtualAddress = "virtual-address" + uriSnatPool = "snatpool" + uriMonitor = "monitor" + uriIRule = "rule" + uriDatagroup = "data-group" + uriInternal = "internal" + uriExternal = "external" + uriPolicy = "policy" + uriOneconnect = "one-connect" + uriPersistence = "persistence" + ENABLED = "enable" + DISABLED = "disable" + CONTEXT_SERVER = "serverside" + CONTEXT_CLIENT = "clientside" + CONTEXT_ALL = "all" + uriTcp = "tcp" + uriFtp = "ftp" + uriFasthttp = "fasthttp" + uriFastl4 = "fastl4" + uriHttpcompress = "http-compression" + uriHttp2 = "http2" + uriSnat = "snat" + uriSnatpool = "snatpool" + uriCookie = "cookie" + uriDestAddr = "dest-addr" + uriHash = "hash" + uriHost = "host" + uriMSRDP = "msrdp" + uriSIP = "sip" + uriSourceAddr = "source-addr" + uriSSL = "ssl" + uriUniversal = "universal" + uriCreateDraft = "?options=create-draft" + uriRule = "rule" + uriWebAcceleration = "web-acceleration" ) var cidr = map[string]string{ @@ -3827,6 +3845,20 @@ func (b *BigIP) GetHttpProfile(name string) (*HttpProfile, error) { return &httpProfile, nil } +func (b *BigIP) GetWebAccelerationProfile(name string) (*WebAccelerationProfileService, error) { + var webAccelerationProfileService WebAccelerationProfileService + err, ok := b.getForEntity(&webAccelerationProfileService, uriLtm, uriProfile, uriWebAcceleration, name) + if err != nil { + return nil, err + } + + if !ok { + return nil, nil + } + + return &webAccelerationProfileService, nil +} + // CreateHttpProfile creates a new http profile on the BIG-IP system. func (b *BigIP) CreateHttpProfile(name string, parent string) error { config := &HttpProfile{ @@ -3842,17 +3874,32 @@ func (b *BigIP) AddHttpProfile(config *HttpProfile) error { return b.post(config, uriLtm, uriProfile, uriHttp) } +// AddWebAcceleration creates a new web acceleration profile service on the BIG-IP system. +func (b *BigIP) AddWebAcceleration(config *WebAccelerationProfileService) error { + return b.post(config, uriLtm, uriProfile, uriWebAcceleration) +} + // DeleteHttpProfile removes a http profile. func (b *BigIP) DeleteHttpProfile(name string) error { return b.delete(uriLtm, uriProfile, uriHttp, name) } +// DeleteWebAccelerationProfile removes a web acceleration profile. +func (b *BigIP) DeleteWebAccelerationProfile(name string) error { + return b.delete(uriLtm, uriProfile, uriWebAcceleration, name) +} + // ModifyHttpProfile allows you to change any attribute of a http profile. // Fields that can be modified are referenced in the HttpProfile struct. func (b *BigIP) ModifyHttpProfile(name string, config *HttpProfile) error { return b.patch(config, uriLtm, uriProfile, uriHttp, name) } +// ModifyWebAccelerationProfile allows you to change any attribute of a Web Acceleration profile. +func (b *BigIP) ModifyWebAccelerationProfile(name string, config *WebAccelerationProfileService) error { + return b.patch(config, uriLtm, uriProfile, uriWebAcceleration, name) +} + // OneconnectProfiles returns a list of HTTP profiles func (b *BigIP) OneconnectProfiles() (*OneconnectProfiles, error) { var oneconnectProfiles OneconnectProfiles @@ -4014,6 +4061,10 @@ func (b *BigIP) ModifyLtmCipherGroup(name string, config *CipherGroupReq) error return b.put(config, uriLtm, uriCipher, "group", name) } +func (b *BigIP) ModifyLtmCipherGroupNew(name string, config interface{}) error { + return b.put(config, uriLtm, uriCipher, "group", name) +} + func (b *BigIP) DeleteLtmCipherGroup(name string) error { return b.delete(uriLtm, uriCipher, "group", name) }