Documentation ¶
Index ¶
- Variables
- func GetIAMRoleName(arnStr string) (string, error)
- func ListContains[T equalable[T]](list []T, item T) bool
- func ListDiff[T equalable[T]](a []T, b []T) (added []T, changes []T, removed []T)
- func ListPickup[T equalable[T]](list []T, item T) (T, bool)
- func ParseIAMRoleARN(arnStr string) (*arn.ARN, error)
- func RunCLI(ctx context.Context, args []string) error
- func WithUser(ctx context.Context, user *User) context.Context
- type ApplyOption
- type AssignGroupOption
- type CLI
- type ChangeInfo
- func (c *ChangeInfo) Email() Email
- func (c *ChangeInfo) GroupID() string
- func (c *ChangeInfo) IsGroupChange() bool
- func (c *ChangeInfo) IsUserChange() bool
- func (c *ChangeInfo) NeedCreateGroup() bool
- func (c *ChangeInfo) NeedDeleteGroup() bool
- func (c *ChangeInfo) NeedDeregister() bool
- func (c *ChangeInfo) NeedGroupModify() bool
- func (c *ChangeInfo) NeedPermissionModify() bool
- func (c *ChangeInfo) NeedRegister() bool
- func (c *ChangeInfo) String() string
- func (c *ChangeInfo) UnmaskString() string
- func (c *ChangeInfo) UserID() string
- type ClipSight
- func (app *ClipSight) AssignUserToGroup(ctx context.Context, user *User, group *Group) error
- func (app *ClipSight) CreateGroupMemberShip(ctx context.Context, user *User, group *Group) error
- func (app *ClipSight) CreateQuickSightGroup(ctx context.Context, group *Group) (*types.Group, error)
- func (app *ClipSight) DeleteGroup(ctx context.Context, group *Group) error
- func (app *ClipSight) DeleteGroupMemberShip(ctx context.Context, user *User, group *Group) error
- func (app *ClipSight) DeleteQuickSightGroup(ctx context.Context, group *Group) error
- func (app *ClipSight) DeleteQuickSightUser(ctx context.Context, user *User) error
- func (app *ClipSight) DeleteUser(ctx context.Context, user *User) error
- func (app *ClipSight) DescribeDashboard(ctx context.Context, dashboardID string) (*types.Dashboard, bool, error)
- func (app *ClipSight) DescribeDashboardParmissions(ctx context.Context, dashboardID string) ([]types.ResourcePermission, error)
- func (app *ClipSight) DescribeGroupMemberShip(ctx context.Context, user *User, group *Group) (bool, error)
- func (app *ClipSight) DescribeQuickSightGroup(ctx context.Context, group *Group) (*types.Group, bool, error)
- func (app *ClipSight) DescribeQuickSightUser(ctx context.Context, user *User) (*types.User, bool, error)
- func (app *ClipSight) Dispatch(ctx context.Context, command string, cli *CLI) error
- func (app *ClipSight) GetGroup(ctx context.Context, groupID string) (*Group, bool, error)
- func (app *ClipSight) GetUser(ctx context.Context, email Email) (*User, bool, error)
- func (app *ClipSight) GetVisibleDashboardIDs(ctx context.Context, user *User) ([]string, error)
- func (app *ClipSight) GrantDashboardParmission(ctx context.Context, dashboardID string, principalARN string) error
- func (app *ClipSight) GrantDashboardToGroup(ctx context.Context, group *Group, dashboardID string, expire time.Time) error
- func (app *ClipSight) GrantDashboardToUser(ctx context.Context, user *User, dashboardID string, expire time.Time) error
- func (app *ClipSight) ListGroups(ctx context.Context) (<-chan *Group, func())
- func (app *ClipSight) ListUsers(ctx context.Context) (<-chan *User, func())
- func (app *ClipSight) NewAuthMiddleware(ctx context.Context, opt *ServeOption) (func(http.Handler) http.Handler, error)
- func (app *ClipSight) NewQuickSightClientWithUser(ctx context.Context, user *User) (*quicksight.Client, error)
- func (app *ClipSight) PlanSyncConfigToDynamoDB(ctx context.Context, cfg *Config, silent bool) ([]*ChangeInfo, error)
- func (app *ClipSight) RegisterQuickSightUser(ctx context.Context, user *User, role string) (*types.User, error)
- func (app *ClipSight) RevokeDashboardFromGroup(ctx context.Context, group *Group, dashboardID string) error
- func (app *ClipSight) RevokeDashboardFromUser(ctx context.Context, user *User, dashboardID string) error
- func (app *ClipSight) RevokeDashboardParmission(ctx context.Context, dashboardID string, principalARN string) error
- func (app *ClipSight) RunApply(ctx context.Context, opt *ApplyOption) error
- func (app *ClipSight) RunAssignGroup(ctx context.Context, opt *AssignGroupOption) error
- func (app *ClipSight) RunCreateGroup(ctx context.Context, opt *CreateGroupOption) error
- func (app *ClipSight) RunDeleteGroup(ctx context.Context, opt *DeleteGroupOption) error
- func (app *ClipSight) RunDeregister(ctx context.Context, opt *DeregisterOption) error
- func (app *ClipSight) RunGrant(ctx context.Context, opt *GrantOption) error
- func (app *ClipSight) RunPlan(ctx context.Context, opt *PlanOption) error
- func (app *ClipSight) RunRegister(ctx context.Context, opt *RegisterOption) error
- func (app *ClipSight) RunRevoke(ctx context.Context, opt *RevokeOption) error
- func (app *ClipSight) RunServe(ctx context.Context, opt *ServeOption) error
- func (app *ClipSight) RunUnassignGroup(ctx context.Context, opt *UnassignGroupOption) error
- func (app *ClipSight) SaveGroup(ctx context.Context, group *Group) error
- func (app *ClipSight) SaveUser(ctx context.Context, user *User) error
- func (app *ClipSight) UnassignUserToGroup(ctx context.Context, user *User, group *Group) error
- type Config
- type CreateGroupOption
- type Dashboard
- type DeleteGroupOption
- type DeregisterOption
- type Email
- type ErrorResponse
- type GrantOption
- type Group
- func (g *Group) Diff(group *Group) (string, error)
- func (g *Group) DiffPermissions(other *Group) ([]*Dashboard, []*Dashboard)
- func (g *Group) EqualDashboardPermissions(other *Group) bool
- func (g *Group) EqualIdentifiers(other *Group) bool
- func (g *Group) Equals(other *Group) bool
- func (g *Group) FillKey() *Group
- func (g *Group) GrantDashboard(dashboard *types.Dashboard, expire time.Time)
- func (g *Group) HasChanges(other *Group) bool
- func (g *Group) IsActive() bool
- func (s *Group) IsExpire() bool
- func (g *Group) IsNew() bool
- func (g *Group) Restrict() error
- func (g *Group) RevokeDashboard(dashboardID string) bool
- type PlanOption
- type RegisterOption
- type RevokeOption
- type ServeOption
- type UnassignGroupOption
- type User
- func (u *User) Diff(user *User, maskEmail bool) (string, error)
- func (u *User) DiffGroups(other *User) ([]UserGroupMembership, []UserGroupMembership)
- func (u *User) DiffPermissions(other *User) ([]*Dashboard, []*Dashboard)
- func (u *User) EqualDashboardPermissions(user *User) bool
- func (u *User) EqualGroups(user *User) bool
- func (u *User) EqualIdentifiers(user *User) bool
- func (u *User) Equals(user *User) bool
- func (u *User) FillKey() *User
- func (u *User) GetDashboard(id string) (*Dashboard, bool)
- func (u *User) GrantDashboard(dashboard *types.Dashboard, expire time.Time)
- func (u *User) HasChanges(user *User) bool
- func (u *User) IsActive() bool
- func (s *User) IsExpire() bool
- func (u *User) IsNew() bool
- func (u *User) QuickSightUserName() (string, error)
- func (u *User) Restrict() error
- func (u *User) RevokeDashboard(dashboardID string) bool
- type UserGroupMembership
- type VersionConstraint
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LevelDebug slog.Level = slog.LevelDebug LevelInfo = slog.LevelInfo LevelNotice = slog.Level(slog.LevelInfo + 2) LevelWarn = slog.LevelWarn LevelError = slog.LevelError )
View Source
var Version string = "current"
Functions ¶
func GetIAMRoleName ¶
func ListContains ¶ added in v0.3.0
func ListContains[T equalable[T]](list []T, item T) bool
func ListDiff ¶ added in v0.3.0
func ListDiff[T equalable[T]](a []T, b []T) (added []T, changes []T, removed []T)
func ListPickup ¶ added in v0.3.0
func ListPickup[T equalable[T]](list []T, item T) (T, bool)
Types ¶
type ApplyOption ¶ added in v0.2.0
type ApplyOption struct { PlanOption AutoApprove bool `help:"auto approve"` }
type AssignGroupOption ¶ added in v0.3.0
type CLI ¶
type CLI struct { LogLevel string `help:"output log level" env:"CLIPSIGHT_LOG_LEVEL" default:"info"` DDBTable string `help:"DynamoDB table name for user infomation" env:"CLIPSIGHT_DDB_TABLE" default:"clipsight"` MaskEmail bool `help:"mask email address in log"` Register *RegisterOption `cmd:"" help:"Register user"` Grant *GrantOption `cmd:"" help:"grant dashboard view auth to user or group"` Revoke *RevokeOption `cmd:"" help:"revoke dashboard view auth from user or group"` Serve *ServeOption `cmd:"" help:"Start a ClipSight server" default:"withargs"` Plan *PlanOption `cmd:"" help:"Plan of sync config and DynamoDB"` Apply *ApplyOption `cmd:"" help:"Apply sync config and DynamoDB"` CreateGroup *CreateGroupOption `cmd:"" help:"Create group"` DeleteGroup *DeleteGroupOption `cmd:"" help:"Delete group"` AssignGroup *AssignGroupOption `cmd:"" help:"Assign user to group"` UnassignGroup *UnassignGroupOption `cmd:"" help:"Unassign user from group"` Version struct{} `cmd:"" help:"Show version"` }
type ChangeInfo ¶ added in v0.2.0
func (*ChangeInfo) Email ¶ added in v0.3.0
func (c *ChangeInfo) Email() Email
func (*ChangeInfo) GroupID ¶ added in v0.3.0
func (c *ChangeInfo) GroupID() string
func (*ChangeInfo) IsGroupChange ¶ added in v0.3.0
func (c *ChangeInfo) IsGroupChange() bool
func (*ChangeInfo) IsUserChange ¶ added in v0.3.0
func (c *ChangeInfo) IsUserChange() bool
func (*ChangeInfo) NeedCreateGroup ¶ added in v0.3.0
func (c *ChangeInfo) NeedCreateGroup() bool
func (*ChangeInfo) NeedDeleteGroup ¶ added in v0.3.0
func (c *ChangeInfo) NeedDeleteGroup() bool
func (*ChangeInfo) NeedDeregister ¶ added in v0.2.0
func (c *ChangeInfo) NeedDeregister() bool
func (*ChangeInfo) NeedGroupModify ¶ added in v0.3.0
func (c *ChangeInfo) NeedGroupModify() bool
func (*ChangeInfo) NeedPermissionModify ¶ added in v0.2.0
func (c *ChangeInfo) NeedPermissionModify() bool
func (*ChangeInfo) NeedRegister ¶ added in v0.2.0
func (c *ChangeInfo) NeedRegister() bool
func (*ChangeInfo) String ¶ added in v0.2.0
func (c *ChangeInfo) String() string
func (*ChangeInfo) UnmaskString ¶ added in v0.2.0
func (c *ChangeInfo) UnmaskString() string
func (*ChangeInfo) UserID ¶ added in v0.3.0
func (c *ChangeInfo) UserID() string
type ClipSight ¶
type ClipSight struct {
// contains filtered or unexported fields
}
Clipsight is Application instance for resource lifecycle
func (*ClipSight) AssignUserToGroup ¶ added in v0.3.0
func (*ClipSight) CreateGroupMemberShip ¶ added in v0.3.0
func (*ClipSight) CreateQuickSightGroup ¶ added in v0.3.0
func (*ClipSight) DeleteGroup ¶ added in v0.3.0
func (*ClipSight) DeleteGroupMemberShip ¶ added in v0.3.0
func (*ClipSight) DeleteQuickSightGroup ¶ added in v0.3.0
func (*ClipSight) DeleteQuickSightUser ¶ added in v0.2.0
func (*ClipSight) DeleteUser ¶ added in v0.2.0
func (*ClipSight) DescribeDashboard ¶
func (*ClipSight) DescribeDashboardParmissions ¶
func (*ClipSight) DescribeGroupMemberShip ¶ added in v0.3.0
func (*ClipSight) DescribeQuickSightGroup ¶ added in v0.3.0
func (*ClipSight) DescribeQuickSightUser ¶
func (*ClipSight) GetVisibleDashboardIDs ¶ added in v0.3.0
func (*ClipSight) GrantDashboardParmission ¶
func (*ClipSight) GrantDashboardToGroup ¶ added in v0.3.0
func (*ClipSight) GrantDashboardToUser ¶
func (*ClipSight) ListGroups ¶ added in v0.3.0
func (*ClipSight) NewAuthMiddleware ¶
func (*ClipSight) NewQuickSightClientWithUser ¶
func (*ClipSight) PlanSyncConfigToDynamoDB ¶ added in v0.2.0
func (*ClipSight) RegisterQuickSightUser ¶
func (*ClipSight) RevokeDashboardFromGroup ¶ added in v0.3.0
func (*ClipSight) RevokeDashboardFromUser ¶
func (*ClipSight) RevokeDashboardParmission ¶
func (*ClipSight) RunApply ¶ added in v0.2.0
func (app *ClipSight) RunApply(ctx context.Context, opt *ApplyOption) error
func (*ClipSight) RunAssignGroup ¶ added in v0.3.0
func (app *ClipSight) RunAssignGroup(ctx context.Context, opt *AssignGroupOption) error
func (*ClipSight) RunCreateGroup ¶ added in v0.3.0
func (app *ClipSight) RunCreateGroup(ctx context.Context, opt *CreateGroupOption) error
func (*ClipSight) RunDeleteGroup ¶ added in v0.3.0
func (app *ClipSight) RunDeleteGroup(ctx context.Context, opt *DeleteGroupOption) error
func (*ClipSight) RunDeregister ¶ added in v0.2.0
func (app *ClipSight) RunDeregister(ctx context.Context, opt *DeregisterOption) error
func (*ClipSight) RunGrant ¶
func (app *ClipSight) RunGrant(ctx context.Context, opt *GrantOption) error
func (*ClipSight) RunPlan ¶ added in v0.2.0
func (app *ClipSight) RunPlan(ctx context.Context, opt *PlanOption) error
func (*ClipSight) RunRegister ¶
func (app *ClipSight) RunRegister(ctx context.Context, opt *RegisterOption) error
func (*ClipSight) RunRevoke ¶
func (app *ClipSight) RunRevoke(ctx context.Context, opt *RevokeOption) error
func (*ClipSight) RunServe ¶
func (app *ClipSight) RunServe(ctx context.Context, opt *ServeOption) error
func (*ClipSight) RunUnassignGroup ¶ added in v0.3.0
func (app *ClipSight) RunUnassignGroup(ctx context.Context, opt *UnassignGroupOption) error
type Config ¶ added in v0.2.0
type Config struct { RequiredVersion VersionConstraint `yaml:"required_version"` Users []*User `yaml:"users"` Groups []*Group `yaml:"groups"` }
func LoadConfig ¶ added in v0.2.0
type CreateGroupOption ¶ added in v0.3.0
type CreateGroupOption struct { GroupID string `help:"group id"` Namespace string `help:"quicksight namespace" default:"default" required:""` Region string `help:"quicksight user region" env:"AWS_DEFAULT_REGION" required:""` CreateQuickSightGroup bool `name:"create-quicksight-group" help:"if quicksight group not exists, create this"` ExpireDate time.Time `help:"Expiration date for this group (RFC3399)"` Disabled bool `help:"disable user"` }
CreateGroupOption is Options for CLI Serve command
type Dashboard ¶
type Dashboard struct { DashboardID string `dynamodb:"DashboardID" yaml:"dashboard_id" json:"dashboard_id"` Expire time.Time `dynamodb:"Expire,unixtime" yaml:"expire" json:"expire,omitempty"` }
func (*Dashboard) EqualIdentifiers ¶ added in v0.3.0
type DeleteGroupOption ¶ added in v0.3.0
type DeleteGroupOption struct { GroupID string `help:"group id to delete"` DisableOnly bool `name:"disable-only" help:"only disable group, not delete"` KeepQuickSightGroup bool `name:"keep-quicksight-group" help:"if quicksight user exists, not delete this"` SetTTLOnly bool `name:"set-ttl-only" help:"only set ttl, not "` }
type DeregisterOption ¶ added in v0.2.0
type DeregisterOption struct { Email string `help:"user email address" required:""` DisableOnly bool `name:"disable-only" help:"only disable user, not deregister"` KeepQuickSightUser bool `name:"keep-quicksight-user" help:"if quicksight user exists, not deregister this"` SetTTLOnly bool `name:"set-ttl-only" help:"only set ttl, not deregister"` }
type ErrorResponse ¶ added in v0.3.0
type ErrorResponse struct { Status int `json:"status"` Code string `json:"code"` Detail string `json:"detail"` // contains filtered or unexported fields }
func (*ErrorResponse) Error ¶ added in v0.3.0
func (e *ErrorResponse) Error() string
func (*ErrorResponse) Unwrap ¶ added in v0.3.0
func (e *ErrorResponse) Unwrap() error
type GrantOption ¶
type Group ¶ added in v0.3.0
type Group struct { ID string `dynamodb:"ID" yaml:"id" json:"id"` Namespace string `dynamodb:"Namespace" yaml:"namespace" json:"namespace"` Dashboards []*Dashboard `dynamodb:"Dashboards" yaml:"dashboards" json:"dashboards"` Region string `dynamodb:"Region" yaml:"region" json:"region"` Enabled bool `dynamodb:"Enabled" yaml:"enabled" json:"enabled"` CreatedAt time.Time `dynamodb:"CreatedAt,unixtime" yaml:"-" json:"-"` UpdatedAt time.Time `dynamodb:"UpdatedAt,unixtime" yaml:"-" json:"-"` QuickSightGroupARN string `dynamodb:"QuickSightGroupARN" yaml:"-" json:"-"` // contains filtered or unexported fields }
func (*Group) DiffPermissions ¶ added in v0.3.0
func (*Group) EqualDashboardPermissions ¶ added in v0.3.0
func (*Group) EqualIdentifiers ¶ added in v0.3.0
func (*Group) GrantDashboard ¶ added in v0.3.0
func (*Group) HasChanges ¶ added in v0.3.0
func (*Group) RevokeDashboard ¶ added in v0.3.0
type PlanOption ¶ added in v0.2.0
type RegisterOption ¶
type RegisterOption struct { ID string `help:"user id"` Email string `help:"user email address" required:""` Namespace string `help:"quicksight namespace" default:"default" required:""` IAMRoleARN string `help:"IAM Role arn for quicksight user" required:""` Region string `help:"quicksight user region" env:"AWS_DEFAULT_REGION" required:""` RegisterQuickSightUser bool `name:"register-quicksight-user" help:"if quicksight user not exists, register this"` ProvisioningAs string `name:"provisioning-as" help:"provisioning as quicksight user if not exists" default:"Reader" enum:"Reader,Author,Admin"` CanConsole bool `name:"can-console" help:"can login quicksight console"` ExpireDate time.Time `help:"Expiration date for this user (RFC3399)"` Disabled bool `help:"disable user"` }
RegisterOption is Options for CLI Serve command
type RevokeOption ¶
type ServeOption ¶
type ServeOption struct { BaseURL *url.URL `help:"site base url" env:"CLIPSIGHT_BASE_URL" default:"http://localhost:8080"` Addr string `help:"local server address" env:"CLIPSIGHT_ADDR" default:":8080"` Prefix string `help:"site prefix" default:"/" env:"CLIPSIGHT_PREFIX"` APIOnly bool `help:"API only mode" env:"CLIPSIGHT_API_ONLY"` PublicPath string `help:"Public path for static files" default:"" env:"CLIPSIGHT_PUBLIC_PATH"` EnableIndexFallback bool `help:"Enable index fallback" env:"CLIPSIGHT_ENABLE_INDEX_FALLBACK"` AuthType string `help:"Types of Authentication" enum:"google,aws,none,dummy" default:"google" env:"CLIPSIGHT_AUTH_TYPE"` GoogleClientID string `help:"google client id for auth type is google" env:"GOOGLE_CLIENT_ID"` GoogleClientSecret string `help:"google client secret for auth type is google" env:"GOOGLE_CLIENT_SECRET"` GoogleOIDCSessionEncryptKey string `help:"session encrypt key for google auth" env:"GOOGLE_OIDC_SESSION_ENCRYPT_KEY"` AuthHeader string `help:"auth header name for auth type is none" env:"CLIPSIGHT_AUTH_HEADER" default:"ClipSight-Auth-Email"` DummyEmail string `help:"dummy email for auth type is none" env:"CLIPSIGHT_DUMMY_EMAIL" default:""` EnableConsole bool `help:"enable quicksight console" env:"CLIPSIGHT_ENABLE_CONSOLE"` }
ServeOption is Options for CLI Serve command
type UnassignGroupOption ¶ added in v0.3.0
type User ¶
type User struct { ID string `dynamodb:"ID" yaml:"id" json:"id"` Email Email `dynamodb:"Email" yaml:"email" json:"email"` Namespace string `dynamodb:"Namespace" yaml:"namespace" json:"namespace"` IAMRoleARN string `dynamodb:"IAMRoleARN" yaml:"iam_role_arn" json:"iam_role_arn"` Region string `dynamodb:"Region" yaml:"region" json:"region"` Dashboards []*Dashboard `dynamodb:"Dashboards" yaml:"dashboards" json:"dashboards"` Groups []UserGroupMembership `dynamodb:"Groups" yaml:"groups" json:"groups"` Enabled bool `dynamodb:"Enabled" yaml:"enabled" json:"enabled"` ProvisioningAs string `dynamodb:"-" yaml:"provisioning_as,omitempty" json:"provisioning_as,omitempty"` CanConsole bool `dynamodb:"CanConsole" yaml:"can_console" json:"can_console"` CreatedAt time.Time `dynamodb:"CreatedAt,unixtime" yaml:"-" json:"-"` UpdatedAt time.Time `dynamodb:"UpdatedAt,unixtime" yaml:"-" json:"-"` QuickSightUserARN string `dynamodb:"QuickSightUserARN" yaml:"-" json:"-"` // contains filtered or unexported fields }
func (*User) DiffGroups ¶ added in v0.3.0
func (u *User) DiffGroups(other *User) ([]UserGroupMembership, []UserGroupMembership)
func (*User) DiffPermissions ¶ added in v0.2.0
func (*User) EqualDashboardPermissions ¶ added in v0.2.0
func (*User) EqualGroups ¶ added in v0.3.0
func (*User) EqualIdentifiers ¶ added in v0.3.0
func (*User) GetDashboard ¶ added in v0.2.0
func (*User) GrantDashboard ¶
func (*User) HasChanges ¶ added in v0.3.0
func (*User) QuickSightUserName ¶
func (*User) RevokeDashboard ¶
type UserGroupMembership ¶ added in v0.3.0
type UserGroupMembership string
func (UserGroupMembership) EqualIdentifiers ¶ added in v0.3.0
func (m UserGroupMembership) EqualIdentifiers(other UserGroupMembership) bool
func (UserGroupMembership) Equals ¶ added in v0.3.0
func (m UserGroupMembership) Equals(other UserGroupMembership) bool
func (UserGroupMembership) GroupID ¶ added in v0.3.0
func (m UserGroupMembership) GroupID() string
type VersionConstraint ¶ added in v0.2.0
type VersionConstraint struct {
gv.Constraints
}
func (*VersionConstraint) Check ¶ added in v0.2.0
func (c *VersionConstraint) Check(v string) bool
func (*VersionConstraint) UnmarshalYAML ¶ added in v0.2.0
func (c *VersionConstraint) UnmarshalYAML(node *yaml.Node) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.