• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / deviceauth / 1507843008

13 Sep 2024 11:01AM UTC coverage: 81.326%. Remained the same
1507843008

push

gitlab-ci

web-flow
Merge pull request #727 from mzedel/chore/deprecate

Chore/deprecate

4834 of 5944 relevant lines covered (81.33%)

42.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.56
/client/orchestrator/models.go
1
// Copyright 2022 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
package orchestrator
16

17
import (
18
        "github.com/mendersoftware/deviceauth/model"
19

20
        "github.com/pkg/errors"
21
)
22

23
const (
24
        ServiceDeviceauth = "deviceauth"
25
)
26

27
// DecomissioningReq contains request data of request to start decommissioning workflow
28
type DecommissioningReq struct {
29
        // Device ID
30
        DeviceId string `json:"device_id"`
31
        // Request ID
32
        RequestId string `json:"request_id"`
33
        // TenantID
34
        TenantID string `json:"tenant_id"`
35
}
36

37
// ProvisionDeviceReq contains request data of request to start provisioning workflow
38
type ProvisionDeviceReq struct {
39
        // Request ID
40
        RequestId string `json:"request_id"`
41
        // DeviceID
42
        DeviceID string `json:"device_id"`
43
        // TenantID
44
        TenantID string `json:"tenant_id"`
45

46
        Device *model.Device `json:"device"`
47
        Status string        `json:"status"`
48
}
49

50
// UpdateDeviceStatusReq contains request data of request to start update
51
// device status  workflow
52
type UpdateDeviceStatusReq struct {
53
        // Request ID
54
        RequestId string `json:"request_id"`
55
        // Device IDs
56
        Devices []model.DeviceInventoryUpdate `json:"devices"`
57
        // Tenant ID
58
        TenantId string `json:"tenant_id"`
59
        // new status
60
        Status string `json:"device_status"`
61
}
62

63
type DeviceLimitWarning struct {
64
        RequestID string `json:"request_id"`
65

66
        RecipientEmail string `json:"to"`
67

68
        Subject          string `json:"subject"`
69
        Body             string `json:"body"`
70
        BodyHTML         string `json:"html"`
71
        RemainingDevices *uint  `json:"remaining_devices"`
72
}
73

74
func (dl *DeviceLimitWarning) Validate() error {
12✔
75
        const ErrMsgFmt = `invalid device limit request: missing parameter "%s"`
12✔
76
        if len(dl.RecipientEmail) <= 0 {
14✔
77
                return errors.Errorf(ErrMsgFmt, "to")
2✔
78
        }
2✔
79
        if len(dl.Subject) <= 0 {
10✔
80
                return errors.Errorf(ErrMsgFmt, "subject")
×
81
        }
×
82
        if len(dl.Body) <= 0 {
10✔
83
                return errors.Errorf(ErrMsgFmt, "body")
×
84
        }
×
85
        if len(dl.BodyHTML) <= 0 {
10✔
86
                return errors.Errorf(ErrMsgFmt, "html")
×
87
        }
×
88
        if dl.RemainingDevices == nil {
10✔
89
                return errors.Errorf(ErrMsgFmt, "remaining_devices")
×
90
        }
×
91
        return nil
10✔
92
}
93

94
// UpdateDeviceInventoryReq contains request data of request to start update
95
// device inventory workflow
96
type UpdateDeviceInventoryReq struct {
97
        // Request ID
98
        RequestId string `json:"request_id"`
99
        // Tenant ID
100
        TenantId string `json:"tenant_id"`
101
        // Device ID
102
        DeviceId string `json:"device_id"`
103
        // Attributes scope
104
        Scope string `json:"scope"`
105
        // Device inventory attributes
106
        Attributes string `json:"attributes"`
107
}
108

109
type ReindexReportingWorkflow struct {
110
        RequestID string `json:"request_id"`
111
        TenantID  string `json:"tenant_id"`
112
        DeviceID  string `json:"device_id"`
113
        Service   string `json:"service"`
114
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc