Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
WAF-892 errors for SOC logs and vcl snippet does not cause a delete t…
Browse files Browse the repository at this point in the history
…o fail, also cleaned up logging function names
  • Loading branch information
josehelps committed Jul 24, 2018
1 parent 3a571db commit 3ec3db3
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions waflyctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ func vclSnippet(serviceID, apiKey string, version int, config TOMLConfig) bool {

}

// FastlySOCLogging configures the logging endpoints for the customer
func FastlySOCLogging(client fastly.Client, serviceID string, version int, config TOMLConfig) bool {
// FastlyLogging configures the logging endpoints for the customer
func FastlyLogging(client fastly.Client, serviceID string, version int, config TOMLConfig) bool {
//add logging logic to service
// create req logging endpoint
_, err := client.CreateSyslog(&fastly.CreateSyslogInput{
Expand All @@ -506,7 +506,7 @@ func FastlySOCLogging(client fastly.Client, serviceID string, version int, confi
fmt.Print(err)
return false
}
Info.Println("Created SOC request logging endpoint: " + config.Weblog.Name)
Info.Println("Created request logging endpoint: " + config.Weblog.Name)

// create waf logging endpoint
_, err = client.CreateSyslog(&fastly.CreateSyslogInput{
Expand All @@ -528,7 +528,7 @@ func FastlySOCLogging(client fastly.Client, serviceID string, version int, confi
fmt.Print(err)
return false
}
Info.Println("Created SOC WAF logging endpoint: " + config.Waflog.Name)
Info.Println("Created WAF logging endpoint: " + config.Waflog.Name)
return true
}

Expand Down Expand Up @@ -827,12 +827,11 @@ func DeprovisionWAF(client fastly.Client, serviceID, apiKey string, config TOMLC

for index, waf := range wafs {

//remove WAF SOC Logging
//remove WAF Logging
result := DeleteLogsCall(client, serviceID, apiKey, config, version)
Info.Printf("Deleting WAF #%v SOC Logging", index+1)
Info.Printf("Deleting WAF #%v Logging", index+1)
if !result {
Error.Print(err)
return false
Error.Printf("Deleting WAF #%v Logging: %s", index+1, err)
}

Info.Printf("Deleting WAF #%v Container", index+1)
Expand Down Expand Up @@ -882,8 +881,7 @@ func DeprovisionWAF(client fastly.Client, serviceID, apiKey string, config TOMLC

//check if we had an issue with our call
if err != nil {
Error.Println("Error with API call: " + apiCall)
os.Exit(1)
Error.Printf("Deleting WAF #%v VCL Snippet", index+1)
}

}
Expand Down Expand Up @@ -932,10 +930,10 @@ func provisionWAF(client fastly.Client, serviceID, apiKey string, config TOMLCon
}

//set logging parameters
if FastlySOCLogging(client, serviceID, version, config) {
Info.Println("successfully created SOC logging settings")
if FastlyLogging(client, serviceID, version, config) {
Info.Println("successfully created logging settings")
} else {
Error.Printf("Fatal issue creating SOC logging settings..")
Error.Printf("Fatal issue creating logging settings..")
os.Exit(1)
}

Expand Down Expand Up @@ -1843,10 +1841,10 @@ func main() {
}

//set logging parameters
if FastlySOCLogging(*client, *serviceID, version, config) {
Info.Println("successfully created SOC logging settings")
if FastlyLogging(*client, *serviceID, version, config) {
Info.Println("successfully created logging settings")
} else {
Error.Printf("Fatal issue creating SOC logging settings..")
Error.Printf("Fatal issue creating logging settings..")
os.Exit(1)
}

Expand Down

0 comments on commit 3ec3db3

Please sign in to comment.