iam

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PolicyScopeTypes = []string{
	"local",
	"aws",
}

Functions

func GetGroupInfo

func GetGroupInfo(ich chan<- GroupInfo, group types.Group)

func GetGroupPolicyInfo

func GetGroupPolicyInfo(ctx context.Context, l *rate.Limiter, client IIamClient, ich chan<- GroupPolicyInfo, group types.Group, document bool, filters []string, pols map[string]types.Policy) error

func GetPolicyInfo

func GetPolicyInfo(ctx context.Context, client IIamClient, ich chan<- PolicyInfo, policy types.Policy, document bool, filters []string) error

func GetRoleAssumeInfo

func GetRoleAssumeInfo(ich chan<- RoleAssumeInfo, role types.Role) error

func GetRoleInfo

func GetRoleInfo(ich chan<- RoleInfo, role types.Role)

func GetRolePolicyInfo

func GetRolePolicyInfo(ctx context.Context, l *rate.Limiter, client IIamClient, ich chan<- RolePolicyInfo, role types.Role, document bool, filters []string, pols map[string]types.Policy) error

func GetUserAssociationInfo

func GetUserAssociationInfo(ctx context.Context, l *rate.Limiter, client IIamClient, ich chan<- UserAssociationInfo, user types.User, document bool, filters []string, pols map[string]types.Policy) error

func GetUserGroupInfo

func GetUserGroupInfo(ctx context.Context, client IIamClient, ich chan<- UserGroupInfo, user types.User) error

func GetUserInfo

func GetUserInfo(ich chan<- UserInfo, user types.User)

func GetUserPolicyInfo

func GetUserPolicyInfo(ctx context.Context, l *rate.Limiter, client IIamClient, ich chan<- UserPolicyInfo, user types.User, document bool, filters []string, pols map[string]types.Policy) error

Types

type GroupInfo

type GroupInfo struct {
	GroupName string
	GroupId   string
	Path      string
	GroupArn  string
}

func ListGroupInfo

func ListGroupInfo(ctx context.Context, client IIamClient, ids, names []string) ([]GroupInfo, error)

type GroupPolicyInfo

type GroupPolicyInfo struct {
	GroupName      string
	GroupId        string
	Path           string
	PolicyType     string
	PolicyName     string
	PolicyDocument string
}

func ListGroupPolicyInfo

func ListGroupPolicyInfo(ctx context.Context, client IIamClient, ids, names []string, document bool, filters []string) ([]GroupPolicyInfo, error)

type IIamClient

type IIamClient interface {
	ListUsers(ctx context.Context, params *iam.ListUsersInput, optFns ...func(*iam.Options)) (*iam.ListUsersOutput, error)
	ListGroups(ctx context.Context, params *iam.ListGroupsInput, optFns ...func(*iam.Options)) (*iam.ListGroupsOutput, error)
	ListRoles(ctx context.Context, params *iam.ListRolesInput, optFns ...func(*iam.Options)) (*iam.ListRolesOutput, error)
	ListPolicies(ctx context.Context, params *iam.ListPoliciesInput, optFns ...func(*iam.Options)) (*iam.ListPoliciesOutput, error)

	FetchCustomerPolicies(ctx context.Context) (map[string]types.Policy, error)
	GetGroupsForUser(ctx context.Context, name *string) ([]types.Group, error)
	GetAttachedUserPolicies(ctx context.Context, name *string) ([]types.AttachedPolicy, error)
	GetInlineUserPolicies(ctx context.Context, name *string) ([]string, error)
	GetInlineUserPolicyDocument(ctx context.Context, name *string, policyName *string) (string, error)
	GetAttachedGroupPolicies(ctx context.Context, name *string) ([]types.AttachedPolicy, error)
	GetInlineGroupPolicies(ctx context.Context, name *string) ([]string, error)
	GetInlineGroupPolicyDocument(ctx context.Context, name *string, policyName *string) (string, error)
	GetAttachedRolePolicies(ctx context.Context, name *string) ([]types.AttachedPolicy, error)
	GetInlineRolePolicies(ctx context.Context, name *string) ([]string, error)
	GetInlineRolePolicyDocument(ctx context.Context, name *string, policyName *string) (string, error)
	GetPolicyScope(scope string) (types.PolicyScopeType, error)
	GetPolicyDocument(ctx context.Context, arn *string, version *string) (string, error)
	GetCustomerPolicyDocument(ctx context.Context, arn *string, pols map[string]types.Policy) (string, error)
}

type IamClient

type IamClient struct {
	*iam.Client
}

func NewIamClient

func NewIamClient(cfg *aws.Config) *IamClient

func (*IamClient) FetchCustomerPolicies

func (client *IamClient) FetchCustomerPolicies(ctx context.Context) (map[string]types.Policy, error)

func (*IamClient) GetAttachedGroupPolicies

func (client *IamClient) GetAttachedGroupPolicies(ctx context.Context, name *string) ([]types.AttachedPolicy, error)

func (*IamClient) GetAttachedRolePolicies

