generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(NukeAwsBackups) - Load vault before listing the backups (#1008)
- Loading branch information
1 parent
8790d83
commit 646db33
Showing
4 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package nuke | ||
|
||
import ( | ||
"context" | ||
"github.com/kyma-project/cloud-manager/pkg/composed" | ||
"k8s.io/utils/ptr" | ||
"time" | ||
) | ||
|
||
func loadVault(ctx context.Context, st composed.State) (error, context.Context) { | ||
state := st.(*State) | ||
|
||
//Get the vaultName and load it. | ||
vaultName := state.GetVaultName() | ||
vaults, err := state.awsClient.ListBackupVaults(ctx) | ||
if err != nil { | ||
return composed.LogErrorAndReturn(err, "Error listing AWS Backup Vaults", composed.StopWithRequeueDelay(time.Second), ctx) | ||
} | ||
|
||
//Match the vault by name. If found, continue... | ||
for _, vault := range vaults { | ||
if ptr.Deref(vault.BackupVaultName, "") == vaultName { | ||
state.vault = &vault | ||
} | ||
} | ||
return nil, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters