aws

package
v0.0.0-...-979344a Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound      = errors.New("user not found")
	ErrGroupNotFound     = errors.New("group not found")
	ErrNoGroupsFound     = errors.New("no groups found")
	ErrUserNotSpecified  = errors.New("user not specified")
	ErrGroupNotSpecified = errors.New("group not specified")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	AddUserToGroup(*User, *Group) error
	CreateGroup(*Group) (*Group, error)
	CreateUser(*User) (*User, error)
	DeleteGroup(*Group) error
	DeleteUser(*User) error
	FindGroupByDisplayName(string) (*Group, error)
	FindUserByEmail(string) (*User, error)
	FindUserByID(string) (*User, error)
	GetUsers() ([]*User, error)
	GetGroupMembers(*Group) ([]*User, error)
	IsUserInGroup(*User, *Group) (bool, error)
	GetGroups() ([]*Group, error)
	UpdateUser(*User) (*User, error)
	RemoveUserFromGroup(*User, *Group) error
}

Client represents an interface of methods used to communicate with AWS SSO

func NewAWSClient

func NewAWSClient(c Client, d DynamoDBClient) (Client, error)

func NewClient

func NewClient(c HttpClient, config *Config) (Client, error)

NewClient creates a new client to talk with AWS SSO's SCIM endpoint. It requires a http.Client{} as well as the URL and bearer token from the console. If the URL is not parsable, an error will be thrown.

type Config

type Config struct {
	Endpoint string
	Token    string
}

Config specifes the configuration needed for AWS SSO SCIM

func ReadConfigFromFile

func ReadConfigFromFile(path string) (*Config, error)

ReadConfigFromFile will read a TOML file into the Config Struct

type DynamoDBClient

type DynamoDBClient interface {
	GetGroups() ([]*Group, error)
	GetGroupMembers(*Group) ([]*User, error)
	GetUsers() ([]*User, error)
	AddUserToGroup(*User, *Group) error
	RemoveUserFromGroup(*User, *Group) error
	CreateUser(*User) error
	DeleteUser(*User) error
	IsUserInGroup(*User, *Group) (bool, error)
}

func NewDynamoDBClient

func NewDynamoDBClient(config *DynamoDBConfig) DynamoDBClient

type DynamoDBConfig

type DynamoDBConfig struct {
	DynamoDBTableUsers  string
	DynamoDBTableGroups string
}

type DynamoDBGroupUser

type DynamoDBGroupUser struct {
	GroupName string `json:"groupName"`
	Username  string `json:"username"`
}

type Group

type Group struct {
	ID          string   `json:"id,omitempty"`
	Schemas     []string `json:"schemas"`
	DisplayName string   `json:"displayName"`
	Members     []string `json:"members"`
}

Group represents a Group in AWS SSO

func NewGroup

func NewGroup(groupName string) *Group

NewGroup creates an object representing a group with the given name

type GroupFilterResults

type GroupFilterResults struct {
	Schemas      []string `json:"schemas"`
	TotalResults int      `json:"totalResults"`
	ItemsPerPage int      `json:"itemsPerPage"`
	StartIndex   int      `json:"startIndex"`
	Resources    []Group  `json:"Resources"`
}

GroupFilterResults represents filtered results when we search for groups or List all groups

type GroupMemberChange

type GroupMemberChange struct {
	Schemas    []string                     `json:"schemas"`
	Operations []GroupMemberChangeOperation `json:"Operations"`
}

GroupMemberChange represents a change operation for a group

type GroupMemberChangeMember

type GroupMemberChangeMember struct {
	Value string `json:"value"`
}

GroupMemberChangeMember is a value needed for the ID of the member to add/remove

type GroupMemberChangeOperation

type GroupMemberChangeOperation struct {
	Operation string                    `json:"op"`
	Path      string                    `json:"path"`
	Members   []GroupMemberChangeMember `json:"value"`
}

GroupMemberChangeOperation details the operation to take place on a group

type HttpClient

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HttpClient is a generic HTTP Do interface

type OperationType

type OperationType string

OperationType handle patch operations for add/remove

const (
	// OperationAdd is the add operation for a patch
	OperationAdd OperationType = "add"

	// OperationRemove is the remove operation for a patch
	OperationRemove = "remove"
)

type User

type User struct {
	ID       string   `json:"id,omitempty"`
	Schemas  []string `json:"schemas"`
	Username string   `json:"userName"`
	Name     struct {
		FamilyName string `json:"familyName"`
		GivenName  string `json:"givenName"`
	} `json:"name"`
	DisplayName string        `json:"displayName"`
	Active      bool          `json:"active"`
	Emails      []UserEmail   `json:"emails"`
	Addresses   []UserAddress `json:"addresses"`
}

User represents a User in AWS SSO

func NewUser

func NewUser(firstName string, lastName string, email string, active bool) *User

NewUser creates a user object representing a user with the given details.

func UpdateUser

func UpdateUser(id string, firstName string, lastName string, email string, active bool) *User

UpdateUser updates a user object representing a user with the given details.

type UserAddress

type UserAddress struct {
	Type string `json:"type"`
}

UserAddress represents address values of users

type UserEmail

type UserEmail struct {
	Value   string `json:"value"`
	Type    string `json:"type"`
	Primary bool   `json:"primary"`
}

UserEmail represents a user email address

type UserFilterResults

type UserFilterResults struct {
	Schemas      []string `json:"schemas"`
	TotalResults int      `json:"totalResults"`
	ItemsPerPage int      `json:"itemsPerPage"`
	StartIndex   int      `json:"startIndex"`
	Resources    []User   `json:"Resources"`
}

UserFilterResults represents filtered results when we search for users or List all users

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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