groups

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReachableOperations = map[OperationType]models.Operation{
	AttachPolicySlug: {
		Id:   AttachPolicySlug.String(),
		Name: "Attach Policy (attach_policy)",
		Desc: "Assign a policy to the group.",
	},
	DetachPolicySlug: {
		Id:   DetachPolicySlug.String(),
		Name: "Detach Policy (detach_policy)",
		Desc: "Remove a policy from the group.",
	},
	AttachCustomPolicySlug: {
		Id:   AttachCustomPolicySlug.String(),
		Name: "Attach Custom Policy (attach_custom_policy)",
		Desc: "Create and attach a custom policy.",
	},
}

ReachableOperations Predefined list of actions with their names and descriptions

View Source
var ReachablePolicyOptions = map[PolicyOptionType]models.PolicyOption{
	WithoutResourceSlug: {
		Id:   WithoutResourceSlug.String(),
		Name: "Without Resource (without_resource)",
		Desc: "Applies globally without a resource.",
	},
	WithResourceSlug: {
		Id:   WithResourceSlug.String(),
		Name: "With Resource (with_resource)",
		Desc: "Scoped to a specific resource.",
	},
}

ReachablePolicyOptions Predefined list of custom policy options with their names and descriptions

Functions

func Switch

func Switch(model tea.Model, width, height int) (tea.Model, tea.Cmd)

Switch handles window size changes and updates the model accordingly.

Types

type Controller

type Controller struct {
	State *State
	// contains filtered or unexported fields
}

func NewController

func NewController(api *aws.Api, openaiApiKey string, state *State) *Controller

func (*Controller) Done

func (c *Controller) Done() error

func (*Controller) LoadGroups

func (c *Controller) LoadGroups() tea.Cmd

LoadGroups loads groups from the AWS API.

func (*Controller) LoadOperations

func (c *Controller) LoadOperations() tea.Cmd

LoadOperations loads operations.

func (*Controller) LoadPolicies

func (c *Controller) LoadPolicies() tea.Cmd

LoadPolicies loads policies.

func (*Controller) LoadPolicyOptions

func (c *Controller) LoadPolicyOptions() tea.Cmd

LoadPolicyOptions loads operations.

func (*Controller) LoadResources

func (c *Controller) LoadResources() tea.Cmd

LoadResources loads resources.

func (*Controller) LoadServices

func (c *Controller) LoadServices() tea.Cmd

LoadServices loads services.

func (*Controller) Next

func (c *Controller) Next() tea.Model

Next determines the next step based on the current state.

type CreatePolicy

type CreatePolicy struct {
	// contains filtered or unexported fields
}

func NewCreatePolicy

func NewCreatePolicy(controller *Controller) CreatePolicy

func (CreatePolicy) Init

func (m CreatePolicy) Init() tea.Cmd

func (CreatePolicy) Update

func (m CreatePolicy) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (CreatePolicy) View

func (m CreatePolicy) View() string

type FailedMsg

type FailedMsg struct {
	Err error
}

FailedMsg represents a failure operation.

type GroupList

type GroupList struct {
	// contains filtered or unexported fields
}

func NewGroupList

func NewGroupList(controller *Controller) GroupList

func (GroupList) Init

func (m GroupList) Init() tea.Cmd

func (GroupList) Update

