Skip to content
Open
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
23 changes: 23 additions & 0 deletions client/binding_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package client
Comment thread
tfelix marked this conversation as resolved.
Resolved

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 && s.Approval == MeshBindingApprovalPending
}

func (s *MeshUserBindingStatus) WaitsForApproval() bool {
return s != nil && s.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