Add Linked prefix to Linked status variables

This is in preparation for adding a new status type to the
Link resource.
pull/20401/head
Nick Cellino 10 months ago
parent 89c795e158
commit f467df49e1

@ -18,12 +18,15 @@ import (
const ( const (
StatusKey = "consul.io/hcp/link" StatusKey = "consul.io/hcp/link"
StatusLinked = "linked" // Statuses
LinkedReason = "SUCCESS" StatusLinked = "linked"
FailedReason = "FAILED" FailedReason = "FAILED"
DisabledReasonV2ResourcesUnsupported = "DISABLED_V2_RESOURCES_UNSUPPORTED" DisabledReasonV2ResourcesUnsupported = "DISABLED_V2_RESOURCES_UNSUPPORTED"
UnauthorizedReason = "UNAUTHORIZED" LinkedSuccessReason = "SUCCESS"
ForbiddenReason = "FORBIDDEN" LinkedFailedReason = "FAILED"
LinkedDisabledReasonV2ResourcesUnsupportedReason = "DISABLED_V2_RESOURCES_UNSUPPORTED"
LinkedUnauthorizedReason = "UNAUTHORIZED"
LinkedForbiddenReason = "FORBIDDEN"
LinkedMessageFormat = "Successfully linked to cluster '%s'" LinkedMessageFormat = "Successfully linked to cluster '%s'"
FailedMessage = "Failed to link to HCP due to unexpected error" FailedMessage = "Failed to link to HCP due to unexpected error"
@ -36,25 +39,25 @@ var (
ConditionDisabled = &pbresource.Condition{ ConditionDisabled = &pbresource.Condition{
Type: StatusLinked, Type: StatusLinked,
State: pbresource.Condition_STATE_FALSE, State: pbresource.Condition_STATE_FALSE,
Reason: DisabledReasonV2ResourcesUnsupported, Reason: LinkedDisabledReasonV2ResourcesUnsupportedReason,
Message: DisabledResourceAPIsEnabledMessage, Message: DisabledResourceAPIsEnabledMessage,
} }
ConditionFailed = &pbresource.Condition{ ConditionFailed = &pbresource.Condition{
Type: StatusLinked, Type: StatusLinked,
State: pbresource.Condition_STATE_FALSE, State: pbresource.Condition_STATE_FALSE,
Reason: FailedReason, Reason: LinkedFailedReason,
Message: FailedMessage, Message: FailedMessage,
} }
ConditionUnauthorized = &pbresource.Condition{ ConditionUnauthorized = &pbresource.Condition{
Type: StatusLinked, Type: StatusLinked,
State: pbresource.Condition_STATE_FALSE, State: pbresource.Condition_STATE_FALSE,
Reason: UnauthorizedReason, Reason: LinkedUnauthorizedReason,
Message: UnauthorizedMessage, Message: UnauthorizedMessage,
} }
ConditionForbidden = &pbresource.Condition{ ConditionForbidden = &pbresource.Condition{
Type: StatusLinked, Type: StatusLinked,
State: pbresource.Condition_STATE_FALSE, State: pbresource.Condition_STATE_FALSE,
Reason: ForbiddenReason, Reason: LinkedForbiddenReason,
Message: ForbiddenMessage, Message: ForbiddenMessage,
} }
) )
@ -63,7 +66,7 @@ func ConditionLinked(resourceId string) *pbresource.Condition {
return &pbresource.Condition{ return &pbresource.Condition{
Type: StatusLinked, Type: StatusLinked,
State: pbresource.Condition_STATE_TRUE, State: pbresource.Condition_STATE_TRUE,
Reason: LinkedReason, Reason: LinkedSuccessReason,
Message: fmt.Sprintf(LinkedMessageFormat, resourceId), Message: fmt.Sprintf(LinkedMessageFormat, resourceId),
} }
} }

Loading…
Cancel
Save