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

mendersoftware / deployments / 1197570064

01 Mar 2024 06:24PM UTC coverage: 52.222% (-28.4%) from 80.645%
1197570064

Pull #998

gitlab-ci

web-flow
chore: bump github.com/Azure/azure-sdk-for-go/sdk/azcore

Bumps [github.com/Azure/azure-sdk-for-go/sdk/azcore](https://github.com/Azure/azure-sdk-for-go) from 1.9.1 to 1.10.0.
- [Release notes](https://github.com/Azure/azure-sdk-for-go/releases)
- [Changelog](https://github.com/Azure/azure-sdk-for-go/blob/main/documentation/release.md)
- [Commits](https://github.com/Azure/azure-sdk-for-go/compare/sdk/azcore/v1.9.1...sdk/azcore/v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/Azure/azure-sdk-for-go/sdk/azcore
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #998: chore: bump github.com/Azure/azure-sdk-for-go/sdk/azcore from 1.9.1 to 1.10.0

5218 of 9992 relevant lines covered (52.22%)

0.55 hits per line

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

79.49
/model/device_deployment_log.go
1
// Copyright 2021 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 model
16

17
import (
18
        "encoding/json"
19
        "fmt"
20
        "time"
21

22
        validation "github.com/go-ozzo/ozzo-validation/v4"
23
        "github.com/go-ozzo/ozzo-validation/v4/is"
24
        "github.com/pkg/errors"
25
)
26

27
var (
28
        ErrInvalidDeploymentLog = errors.New("invalid deployment log")
29
        ErrInvalidLogMessage    = errors.New("invalid log message")
30
)
31

32
type LogMessage struct {
33
        Timestamp *time.Time `json:"timestamp" valid:"required"`
34
        Level     string     `json:"level" valid:"required"`
35
        Message   string     `json:"message" valid:"required"`
36
}
37

38
func (l LogMessage) Validate() error {
1✔
39
        return validation.ValidateStruct(&l,
1✔
40
                validation.Field(&l.Timestamp, validation.Required),
1✔
41
                validation.Field(&l.Level, validation.Required),
1✔
42
                validation.Field(&l.Message, validation.Required),
1✔
43
        )
1✔
44
}
1✔
45

46
func (l *LogMessage) UnmarshalJSON(raw []byte) error {
1✔
47
        type logMessage LogMessage
1✔
48
        if err := json.Unmarshal(raw, (*logMessage)(l)); err != nil {
1✔
49
                return err
×
50
        }
×
51

52
        if err := l.Validate(); err != nil {
1✔
53
                return err
×
54
        }
×
55
        return nil
1✔
56
}
57

58
func (l LogMessage) String() string {
1✔
59
        return fmt.Sprintf("%s %s: %s", l.Timestamp.UTC().String(), l.Level, l.Message)
1✔
60
}
1✔
61

62
type DeploymentLog struct {
63
        // skip these 2 field when (un)marshaling to/from JSON
64
        DeviceID     string `json:"-" valid:"required"`
65
        DeploymentID string `json:"-" valid:"uuidv4,required"`
66

67
        Messages []LogMessage `json:"messages" valid:"required"`
68
}
69

70
func (d *DeploymentLog) UnmarshalJSON(raw []byte) error {
1✔
71
        type AuxDeploymentLog DeploymentLog
1✔
72

1✔
73
        var adl AuxDeploymentLog
1✔
74

1✔
75
        if err := json.Unmarshal(raw, &adl); err != nil {
1✔
76
                return err
×
77
        }
×
78

79
        if adl.Messages == nil || len(adl.Messages) == 0 {
1✔
80
                return errors.Wrapf(ErrInvalidDeploymentLog, "no messages")
×
81
        }
×
82

83
        d.Messages = adl.Messages
1✔
84
        return nil
1✔
85
}
86

87
func (d DeploymentLog) Validate() error {
1✔
88
        return validation.ValidateStruct(&d,
1✔
89
                validation.Field(&d.DeviceID, validation.Required),
1✔
90
                validation.Field(&d.DeploymentID, validation.Required, is.UUID),
1✔
91
                validation.Field(&d.Messages, validation.Required),
1✔
92
        )
1✔
93
}
1✔
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