mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
61d0427898
Signed-off-by: dusan <borovcanindusan1@gmail.com>
44 lines
784 B
Go
44 lines
784 B
Go
// Copyright (c) Abstract Machines
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package api
|
|
|
|
import apiutil "github.com/absmach/magistrala/api/http/util"
|
|
|
|
type provisionReq struct {
|
|
token string
|
|
Name string `json:"name"`
|
|
ExternalID string `json:"external_id"`
|
|
ExternalKey string `json:"external_key"`
|
|
}
|
|
|
|
func (req provisionReq) validate() error {
|
|
if req.ExternalID == "" {
|
|
return apiutil.ErrMissingID
|
|
}
|
|
|
|
if req.ExternalKey == "" {
|
|
return apiutil.ErrBearerKey
|
|
}
|
|
|
|
if req.Name == "" {
|
|
return apiutil.ErrMissingName
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type certReq struct {
|
|
token string
|
|
ClientID string `json:"client_id"`
|
|
TTL string `json:"ttl,omitempty"`
|
|
}
|
|
|
|
func (req certReq) validate() error {
|
|
if req.ClientID == "" {
|
|
return apiutil.ErrMissingID
|
|
}
|
|
|
|
return nil
|
|
}
|