Documentation ¶
Index ¶
- Constants
- Variables
- type AuthRequest
- type AuthResponse
- type AuthUsecase
- type HttpError
- type Machine
- type MachineData
- type MachineJson
- type MachineListQuerys
- type MachineListResponse
- type MachineRepository
- type MachineRequest
- type MachineResponse
- type MachineRule
- type MachineRuleJson
- type MachineUpdateNameRequest
- type MachineUsecase
- type MiddleSETERequest
- type Notes
- type NotesCreateRequest
- type NotesDeleteRequest
- type NotesList
- type NotesListJson
- type NotesListResponse
- type NotesRepository
- type NotesUpdateRequest
- type NotesUsecase
- type RuleActivesResponse
- type RuleCreateRequest
- type RuleCreateResponse
- type RuleHistoryResponse
- type RuleJoinService
- type RuleJoinServiceJson
- type RuleListResponse
- type RuleRemoveRequest
- type RuleRepository
- type RuleUsecase
- type Service
- type ServiceCreateRequest
- type ServiceJson
- type ServiceListResponse
- type ServiceRemoveRequest
- type ServiceRepository
- type ServiceUsecase
- type User
- type UserChangePasswordRequest
- type UserChangePasswordResponse
- type UserCreate
- type UserCremoveScopeRequest
- type UserJson
- type UserListResponse
- type UserRegisterRequest
- type UserRepository
- type UserUsecase
Constants ¶
View Source
const ( MACHINERESPONSE_SUCCESS = "success" MACHINERESPONSE_CREATE = "register" MACHINERESPONSE_UNAVAILABLE = "unavailable" )
Variables ¶
View Source
var ( ErrInternalError errHttp = errors.New("internal error, try again") // PARAMETER INVALID ErrUsernameOrPasswordInvalid errHttp = errors.New("username or password invalid") ErrUserAlreayExist errHttp = errors.New("username already exists") ErrScopeInvalid errHttp = errors.New("scope is not valid") ErrParamIdNotUuid errHttp = errors.New("id is not a valid UUID") ErrPageQueryParameterInvalid errHttp = errors.New("page query parameter is not a valid integer") ErrInvalidParameters errHttp = errors.New("invalid parameters") ErrInvalidQuery errHttp = errors.New("invalid query") // ALREADY EXIST ErrServiceAlreayExist errHttp = errors.New("service already exists") ErrScopeAlreadyExist errHttp = errors.New("scope already registered for this user") // AUTHORIZATION ErrOnlyCreatorCanChange errHttp = errors.New("only creator can change") ErrOnlyCreatorCanDelete errHttp = errors.New("only creator can delete") ErrUserIsNotActive errHttp = errors.New("user is not active") ErrForbidden errHttp = errors.New("forbidden") // NOT FOUND ErrNoteNotFound errHttp = errors.New("note not found") ErrServiceNotFound errHttp = errors.New("service not found") ErrUserNotExist errHttp = errors.New("user not exist") ErrMachineNotFound errHttp = errors.New("machine not found") )
Functions ¶
This section is empty.
Types ¶
type AuthRequest ¶
type AuthResponse ¶
type AuthUsecase ¶
type HttpError ¶
type HttpError struct {
Message string `json:"message"`
}
func ErrorHttpMessage ¶
type MachineData ¶
type MachineJson ¶
type MachineListQuerys ¶
type MachineListResponse ¶
type MachineListResponse struct { Total int `json:"total"` Count int `json:"count"` Page int `json:"page"` Data []MachineJson `json:"data"` }
type MachineRepository ¶
type MachineRepository interface { Create(ctx context.Context, guid, name, os, query string) error FindByGuid(ctx context.Context, guid string) (*Machine, error) List(ctx context.Context, q MachineListQuerys) ([]Machine, error) FindById(ctx context.Context, id string) (*Machine, error) Count(ctx context.Context) (int, error) UpdateName(ctx context.Context, id, name string) error }
type MachineRequest ¶
type MachineRequest struct {
Data string `json:"data" validate:"required,min=32,base64"`
}
type MachineResponse ¶
type MachineRule ¶
type MachineRuleJson ¶
type MachineUsecase ¶
type MachineUsecase interface { Create(ctx context.Context, md *MachineData) error FindByGuid(ctx context.Context, guid string) (*Machine, error) List(ctx context.Context, q MachineListQuerys) ([]MachineJson, error) Detail(ctx context.Context, id string) (*MachineJson, error) Count(ctx context.Context) (int, error) UpdateName(ctx context.Context, id, name string) error }
type MiddleSETERequest ¶ added in v0.1.0
type MiddleSETERequest struct {
Data string `json:"data" validate:"required"`
}
type NotesCreateRequest ¶
type NotesDeleteRequest ¶
type NotesDeleteRequest struct {
ID string `json:"id" validate:"required,uuid"`
}
type NotesListJson ¶
type NotesListResponse ¶
type NotesListResponse struct { Total int `json:"total"` Count int `json:"count"` Page int `json:"page"` Data []NotesListJson `json:"data"` }
type NotesRepository ¶
type NotesRepository interface { Create(c context.Context, text, machineId, userId string) error FindById(c context.Context, id string) (Notes, error) ListByMachineId(c context.Context, machineId string, page int) ([]NotesList, error) ChangeNote(c context.Context, id, text string) error Delete(c context.Context, id string) error CountByMachineId(c context.Context, machineId string) (int, error) }
type NotesUpdateRequest ¶
type NotesUsecase ¶
type NotesUsecase interface { Create(c context.Context, text, machineId, userId string) error ListByMachineId(c context.Context, machineId string, page int) ([]NotesListJson, error) ChangeNote(c context.Context, id, userId, text string) error Delete(c context.Context, userId, noteId string) error CountByMachineId(c context.Context, machineId string) (int, error) }
type RuleActivesResponse ¶
type RuleActivesResponse struct { MachineId string `json:"machine_id"` Total int `json:"total"` Data []RuleJoinServiceJson `json:"data"` }
type RuleCreateRequest ¶
type RuleCreateResponse ¶
type RuleHistoryResponse ¶
type RuleHistoryResponse struct { MachineId string `json:"machine_id"` Total int `json:"total"` Count int `json:"count"` Page int `json:"page"` Data []MachineRuleJson `json:"data"` }
type RuleJoinService ¶
type RuleJoinServiceJson ¶
type RuleListResponse ¶
type RuleListResponse struct { Total int `json:"total"` Count int `json:"count"` Page int `json:"page"` Data []RuleJoinServiceJson `json:"data"` }
type RuleRemoveRequest ¶
type RuleRepository ¶
type RuleRepository interface { Create(ctx context.Context, machineId, serviceId string, expire int) error History(ctx context.Context, machineId string, serviceId string, page int) ([]MachineRule, error) Count(ctx context.Context) (int, error) CountByMachineId(ctx context.Context, machineId string, serviceId string) (int, error) List(ctx context.Context, page int, onlyActives bool) ([]RuleJoinService, error) Invalidate(ctx context.Context, machineId, serviceId string) error Actives(ctx context.Context, machineId string) ([]RuleJoinService, error) ActiveByMachineIdAndServiceId(ctx context.Context, machineId, serviceId string) (*MachineRule, error) CountOnlyActives(ctx context.Context) (int, error) }
type RuleUsecase ¶
type RuleUsecase interface { Create(ctx context.Context, machineId, serviceId string, expire int) error History(ctx context.Context, machineId string, serviceId string, page int) ([]MachineRuleJson, error) Count(ctx context.Context) (int, error) CountByMachineId(ctx context.Context, machineId string, serviceId string) (int, error) List(ctx context.Context, page int, onlyActives bool) ([]RuleJoinServiceJson, error) Remove(ctx context.Context, machineId, serviceId string) error Actives(ctx context.Context, machineId string) ([]RuleJoinServiceJson, error) ActiveByMachineIdAndServiceId(ctx context.Context, machineId, serviceId string) (*MachineRule, error) CountOnlyActives(ctx context.Context) (int, error) }
type ServiceCreateRequest ¶
type ServiceJson ¶
type ServiceListResponse ¶
type ServiceListResponse struct { Count int `json:"count"` Total int `json:"total"` Page int `json:"page"` Data []ServiceJson `json:"data"` }
type ServiceRemoveRequest ¶
type ServiceRemoveRequest struct {
ID string `json:"id" validate:"required,uuid"`
}
type ServiceRepository ¶
type ServiceRepository interface { Create(ctx context.Context, name, description string) error List(ctx context.Context, page int) ([]Service, error) Remove(ctx context.Context, id string) error FindByName(ctx context.Context, name string) (*Service, error) FindById(ctx context.Context, id string) (*Service, error) Count(ctx context.Context) (int, error) }
type ServiceUsecase ¶
type ServiceUsecase interface { Create(ctx context.Context, name, description string) error List(ctx context.Context, page int) ([]ServiceJson, error) Remove(ctx context.Context, id string) error FindByName(ctx context.Context, name string) (*Service, error) FindById(ctx context.Context, id string) (*Service, error) Count(ctx context.Context) (int, error) }
type UserChangePasswordRequest ¶
type UserChangePasswordRequest struct {
NewPassword string `json:"password" validate:"required,min=6,max=150"`
}
type UserChangePasswordResponse ¶
type UserChangePasswordResponse struct {
Message string `json:"message"`
}
type UserCreate ¶
type UserCremoveScopeRequest ¶
type UserListResponse ¶
type UserRegisterRequest ¶
type UserRepository ¶
type UserRepository interface { Create(c context.Context, u *User) error FindByUsername(c context.Context, username string) (*User, error) UpdatePassword(c context.Context, id, password string) error FindById(c context.Context, id string) (*User, error) List(c context.Context, page int) ([]User, error) AddScope(c context.Context, id, s string) error RemoveScope(c context.Context, id, s string) error ChangeStatus(c context.Context, id string) error Count(c context.Context) (int, error) Delete(c context.Context, id string) error }
type UserUsecase ¶
type UserUsecase interface { Create(c context.Context, userCreate *UserCreate) error FindByUsername(c context.Context, username string) (*User, error) FindById(c context.Context, id string) (*User, error) UpdatePassword(c context.Context, id, password string) error ExistUsername(c context.Context, username string) bool List(c context.Context, page int) ([]UserJson, error) AddScopeWithUserId(c context.Context, id, s string) error RemoveScopeWithUserId(c context.Context, id, s string) error Disable(c context.Context, id string) error Enable(c context.Context, id string) error Count(c context.Context) (int, error) DeleteById(c context.Context, id string) error DeleteByUsername(c context.Context, username string) error }
Click to show internal directories.
Click to hide internal directories.