resources

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLevel

type AccessLevel struct {
	// role name to show in FE
	Name string `json:"name"`
	// role value to use in BE
	Value int64 `json:"value"`
}

type AddUser

type AddUser struct {
	// user's id from identity
	AccessLevel int `json:"access_level"`
	// action that must be handled in module, must be \"add_user\"
	Action string `json:"action"`
	// link where module has to add user
	Link string `json:"link"`
	// user's id from identity
	UserId string `json:"user_id"`
	// user's username from gitlab
	Username string `json:"username"`
}

type DeleteUser

type DeleteUser struct {
	// action that must be handled in module, must be \"delete_user\"
	Action string `json:"action"`
	// user's username from gitlab
	Username string `json:"username"`
}

type Details

type Details json.RawMessage

func (Details) MarshalJSON

func (d Details) MarshalJSON() ([]byte, error)

MarshalJSON - casts Details to []byte

func (*Details) Scan

func (r *Details) Scan(src interface{}) error

Scan - implements db driver method for auto unmarshal

func (Details) String

func (d Details) String() string

func (*Details) UnmarshalJSON

func (d *Details) UnmarshalJSON(data []byte) error

UnmarshalJSON - casts data to Details

func (Details) Value

func (r Details) Value() (driver.Value, error)

Value - implements db driver method for auto marshal

type EstimatedTime

type EstimatedTime struct {
	Key
	Attributes EstimatedTimeAttributes `json:"attributes"`
}

type EstimatedTimeAttributes

type EstimatedTimeAttributes struct {
	EstimatedTime string `json:"estimated_time"`
}

type EstimatedTimeListResponse

