Documentation
¶
Overview ¶
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func IsValidLimit(name string) bool
- type AuthReq
- type AuthSet
- type AuthSetUpdate
- type Count
- type DevAdmAuthSet
- type DevAdmAuthSetReq
- type Device
- type DeviceAttribute
- type DeviceAuthAttributes
- type DeviceFilter
- type DeviceInventoryUpdate
- type DeviceUpdate
- type Limit
- type NewTenant
- type PreAuthReq
- type Status
Constants ¶
View Source
const ( AuthSetKeyIdData = "id_data" AuthSetKeyPubKey = "pubkey" AuthSetKeyDeviceId = "device_id" AuthSetKeyStatus = "status" AuthSetKeyIdDataSha256 = "id_data_sha256" )
View Source
const ( DevStatusAccepted = "accepted" DevStatusRejected = "rejected" DevStatusPending = "pending" DevStatusPreauth = "preauthorized" DevStatusNoAuth = "noauth" DevKeyId = "_id" DevKeyIdData = "id_data" DevKeyIdDataSha256 = "id_data_sha256" DevKeyStatus = "status" )
View Source
const (
LimitMaxDeviceCount = "max_devices"
)
Variables ¶
View Source
var ( DevStatuses = []string{ DevStatusPending, DevStatusRejected, DevStatusAccepted, DevStatusPreauth, DevStatusNoAuth, } )
View Source
var (
ValidLimits = []string{LimitMaxDeviceCount}
)
Functions ¶
func IsValidLimit ¶
Types ¶
type AuthReq ¶
type AuthReq struct { IdData string `json:"id_data" bson:"id_data"` TenantToken string `json:"tenant_token" bson:"tenant_token"` PubKey string `json:"pubkey"` //helpers, not serialized PubKeyStruct crypto.PublicKey `json:"-" bson:"-"` }
note: fields with underscores need the 'bson' decorator otherwise the underscore will be removed upon write to mongo
type AuthSet ¶
type AuthSet struct { Id string `json:"id" bson:"_id,omitempty"` IdData string `json:"-" bson:"id_data,omitempty"` IdDataStruct map[string]interface{} `json:"identity_data" bson:"id_data_struct,omitempty"` IdDataSha256 []byte `json:"-" bson:"id_data_sha256,omitempty"` PubKey string `json:"pubkey" bson:"pubkey,omitempty"` DeviceId string `json:"-" bson:"device_id,omitempty"` Timestamp *time.Time `json:"ts" bson:"ts,omitempty"` Status string `json:"status" bson:"status,omitempty"` TenantID string `json:"-" bson:"tenant_id"` }
type AuthSetUpdate ¶
type AuthSetUpdate struct { Id string `bson:"id,omitempty"` IdData string `bson:"id_data,omitempty"` IdDataStruct map[string]interface{} `bson:"id_data_struct,omitempty"` IdDataSha256 []byte `bson:"id_data_sha256,omitempty"` PubKey string `bson:"pubkey,omitempty"` DeviceId string `bson:"device_id,omitempty"` Timestamp *time.Time `bson:"ts,omitempty"` Status string `bson:"status,omitempty"` }
type DevAdmAuthSet ¶
type DevAdmAuthSet struct { Id string `json:"id" bson:"_id,omitempty"` DeviceIdentity string `json:"device_identity" bson:"id_data"` Key string `json:"key" bson:"pubkey"` DeviceId string `json:"device_id" bson:"device_id,omitempty"` RequestTime *time.Time `json:"request_time" bson:"request_time"` Status string `json:"status" bson:"status"` Attributes map[string]interface{} `json:"attributes" bson:"attributes"` }
func NewDevAdmAuthSet ¶
func NewDevAdmAuthSet(a AuthSet) (*DevAdmAuthSet, error)
type DevAdmAuthSetReq ¶
type DevAdmAuthSetReq struct { DeviceId string `json:"device_identity" valid:"required"` Key string `json:"key" valid:"required"` //decoded, human-readable identity attribute set Attributes DeviceAuthAttributes `json:"-"` }
func ParseDevAdmAuthSetReq ¶
func ParseDevAdmAuthSetReq(source io.Reader) (*DevAdmAuthSetReq, error)
func (*DevAdmAuthSetReq) Validate ¶
func (r *DevAdmAuthSetReq) Validate() error
type Device ¶
type Device struct { Id string `json:"id" bson:"_id,omitempty"` IdData string `json:"-" bson:"id_data,omitempty"` IdDataStruct map[string]interface{} `json:"identity_data" bson:"id_data_struct,omitempty"` IdDataSha256 []byte `json:"-" bson:"id_data_sha256,omitempty"` Status string `json:"status" bson:",omitempty"` Decommissioning bool `json:"decommissioning" bson:",omitempty"` CreatedTs time.Time `json:"created_ts" bson:"created_ts,omitempty"` UpdatedTs time.Time `json:"updated_ts" bson:"updated_ts,omitempty"` AuthSets []AuthSet `json:"auth_sets" bson:"-"` CheckInTime *time.Time `json:"check_in_time,omitempty" bson:"check_in_time,omitempty"` // nolint:lll //ApiLimits override tenant-wide quota/burst config ApiLimits ratelimits.ApiLimits `json:"-" bson:"api_limits"` //object revision which we use when synchronizing status with inventory service Revision uint `json:"-" bson:"revision"` TenantID string `json:"-" bson:"tenant_id"` }
note: fields with underscores need the 'bson' decorator otherwise the underscore will be removed upon write to mongo
type DeviceAttribute ¶
type DeviceAuthAttributes ¶
type DeviceFilter ¶
type DeviceFilter struct { Status []string `json:"status,omitempty"` IDs []string `json:"id,omitempty"` }
func (*DeviceFilter) UnmarshalJSON ¶
func (fltr *DeviceFilter) UnmarshalJSON(b []byte) error
func (DeviceFilter) Validate ¶
func (fltr DeviceFilter) Validate() error
type DeviceInventoryUpdate ¶
type DeviceUpdate ¶
type DeviceUpdate struct { PubKey string `json:"-" bson:",omitempty"` IdData string `json:"id_data" bson:"id_data,omitempty"` IdDataStruct map[string]interface{} `bson:"id_data_struct,omitempty"` IdDataSha256 []byte `bson:"id_data_sha256,omitempty"` Status string `json:"-" bson:",omitempty"` Decommissioning *bool `json:"-" bson:",omitempty"` UpdatedTs *time.Time `json:"updated_ts" bson:"updated_ts,omitempty"` CheckInTime *time.Time `json:"-" bson:"check_in_time,omitempty"` }
type Limit ¶
type PreAuthReq ¶
type PreAuthReq struct { Force bool `json:"force" bson:"force"` DeviceId string `json:"device_id" valid:"required" bson:"device_id"` AuthSetId string `json:"auth_set_id" valid:"required" bson:"auth_set_id"` IdData string `json:"id_data" valid:"required" bson:"id_data"` PubKey string `json:"pubkey" valid:"required" bson:"pubkey"` }
func ParsePreAuthReq ¶
func ParsePreAuthReq(source io.Reader) (*PreAuthReq, error)
func (*PreAuthReq) Validate ¶
func (r *PreAuthReq) Validate() error
Click to show internal directories.
Click to hide internal directories.