Documentation ¶
Index ¶
- Constants
- Variables
- type BaseResource
- type Client
- func (c *Client) AddUserToGroup(ctx context.Context, record GroupMemberPayload) error
- func (c *Client) GetGroup(ctx context.Context, groupId string) (*Group, error)
- func (c *Client) GetGroupToRole(ctx context.Context, groupId string, roleId string, ...) ([]GroupToRole, int, error)
- func (c *Client) GetGroups(ctx context.Context, paginationVars PaginationVars, groupIds []string) ([]Group, int, error)
- func (c *Client) GetRoles(ctx context.Context, paginationVars PaginationVars) ([]Role, int, error)
- func (c *Client) GetUser(ctx context.Context, userId string) (*User, error)
- func (c *Client) GetUserToGroup(ctx context.Context, userId string, groupId string, ...) ([]GroupMember, int, error)
- func (c *Client) GetUserToRole(ctx context.Context, userId string, roleId string, ...) ([]UserToRole, int, error)
- func (c *Client) GetUsers(ctx context.Context, paginationVars PaginationVars, userIds []string) ([]User, int, error)
- func (c *Client) GrantRoleToGroup(ctx context.Context, record GroupToRolePayload) error
- func (c *Client) GrantRoleToUser(ctx context.Context, record UserToRolePayload) error
- func (c *Client) RemoveUserFromGroup(ctx context.Context, id string) error
- func (c *Client) RevokeRoleFromGroup(ctx context.Context, id string) error
- func (c *Client) RevokeRoleFromUser(ctx context.Context, id string) error
- type FilterVars
- type Group
- type GroupMember
- type GroupMemberPayload
- type GroupMembersResponse
- type GroupResponse
- type GroupToRole
- type GroupToRolePayload
- type GroupToRoleResponse
- type GroupsResponse
- type ListResponse
- type PaginationVars
- type QueryParam
- type Role
- type RolesResponse
- type SingleResponse
- type User
- type UserResponse
- type UserRoles
- type UserRolesResponse
- type UserToRole
- type UserToRolePayload
- type UserToRoleResponse
- type UsersResponse
Constants ¶
View Source
const ( BaseURL = "https://%s.service-now.com/api" TableAPIBaseURL = BaseURL + "/now/table" GlobalApiBaseURL = BaseURL + "/global" UsersBaseUrl = TableAPIBaseURL + "/sys_user" UserBaseUrl = UsersBaseUrl + "/%s" GroupsBaseUrl = TableAPIBaseURL + "/sys_user_group" GroupBaseUrl = GroupsBaseUrl + "/%s" GroupMembersBaseUrl = TableAPIBaseURL + "/sys_user_grmember" GroupMemberDetailBaseUrl = GroupMembersBaseUrl + "/%s" RolesBaseUrl = TableAPIBaseURL + "/sys_user_role" UserRolesBaseUrl = TableAPIBaseURL + "/sys_user_has_role" UserRoleDetailBaseUrl = UserRolesBaseUrl + "/%s" GroupRolesBaseUrl = TableAPIBaseURL + "/sys_group_has_role" GroupRoleDetailBaseUrl = GroupRolesBaseUrl + "/%s" UserRoleInheritanceBaseUrl = GlobalApiBaseURL + "/user_role_inheritance" )
Variables ¶
View Source
var ( UserFields = []string{"sys_id", "name", "roles", "user_name", "email", "first_name", "last_name", "active"} RoleFields = []string{"sys_id", "grantable", "name"} GroupFields = []string{"sys_id", "description", "name"} )
Functions ¶
This section is empty.
Types ¶
type BaseResource ¶
type BaseResource struct {
Id string `json:"sys_id"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddUserToGroup ¶
func (c *Client) AddUserToGroup(ctx context.Context, record GroupMemberPayload) error
func (*Client) GetGroupToRole ¶
func (c *Client) GetGroupToRole(ctx context.Context, groupId string, roleId string, paginationVars PaginationVars) ([]GroupToRole, int, error)
Table `sys_group_has_role` (Group to Role).
func (*Client) GetGroups ¶
func (c *Client) GetGroups(ctx context.Context, paginationVars PaginationVars, groupIds []string) ([]Group, int, error)
Table `sys_user_group` (Groups).
func (*Client) GetUserToGroup ¶
func (c *Client) GetUserToGroup(ctx context.Context, userId string, groupId string, paginationVars PaginationVars) ([]GroupMember, int, error)
Table `sys_user_grmember` (Group Members).
func (*Client) GetUserToRole ¶
func (c *Client) GetUserToRole(ctx context.Context, userId string, roleId string, paginationVars PaginationVars) ([]UserToRole, int, error)
Table `sys_user_has_role` (User to Role).
func (*Client) GetUsers ¶
func (c *Client) GetUsers(ctx context.Context, paginationVars PaginationVars, userIds []string) ([]User, int, error)
Table `sys_user` (Users).
func (*Client) GrantRoleToGroup ¶
func (c *Client) GrantRoleToGroup(ctx context.Context, record GroupToRolePayload) error
func (*Client) GrantRoleToUser ¶
func (c *Client) GrantRoleToUser(ctx context.Context, record UserToRolePayload) error
func (*Client) RemoveUserFromGroup ¶
func (*Client) RevokeRoleFromGroup ¶
type FilterVars ¶
type Group ¶
type Group struct { BaseResource Name string `json:"name"` Description string `json:"description"` Roles string `json:"roles"` }
type GroupMember ¶
type GroupMember struct { BaseResource User string `json:"user"` Group string `json:"group"` }
type GroupMemberPayload ¶
type GroupMembersResponse ¶
type GroupMembersResponse = ListResponse[GroupMember]
type GroupResponse ¶
type GroupResponse = SingleResponse[Group]
type GroupToRole ¶
type GroupToRole struct { BaseResource Inherits string `json:"inherits"` Group string `json:"group"` Role string `json:"role"` }
type GroupToRolePayload ¶
type GroupToRoleResponse ¶
type GroupToRoleResponse ListResponse[GroupToRole]
type GroupsResponse ¶
type GroupsResponse = ListResponse[Group]
type ListResponse ¶
type ListResponse[T any] struct { Result []T `json:"result"` }
type PaginationVars ¶
type QueryParam ¶
type QueryParam interface {
// contains filtered or unexported methods
}
type Role ¶
type Role struct { BaseResource Name string `json:"name"` Grantable string `json:"grantable"` }
type RolesResponse ¶
type RolesResponse = ListResponse[Role]
type SingleResponse ¶
type SingleResponse[T any] struct { Result T `json:"result"` }
type UserResponse ¶
type UserResponse = SingleResponse[User]
type UserRolesResponse ¶
type UserRolesResponse = SingleResponse[UserRoles]
type UserToRole ¶
type UserToRole struct { BaseResource Inherited string `json:"inherited"` User string `json:"user"` Role string `json:"role"` }
type UserToRolePayload ¶
type UserToRoleResponse ¶
type UserToRoleResponse ListResponse[UserToRole]
type UsersResponse ¶
type UsersResponse = ListResponse[User]
Click to show internal directories.
Click to hide internal directories.