func (m GroupList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (GroupList) View

func (m GroupList) View() string

type GroupLoadedMsg

type GroupLoadedMsg struct{ List []list.Item }

type OperationList

type OperationList struct {
	// contains filtered or unexported fields
}

func NewOperationList

func NewOperationList(controller *Controller) OperationList

func (OperationList) Init

func (m OperationList) Init() tea.Cmd

func (OperationList) Update

func (m OperationList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (OperationList) View

func (m OperationList) View() string

type OperationLoadedMsg

type OperationLoadedMsg struct{ List []list.Item }

type OperationType

type OperationType string
const (
	AttachPolicySlug       OperationType = "attach_policy"
	DetachPolicySlug       OperationType = "detach_policy"
	AttachCustomPolicySlug OperationType = "attach_custom_policy"
)

Constants representing group actions and their slugs

func (OperationType) String

func (o OperationType) String() string

type PolicyList

type PolicyList struct {
	// contains filtered or unexported fields
}

func NewPolicyList

func NewPolicyList(controller *Controller) PolicyList

func (PolicyList) Init

func (m PolicyList) Init() tea.Cmd

func (PolicyList) Update

func (m PolicyList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (PolicyList) View

func (m PolicyList) View() string

type PolicyLoadedMsg

type PolicyLoadedMsg struct{ List []list.Item }

type PolicyOptionList

type PolicyOptionList struct {
	// contains filtered or unexported fields
}

func NewPolicyOptionList

func NewPolicyOptionList(controller *Controller) PolicyOptionList

func (PolicyOptionList) Init

func (m PolicyOptionList) Init() tea.Cmd

func (PolicyOptionList) Update

func (m PolicyOptionList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (PolicyOptionList) View

func (m PolicyOptionList) View() string

type PolicyOptionLoadedMsg

type PolicyOptionLoadedMsg struct{ List []list.Item }

type PolicyOptionType

type PolicyOptionType string
const (
	WithoutResourceSlug PolicyOptionType = "without_resource"
	WithResourceSlug    PolicyOptionType = "with_resource"
)

Constants representing custom policy options and their slugs

func (PolicyOptionType) String

func (o PolicyOptionType) String() string

type ResourceList

type ResourceList struct {
	// contains filtered or unexported fields
}

func NewResourceList

func NewResourceList(controller *Controller) ResourceList

func (ResourceList) Init

func (m ResourceList) Init() tea.Cmd

func (ResourceList) Update

func (m ResourceList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ResourceList) View

func (m ResourceList) View() string

type ResourceLoadedMsg

type ResourceLoadedMsg struct{ List []list.Item }

type Result

type Result struct {
	// contains filtered or unexported fields
}

func NewResult

func NewResult(controller *Controller) Result

func (Result) Init

func (m Result) Init() tea.Cmd

func (Result) Update

func (m Result) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Result) View

func (m Result) View() string

type ServiceList

type ServiceList struct {
	// contains filtered or unexported fields
}

func NewServiceList

func NewServiceList(controller *Controller) ServiceList

func (ServiceList) Init

func (m ServiceList) Init() tea.Cmd

func (ServiceList) Update

func (m ServiceList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ServiceList) View

func (m ServiceList) View() string

type ServiceLoadedMsg

type ServiceLoadedMsg struct{ List []list.Item }

type State

type State struct {
	// contains filtered or unexported fields
}

State represents the groups flow state.

func (*State) GetGroup

func (s *State) GetGroup() *models.Group

GetGroup retrieves the group from the state.

func (*State) GetOperation

func (s *State) GetOperation() *models.Operation

GetOperation retrieves the operation from the state.

func (*State) GetPolicy

func (s *State) GetPolicy() *models.Policy

GetPolicy retrieves the policy from the state.

func (*State) GetPolicyOption

func (s *State) GetPolicyOption() *models.PolicyOption

GetPolicyOption retrieves the policy option from the state.

func (*State) GetResource

func (s *State) GetResource() *models.Resource

GetResource retrieves the resource from the state.

func (*State) GetService

func (s *State) GetService() *models.Service

GetService retrieves the service from the state.

func (*State) SetGroup

func (s *State) SetGroup(group *models.Group)

SetGroup updates the group in the state.

func (*State) SetOperation

func (s *State) SetOperation(operation *models.Operation)

SetOperation updates the action in the state.

func (*State) SetPolicy

func (s *State) SetPolicy(policy *models.Policy)

SetPolicy updates the policy in the state.

func (*State) SetPolicyOption

func (s *State) SetPolicyOption(policyOption *models.PolicyOption)

SetPolicyOption updates the policy option in the state.

func (*State) SetResource

func (s *State) SetResource(resource *models.Resource)

SetResource updates the resource in the state.

func (*State) SetService

func (s *State) SetService(service *models.Service)

SetService updates the service in the state.

type Styles

type Styles struct {
	Base,
	HeaderText,
	Status,
	StatusHeader,
	StateHeader,
	Highlight,
	ErrorHeaderText,
	Help lipgloss.Style
}

func NewStyles

func NewStyles(lg *lipgloss.Renderer) *Styles

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL