Rename the Deletable interface to Orphanable

This interface represents a resource with a deletion policy; i.e. a resource
whose underlying external resource may either be deleted or orphaned when the
it is deleted.

Signed-off-by: Nic Cope <negz@rk0n.org>
This commit is contained in:
Nic Cope 2020-08-12 13:03:51 -07:00
parent 5c5d8932d3
commit 72cd5521e6
3 changed files with 12 additions and 12 deletions

View File

@ -769,7 +769,7 @@ func TestShouldDelete(t *testing.T) {
"DeletionPolicyDelete": {
reason: "The delete deletion policy should take precedence over the reclaim policy.",
mg: &fake.Managed{
Deletable: fake.Deletable{Policy: v1alpha1.DeletionDelete},
Orphanable: fake.Orphanable{Policy: v1alpha1.DeletionDelete},
Reclaimer: fake.Reclaimer{Policy: v1alpha1.ReclaimRetain},
},
want: true,
@ -777,7 +777,7 @@ func TestShouldDelete(t *testing.T) {
"DeletionPolicyOrphan": {
reason: "The orphan deletion policy should take precedence over the reclaim policy.",
mg: &fake.Managed{
Deletable: fake.Deletable{Policy: v1alpha1.DeletionOrphan},
Orphanable: fake.Orphanable{Policy: v1alpha1.DeletionOrphan},
Reclaimer: fake.Reclaimer{Policy: v1alpha1.ReclaimDelete},
},
want: false,

View File

@ -135,14 +135,14 @@ func (m *Reclaimer) SetReclaimPolicy(p v1alpha1.ReclaimPolicy) { m.Policy = p }
// GetReclaimPolicy gets the ReclaimPolicy.
func (m *Reclaimer) GetReclaimPolicy() v1alpha1.ReclaimPolicy { return m.Policy }
// Deletable implements the Deletable interface.
type Deletable struct{ Policy v1alpha1.DeletionPolicy }
// Orphanable implements the Orphanable interface.
type Orphanable struct{ Policy v1alpha1.DeletionPolicy }
// SetDeletionPolicy sets the DeletionPolicy.
func (m *Deletable) SetDeletionPolicy(p v1alpha1.DeletionPolicy) { m.Policy = p }
func (m *Orphanable) SetDeletionPolicy(p v1alpha1.DeletionPolicy) { m.Policy = p }
// GetDeletionPolicy gets the DeletionPolicy.
func (m *Deletable) GetDeletionPolicy() v1alpha1.DeletionPolicy { return m.Policy }
func (m *Orphanable) GetDeletionPolicy() v1alpha1.DeletionPolicy { return m.Policy }
// CredentialsSecretReferencer is a mock that satisfies CredentialsSecretReferencer
// interface.
@ -281,7 +281,7 @@ type Managed struct {
ClaimReferencer
ProviderReferencer
ConnectionSecretWriterTo
Deletable
Orphanable
Reclaimer
v1alpha1.ConditionedStatus
v1alpha1.BindingStatus

View File

@ -84,8 +84,8 @@ type Reclaimer interface {
GetReclaimPolicy() v1alpha1.ReclaimPolicy
}
// A Deletable may specify a DeletionPolicy.
type Deletable interface {
// An Orphanable resource may specify a DeletionPolicy.
type Orphanable interface {
SetDeletionPolicy(p v1alpha1.DeletionPolicy)
GetDeletionPolicy() v1alpha1.DeletionPolicy
}
@ -193,7 +193,7 @@ type Managed interface {
ClaimReferencer
ProviderReferencer
ConnectionSecretWriterTo
Deletable
Orphanable
Reclaimer
Conditioned