type EstimatedTimeListResponse struct {
	Data     []EstimatedTime `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
}

type EstimatedTimeResponse

type EstimatedTimeResponse struct {
	Data     EstimatedTime `json:"data"`
	Included Included      `json:"included"`
}

type Flag

type Flag struct {
	Name  string `json:"name"`
	Value int32  `json:"value"`
}

type Flagger

type Flagger interface {
	IsFlag() bool
}

type Flags

type Flags struct {
	Mask   int32  `json:"mask"`
	Values []Flag `json:"flags"`
}

func FlagsFromMask

func FlagsFromMask(mask int32, allFlags map[int32]string) Flags

type GetUsers

type GetUsers struct {
	// action that must be handled in module, must be \"get_users\"
	Action string `json:"action"`
	// link where module has to add user
	Link string `json:"link"`
}

type Included

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

Included - an array of Resource objects that are related to the primary data and/or each other (“included resources”).

func (*Included) Add

func (c *Included) Add(includes ...Resource)

Add - adds new include into collection. If one already present - skips it

func (Included) MarshalJSON

func (c Included) MarshalJSON() ([]byte, error)

MarshalJSON - marshals include collection as array of json objects

func (*Included) MustEstimatedTime

func (c *Included) MustEstimatedTime(key Key) *EstimatedTime

MustEstimatedTime - returns EstimatedTime from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustInputs

func (c *Included) MustInputs(key Key) *Inputs

MustInputs - returns Inputs from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (c *Included) MustLink(key Key) *Link

MustLink - returns Link from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustModule

func (c *Included) MustModule(key Key) *Module

MustModule - returns Module from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustModuleRoles

func (c *Included) MustModuleRoles(key Key) *ModuleRoles

MustModuleRoles - returns ModuleRoles from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustRequest

func (c *Included) MustRequest(key Key) *Request

MustRequest - returns Request from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustRole

func (c *Included) MustRole(key Key) *Role

MustRole - returns Role from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustRoles

func (c *Included) MustRoles(key Key) *Roles

MustRoles - returns Roles from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustSubmodules

func (c *Included) MustSubmodules(key Key) *Submodules

MustSubmodules - returns Submodules from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustUser

func (c *Included) MustUser(key Key) *User

MustUser - returns User from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustUserInfo

func (c *Included) MustUserInfo(key Key) *UserInfo

MustUserInfo - returns UserInfo from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustUserPermission

func (c *Included) MustUserPermission(key Key) *UserPermission

MustUserPermission - returns UserPermission from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) UnmarshalJSON

func (c *Included) UnmarshalJSON(data []byte) error

UmarshalJSON - unmarshal array of json objects into include collection

type Inputs

type Inputs struct {
	Key
	Attributes InputsAttributes `json:"attributes"`
}

type InputsAttributes

type InputsAttributes struct {
	// level of access that would be given
	AccessLevel string `json:"access_level"`
	// link for which would be given access
	Link string `json:"link"`
	// username from gitlab
	Username string `json:"username"`
}

type InputsListResponse

type InputsListResponse struct {
	Data     []Inputs `json:"data"`
	Included Included `json:"included"`
	Links    *Links   `json:"links"`
}

type InputsResponse

type InputsResponse struct {
	Data     Inputs   `json:"data"`
	Included Included `json:"included"`
}

type Key

type Key struct {
	ID   string       `json:"id"`
	Type ResourceType `json:"type"`
}

func NewKeyInt64

func NewKeyInt64(id int64, resourceType ResourceType) Key

func (Key) AsRelation

func (r Key) AsRelation() *Relation

func (*Key) GetKey

func (r *Key) GetKey() Key

func (Key) GetKeyP

func (r Key) GetKeyP() *Key
type Link struct {
	Key
	Attributes LinkAttributes `json:"attributes"`
}

type LinkAttributes

type LinkAttributes struct {
	// indicates whether link exists
	IsExists *bool `json:"is_exists,omitempty"`
	// link to repository or group
	Link string `json:"link"`
}

type LinkListResponse

type LinkListResponse struct {
	Data     []Link   `json:"data"`
	Included Included `json:"included"`
	Links    *Links   `json:"links"`
}

type LinkResponse

type LinkResponse struct {
	Data     Link     `json:"data"`
	Included Included `json:"included"`
}
type Links struct {
	First string `json:"first"`
	Last  string `json:"last"`
	Next  string `json:"next"`
	Prev  string `json:"prev"`
	Self  string `json:"self"`
}

type Module

type Module struct {
	Key
	Attributes ModuleAttributes `json:"attributes"`
}

type ModuleAttributes

type ModuleAttributes struct {
	// indicates whether module (gitlab, telegram etc.) or service (unverified, role etc.)
	IsModule bool `json:"is_module"`
	// Module url
	Link string `json:"link"`
	// Module name
	Name string `json:"name"`
	// Module prefix to use in FE
	Prefix string `json:"prefix"`
	// Module name to use in FE
	Title string `json:"title"`
	// Module topic for sender and others
	Topic string `json:"topic"`
}

type ModuleListResponse

type ModuleListResponse struct {
	Data     []Module `json:"data"`
	Included Included `json:"included"`
	Links    *Links   `json:"links"`
}

type ModuleResponse

type ModuleResponse struct {
	Data     Module   `json:"data"`
	Included Included `json:"included"`
}

type ModuleRoles

type ModuleRoles struct {
	Key
	Attributes ModuleRolesAttributes `json:"attributes"`
}

type ModuleRolesAttributes

type ModuleRolesAttributes struct {
}

type ModuleRolesListResponse

type ModuleRolesListResponse struct {
	Data     []ModuleRoles `json:"data"`
	Included Included      `json:"included"`
	Links    *Links        `json:"links"`
}

type ModuleRolesResponse

type ModuleRolesResponse struct {
	Data     ModuleRoles `json:"data"`
	Included Included    `json:"included"`
}

type Relation

type Relation struct {
	Data  *Key   `json:"data,omitempty"`
	Links *Links `json:"links,omitempty"`
}

type RelationCollection

type RelationCollection struct {
	Data  []Key  `json:"data"`
	Links *Links `json:"links,omitempty"`
}

func (RelationCollection) MarshalJSON

func (r RelationCollection) MarshalJSON() ([]byte, error)

type RemoveUser

type RemoveUser struct {
	// action that must be handled in module, must be \"remove_user\"
	Action string `json:"action"`
	// link where module has to add user
	Link string `json:"link"`
	// user's username from gitlab
	Username string `json:"username"`
}

action to remove user from repository or group in gitlab

type Request

type Request struct {
	Key
	Attributes    RequestAttributes    `json:"attributes"`
	Relationships RequestRelationships `json:"relationships"`
}

type RequestAttributes

type RequestAttributes struct {
	// Module to grant permission
	Module string `json:"module"`
	// Already built payload to grant permission <br><br> -> \"add_user\" = action to add user in repository or group in gitlab<br> -> \"verify_user\" = action to verify user in gitlab module (connect user id from identity with gitlab username)<br> -> \"update_user\" = action to update user access level in repository or group in gitlab<br> -> \"get_users\" = action to get users with their permissions from repository or group in gitlab<br> -> \"delete_user\" = action to delete user from module (from all links)<br> -> \"remove_user\" = action to remove user from repository or group in gitlab<br>
	Payload json.RawMessage `json:"payload"`
}

type RequestListResponse

type RequestListResponse struct {
	Data     []Request `json:"data"`
	Included Included  `json:"included"`
	Links    *Links    `json:"links"`
}

type RequestRelationships

type RequestRelationships struct {
	User Relation `json:"user"`
}

type RequestResponse

type RequestResponse struct {
	Data     Request  `json:"data"`
	Included Included `json:"included"`
}

type Resource

type Resource interface {
	//GetKey - returns key of the Resource
	GetKey() Key
}

type ResourceType

type ResourceType string
const (
	ESTIMATED_TIME  ResourceType = "estimated_time"
	INPUTS          ResourceType = "inputs"
	LINKS           ResourceType = "links"
	MODULES         ResourceType = "modules"
	REQUESTS        ResourceType = "requests"
	ROLE            ResourceType = "role"
	ROLES           ResourceType = "roles"
	USER            ResourceType = "user"
	USER_PERMISSION ResourceType = "user_permission"
)

List of ResourceType

type Role

type Role struct {
	Key
	Attributes RoleAttributes `json:"attributes"`
}

type RoleAttributes

type RoleAttributes struct {
	// role name to show in FE
	Name string `json:"name"`
	// role value to use in BE
	Value string `json:"value"`
}

type RoleListResponse

type RoleListResponse struct {
	Data     []Role   `json:"data"`
	Included Included `json:"included"`
	Links    *Links   `json:"links"`
}

type RoleResponse

type RoleResponse struct {
	Data     Role     `json:"data"`
	Included Included `json:"included"`
}

type Roles

type Roles struct {
	Key
	Attributes RolesAttributes `json:"attributes"`
}

type RolesAttributes

type RolesAttributes struct {
	List []AccessLevel `json:"list"`
	// flag to show if any role was found for given link
	Req bool `json:"req"`
}

type RolesListResponse

type RolesListResponse struct {
	Data     []Roles  `json:"data"`
	Included Included `json:"included"`
	Links    *Links   `json:"links"`
}

type RolesResponse

type RolesResponse struct {
	Data     Roles    `json:"data"`
	Included Included `json:"included"`
}

type Submodules

type Submodules struct {
	Key
	Attributes SubmodulesAttributes `json:"attributes"`
}

type SubmodulesAttributes

type SubmodulesAttributes struct {
	Links []string `json:"links"`
}

type SubmodulesListResponse

type SubmodulesListResponse struct {
	Data     []Submodules `json:"data"`
	Included Included     `json:"included"`
	Links    *Links       `json:"links"`
}

type SubmodulesResponse

type SubmodulesResponse struct {
	Data     Submodules `json:"data"`
	Included Included   `json:"included"`
}

type UpdateUser

type UpdateUser struct {
	// user's id from identity
	AccessLevel int `json:"access_level"`
	// action that must be handled in module, must be \"update_user\"
	Action string `json:"action"`
	// link where module has to add user
	Link string `json:"link"`
	// user's username from gitlab
	Username string `json:"username"`
}

type User

type User struct {
	Key
	Attributes UserAttributes `json:"attributes"`
}

type UserAttributes

type UserAttributes struct {
	// submodule access level
	AccessLevel *string `json:"access_level,omitempty"`
	// timestamp without timezone when user was created
	CreatedAt *time.Time `json:"created_at,omitempty"`
	// module name
	Module string `json:"module"`
	// first submodule name
	Submodule *string `json:"submodule,omitempty"`
	// user id from identity module, if user is not verified - null
	UserId *int64 `json:"user_id,omitempty"`
	// username from gitlab
	Username string `json:"username"`
}

type UserInfo

type UserInfo struct {
	Key
	Attributes UserInfoAttributes `json:"attributes"`
}

type UserInfoAttributes

type UserInfoAttributes struct {
	// url to gitlab avatar
	AvatarUrl string `json:"avatar_url"`
	// name from gitlab account
	Name string `json:"name"`
	// username from gitlab
	Username string `json:"username"`
}

type UserInfoListResponse

type UserInfoListResponse struct {
	Data     []UserInfo `json:"data"`
	Included Included   `json:"included"`
	Links    *Links     `json:"links"`
}

type UserInfoResponse

type UserInfoResponse struct {
	Data     UserInfo `json:"data"`
	Included Included `json:"included"`
}

type UserListResponse

type UserListResponse struct {
	Data     []User   `json:"data"`
	Included Included `json:"included"`
	Links    *Links   `json:"links"`
}

type UserPermission

type UserPermission struct {
	Key
	Attributes UserPermissionAttributes `json:"attributes"`
}

type UserPermissionAttributes

type UserPermissionAttributes struct {
	AccessLevel AccessLevel `json:"access_level"`
	// indicates whether element have nested object
	Deployable bool `json:"deployable"`
	// shows when permission is expired
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
	// full path to repo for which was given access
	Link string `json:"link"`
	// user id from gitlab
	ModuleId int64 `json:"module_id"`
	// path to repo for which was given access
	Path string `json:"path"`
	// type of link for which was given access (group or project)
	Type string `json:"type"`
	// user id from identity
	UserId *int64 `json:"user_id,omitempty"`
	// username from gitlab
	Username string `json:"username"`
}

type UserPermissionListResponse

type UserPermissionListResponse struct {
	Data     []UserPermission `json:"data"`
	Included Included         `json:"included"`
	Links    *Links           `json:"links"`
}

type UserPermissionResponse

type UserPermissionResponse struct {
	Data     UserPermission `json:"data"`
	Included Included       `json:"included"`
}

type UserResponse

type UserResponse struct {
	Data     User     `json:"data"`
	Included Included `json:"included"`
}

type VerifyUser

type VerifyUser struct {
	// action that must be handled in module, must be \"verify_user\"
	Action string `json:"action"`
	// user's id from identity
	UserId string `json:"user_id"`
	// user's username from gitlab
	Username string `json:"username"`
}

Jump to

Keyboard shortcuts

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