Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions client/binding_approval.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package client

import "github.com/meshcloud/meshstack-cli/client/types/enum"

type MeshBindingApproval string

var (
MeshBindingApprovals = enum.Enum[MeshBindingApproval]{}
MeshBindingApprovalAssigned = MeshBindingApprovals.Entry("ASSIGNED")
MeshBindingApprovalPending = MeshBindingApprovals.Entry("PENDING")
)

type MeshGroupBindingStatus struct {
Approval *enum.Entry[MeshBindingApproval] `json:"approval,omitempty" tfsdk:"approval"`
}

func (s *MeshGroupBindingStatus) WaitsForApproval() bool {
return s != nil && isPending(s.Approval)
}

func (s *MeshUserBindingStatus) WaitsForApproval() bool {
return s != nil && isPending(s.Approval)
}

func isPending(approval *enum.Entry[MeshBindingApproval]) bool {
return approval != nil && *approval == MeshBindingApprovalPending
}
2 changes: 2 additions & 0 deletions client/project_group_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (

type MeshProjectGroupBinding struct {
MeshProjectBinding

Status *MeshGroupBindingStatus `json:"status,omitempty" tfsdk:"status"`
}

type MeshProjectGroupBindingClient interface {
Expand Down
4 changes: 3 additions & 1 deletion client/project_user_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"github.com/meshcloud/meshstack-cli/client/internal"
"github.com/meshcloud/meshstack-cli/client/types/enum"
"github.com/meshcloud/meshstack-cli/internal/http"
)

Expand All @@ -14,7 +15,8 @@ type MeshProjectUserBinding struct {
}

type MeshUserBindingStatus struct {
UserDisabled bool `json:"userDisabled" tfsdk:"user_disabled"`
UserDisabled bool `json:"userDisabled" tfsdk:"user_disabled"`
Approval *enum.Entry[MeshBindingApproval] `json:"approval,omitempty" tfsdk:"approval"`
}

type MeshProjectUserBindingClient interface {
Expand Down
2 changes: 2 additions & 0 deletions client/workspace_group_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (

type MeshWorkspaceGroupBinding struct {
MeshWorkspaceBinding

Status *MeshGroupBindingStatus `json:"status,omitempty" tfsdk:"status"`
}

type MeshWorkspaceGroupBindingClient interface {
Expand Down
Loading