Skip to content

Commit

Permalink
continue sweeper run for other resources if no resource found (Google…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehul3217 authored Sep 9, 2024
1 parent fae1485 commit 924f914
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func testSweepNetappActiveDirectory(region string) error {
listUrl, err := tpgresource.ReplaceVars(d, config, listTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err)
return nil
continue
}

res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Expand All @@ -67,13 +67,13 @@ func testSweepNetappActiveDirectory(region string) error {
})
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err)
return nil
continue
}

resourceList, ok := res["activeDirectories"]
if !ok {
log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.")
return nil
continue
}

rl := resourceList.([]interface{})
Expand All @@ -85,7 +85,7 @@ func testSweepNetappActiveDirectory(region string) error {
obj := ri.(map[string]interface{})
if obj["name"] == nil {
log.Printf("[INFO][SWEEPER_LOG] %s resource name was nil", resourceName)
return nil
continue
}

name := tpgresource.GetResourceNameFromSelfLink(obj["name"].(string))
Expand All @@ -99,7 +99,7 @@ func testSweepNetappActiveDirectory(region string) error {
deleteUrl, err := tpgresource.ReplaceVars(d, config, deleteTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err)
return nil
continue
}
deleteUrl = deleteUrl + name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func testSweepNetappBackupPolicy(region string) error {
listUrl, err := tpgresource.ReplaceVars(d, config, listTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err)
return nil
continue
}

res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Expand All @@ -67,13 +67,13 @@ func testSweepNetappBackupPolicy(region string) error {
})
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err)
return nil
continue
}

resourceList, ok := res["backupPolicies"]
if !ok {
log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.")
return nil
continue
}

rl := resourceList.([]interface{})
Expand All @@ -85,7 +85,7 @@ func testSweepNetappBackupPolicy(region string) error {
obj := ri.(map[string]interface{})
if obj["name"] == nil {
log.Printf("[INFO][SWEEPER_LOG] %s resource name was nil", resourceName)
return nil
continue
}

name := tpgresource.GetResourceNameFromSelfLink(obj["name"].(string))
Expand All @@ -99,7 +99,7 @@ func testSweepNetappBackupPolicy(region string) error {
deleteUrl, err := tpgresource.ReplaceVars(d, config, deleteTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err)
return nil
continue
}
deleteUrl = deleteUrl + name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func testSweepNetappBackup(region string) error {
listUrl, err := tpgresource.ReplaceVars(d, config, listTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err)
return nil
continue
}

res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Expand All @@ -67,13 +67,13 @@ func testSweepNetappBackup(region string) error {
})
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err)
return nil
continue
}

resourceList, ok := res["backups"]
if !ok {
log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.")
return nil
continue
}

rl := resourceList.([]interface{})
Expand All @@ -85,7 +85,7 @@ func testSweepNetappBackup(region string) error {
obj := ri.(map[string]interface{})
if obj["name"] == nil {
log.Printf("[INFO][SWEEPER_LOG] %s resource name was nil", resourceName)
return nil
continue
}

name := tpgresource.GetResourceNameFromSelfLink(obj["name"].(string))
Expand All @@ -99,7 +99,7 @@ func testSweepNetappBackup(region string) error {
deleteUrl, err := tpgresource.ReplaceVars(d, config, deleteTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err)
return nil
continue
}
deleteUrl = deleteUrl + name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func testSweepNetappBackupVault(region string) error {
listUrl, err := tpgresource.ReplaceVars(d, config, listTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err)
return nil
continue
}

res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Expand All @@ -67,13 +67,13 @@ func testSweepNetappBackupVault(region string) error {
})
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err)
return nil
continue
}

resourceList, ok := res["backupVaults"]
if !ok {
log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.")
return nil
continue
}

rl := resourceList.([]interface{})
Expand All @@ -85,7 +85,7 @@ func testSweepNetappBackupVault(region string) error {
obj := ri.(map[string]interface{})
if obj["name"] == nil {
log.Printf("[INFO][SWEEPER_LOG] %s resource name was nil", resourceName)
return nil
continue
}

name := tpgresource.GetResourceNameFromSelfLink(obj["name"].(string))
Expand All @@ -99,7 +99,7 @@ func testSweepNetappBackupVault(region string) error {
deleteUrl, err := tpgresource.ReplaceVars(d, config, deleteTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err)
return nil
continue
}
deleteUrl = deleteUrl + name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func testSweepNetappkmsconfig(region string) error {
listUrl, err := tpgresource.ReplaceVars(d, config, listTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err)
return nil
continue
}

res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Expand All @@ -67,13 +67,13 @@ func testSweepNetappkmsconfig(region string) error {
})
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err)
return nil
continue
}

resourceList, ok := res["kmsconfigs"]
if !ok {
log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.")
return nil
continue
}

rl := resourceList.([]interface{})
Expand All @@ -85,7 +85,7 @@ func testSweepNetappkmsconfig(region string) error {
obj := ri.(map[string]interface{})
if obj["name"] == nil {
log.Printf("[INFO][SWEEPER_LOG] %s resource name was nil", resourceName)
return nil
continue
}

name := tpgresource.GetResourceNameFromSelfLink(obj["name"].(string))
Expand All @@ -99,7 +99,7 @@ func testSweepNetappkmsconfig(region string) error {
deleteUrl, err := tpgresource.ReplaceVars(d, config, deleteTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err)
return nil
continue
}
deleteUrl = deleteUrl + name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func testSweepNetappStoragePool(region string) error {
listUrl, err := tpgresource.ReplaceVars(d, config, listTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err)
return nil
continue
}

res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Expand All @@ -67,13 +67,13 @@ func testSweepNetappStoragePool(region string) error {
})
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err)
return nil
continue
}

resourceList, ok := res["storagePools"]
if !ok {
log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.")
return nil
continue
}

rl := resourceList.([]interface{})
Expand All @@ -85,7 +85,7 @@ func testSweepNetappStoragePool(region string) error {
obj := ri.(map[string]interface{})
if obj["name"] == nil {
log.Printf("[INFO][SWEEPER_LOG] %s resource name was nil", resourceName)
return nil
continue
}

name := tpgresource.GetResourceNameFromSelfLink(obj["name"].(string))
Expand All @@ -99,7 +99,7 @@ func testSweepNetappStoragePool(region string) error {
deleteUrl, err := tpgresource.ReplaceVars(d, config, deleteTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err)
return nil
continue
}
deleteUrl = deleteUrl + name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func testSweepNetappVolumeSnapshot(region string) error {
listUrl, err := tpgresource.ReplaceVars(d, config, listTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err)
return nil
continue
}

res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Expand All @@ -67,13 +67,13 @@ func testSweepNetappVolumeSnapshot(region string) error {
})
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err)
return nil
continue
}

resourceList, ok := res["volumeSnapshots"]
if !ok {
log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.")
return nil
continue
}

rl := resourceList.([]interface{})
Expand All @@ -85,7 +85,7 @@ func testSweepNetappVolumeSnapshot(region string) error {
obj := ri.(map[string]interface{})
if obj["name"] == nil {
log.Printf("[INFO][SWEEPER_LOG] %s resource name was nil", resourceName)
return nil
continue
}

name := tpgresource.GetResourceNameFromSelfLink(obj["name"].(string))
Expand All @@ -99,7 +99,7 @@ func testSweepNetappVolumeSnapshot(region string) error {
deleteUrl, err := tpgresource.ReplaceVars(d, config, deleteTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err)
return nil
continue
}
deleteUrl = deleteUrl + name

Expand Down

0 comments on commit 924f914

Please sign in to comment.