func (client *IamClient) GetAttachedRolePolicies(ctx context.Context, name *string) ([]types.AttachedPolicy, error)

func (*IamClient) GetAttachedUserPolicies

func (client *IamClient) GetAttachedUserPolicies(ctx context.Context, name *string) ([]types.AttachedPolicy, error)

func (*IamClient) GetCustomerPolicyDocument

func (client *IamClient) GetCustomerPolicyDocument(ctx context.Context, arn *string, pols map[string]types.Policy) (string, error)

func (*IamClient) GetGroupsForUser

func (client *IamClient) GetGroupsForUser(ctx context.Context, name *string) ([]types.Group, error)

func (*IamClient) GetInlineGroupPolicies

func (client *IamClient) GetInlineGroupPolicies(ctx context.Context, name *string) ([]string, error)

func (*IamClient) GetInlineGroupPolicyDocument

func (client *IamClient) GetInlineGroupPolicyDocument(ctx context.Context, name *string, policyName *string) (string, error)

func (*IamClient) GetInlineRolePolicies

func (client *IamClient) GetInlineRolePolicies(ctx context.Context, name *string) ([]string, error)

func (*IamClient) GetInlineRolePolicyDocument

func (client *IamClient) GetInlineRolePolicyDocument(ctx context.Context, name *string, policyName *string) (string, error)

func (*IamClient) GetInlineUserPolicies

func (client *IamClient) GetInlineUserPolicies(ctx context.Context, name *string) ([]string, error)

func (*IamClient) GetInlineUserPolicyDocument

func (client *IamClient) GetInlineUserPolicyDocument(ctx context.Context, name *string, policyName *string) (string, error)

func (*IamClient) GetPolicyDocument

func (client *IamClient) GetPolicyDocument(ctx context.Context, arn *string, version *string) (string, error)

func (*IamClient) GetPolicyScope

func (client *IamClient) GetPolicyScope(scope string) (types.PolicyScopeType, error)

type PolicyInfo

type PolicyInfo struct {
	PolicyName                    string
	PolicyId                      string
	PolicyArn                     string
	Path                          string
	DefaultVersionId              string
	IsAttachable                  bool
	AttachmentCount               int32
	PermissionsBoundaryUsageCount int32
	PolicyDocument                string
}

func ListPolicyInfo

func ListPolicyInfo(ctx context.Context, client IIamClient, ids, names []string, scope string, document bool, filters []string) ([]PolicyInfo, error)

type PolicyScopeType

type PolicyScopeType int
const (
	PolicyScopeTypeLocal PolicyScopeType = iota
	PolicyScopeTypeAws
)

func (PolicyScopeType) String

func (t PolicyScopeType) String() string

type RoleAssumeInfo

type RoleAssumeInfo struct {
	RoleName                 string
	RoleId                   string
	Path                     string
	AssumeRolePolicyDocument string
}

func ListRoleAssumeInfo

func ListRoleAssumeInfo(ctx context.Context, client IIamClient, ids, names []string) ([]RoleAssumeInfo, error)

type RoleInfo

type RoleInfo struct {
	RoleName string
	RoleId   string
	Path     string
	RoleArn  string
}

func ListRoleInfo

func ListRoleInfo(ctx context.Context, client IIamClient, ids, names []string) ([]RoleInfo, error)

type RolePolicyInfo

type RolePolicyInfo struct {
	RoleName       string
	RoleId         string
	Path           string
	PolicyType     string
	PolicyName     string
	PolicyDocument string
}

func ListRolePolicyInfo

func ListRolePolicyInfo(ctx context.Context, client IIamClient, ids, names []string, document bool, filters []string) ([]RolePolicyInfo, error)

type UserAssociationInfo

type UserAssociationInfo struct {
	UserName       string
	AttachedBy     string
	PolicyType     string
	PolicyName     string
	PolicyDocument string
}

func ListUserAssociationInfo

func ListUserAssociationInfo(ctx context.Context, client IIamClient, ids, names []string, document bool, filters []string) ([]UserAssociationInfo, error)

type UserGroupInfo

type UserGroupInfo struct {
	UserName  string
	UserId    string
	Path      string
	GroupName string
	GroupId   string
}

func ListUserGroupInfo

func ListUserGroupInfo(ctx context.Context, client IIamClient, ids, names []string) ([]UserGroupInfo, error)

type UserInfo

type UserInfo struct {
	UserName string
	UserId   string
	Path     string
	UserArn  string
}

func ListUserInfo

func ListUserInfo(ctx context.Context, client IIamClient, ids, names []string) ([]UserInfo, error)

type UserPolicyInfo

type UserPolicyInfo struct {
	UserName       string
	UserId         string
	Path           string
	PolicyType     string
	PolicyName     string
	PolicyDocument string
}

func ListUserPolicyInfo

func ListUserPolicyInfo(ctx context.Context, client IIamClient, ids, names []string, document bool, filters []string) ([]UserPolicyInfo, error)

Jump to

Keyboard shortcuts

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