forked from RamenDR/ramen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split out the drpolicy function to drpolicy.go and rename the file to namespace.go. Now we can understand better the structure of the util package. Signed-off-by: Nir Soffer <[email protected]>
- Loading branch information
Showing
2 changed files
with
27 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-FileCopyrightText: The RamenDR authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package util | ||
|
||
import ( | ||
"context" | ||
|
||
ramen "github.com/ramendr/ramen/api/v1alpha1" | ||
"k8s.io/apimachinery/pkg/types" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
const DefaultDRPolicyName = "dr-policy" | ||
|
||
// nolint:unparam | ||
func GetDRPolicy(client client.Client, name string) (*ramen.DRPolicy, error) { | ||
drpolicy := &ramen.DRPolicy{} | ||
key := types.NamespacedName{Name: name} | ||
|
||
err := client.Get(context.Background(), key, drpolicy) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return drpolicy, 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