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

Twingate / terraform-provider-twingate / 12287568180

12 Dec 2024 12:41AM UTC coverage: 57.177% (-4.9%) from 62.107%
12287568180

Pull #619

github

web-flow
Bump golang.org/x/crypto from 0.29.0 to 0.31.0

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.29.0 to 0.31.0.
- [Commits](https://github.com/golang/crypto/compare/v0.29.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #619: Bump golang.org/x/crypto from 0.29.0 to 0.31.0

5079 of 8883 relevant lines covered (57.18%)

0.96 hits per line

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

80.77
/twingate/internal/client/query/groups-read.go
1
package query
2

3
import (
4
        "github.com/Twingate/terraform-provider-twingate/v3/twingate/internal/attr"
5
        "github.com/Twingate/terraform-provider-twingate/v3/twingate/internal/model"
6
        "github.com/Twingate/terraform-provider-twingate/v3/twingate/internal/utils"
7
)
8

9
const CursorGroups = "groupsEndCursor"
10

11
type ReadGroups struct {
12
        Groups `graphql:"groups(filter: $filter, after: $groupsEndCursor, first: $pageLimit)"`
13
}
14

15
func (q ReadGroups) IsEmpty() bool {
3✔
16
        return len(q.Edges) == 0
3✔
17
}
3✔
18

19
type Groups struct {
20
        PaginatedResource[*GroupEdge]
21
}
22

23
type GroupEdge struct {
24
        Node *gqlGroup
25
}
26

27
func (u Groups) ToModel() []*model.Group {
3✔
28
        return utils.Map[*GroupEdge, *model.Group](u.Edges, func(edge *GroupEdge) *model.Group {
6✔
29
                return edge.Node.ToModel()
3✔
30
        })
3✔
31
}
32

33
type GroupFilterInput struct {
34
        Name     *StringFilterOperationInput  `json:"name"`
35
        Type     GroupTypeFilterOperatorInput `json:"type"`
36
        IsActive BooleanFilterOperatorInput   `json:"isActive"`
37
}
38

39
type StringFilterOperationInput struct {
40
        Eq         *string  `json:"eq"`
41
        Ne         *string  `json:"ne"`
42
        StartsWith *string  `json:"startsWith"`
43
        EndsWith   *string  `json:"endsWith"`
44
        Regexp     *string  `json:"regexp"`
45
        Contains   *string  `json:"contains"`
46
        In         []string `json:"in"`
47
}
48

49
func NewStringFilterOperationInput(name, filter string) *StringFilterOperationInput {
1✔
50
        if filter == "" && name == "" {
2✔
51
                return nil
1✔
52
        }
1✔
53

54
        var stringFilter StringFilterOperationInput
1✔
55

1✔
56
        switch filter {
1✔
57
        case attr.FilterByRegexp:
×
58
                stringFilter.Regexp = &name
×
59
        case attr.FilterByContains:
×
60
                stringFilter.Contains = &name
×
61
        case attr.FilterByExclude:
×
62
                stringFilter.Ne = &name
×
63
        case attr.FilterByPrefix:
×
64
                stringFilter.StartsWith = &name
×
65
        case attr.FilterBySuffix:
×
66
                stringFilter.EndsWith = &name
×
67
        default:
1✔
68
                stringFilter.Eq = &name
1✔
69
        }
70

71
        return &stringFilter
1✔
72
}
73

74
type GroupTypeFilterOperatorInput struct {
75
        In []string `json:"in"`
76
}
77

78
type BooleanFilterOperatorInput struct {
79
        Eq bool `json:"eq"`
80
}
81

82
func NewGroupFilterInput(input *model.GroupsFilter) *GroupFilterInput {
3✔
83
        if input == nil {
6✔
84
                return nil
3✔
85
        }
3✔
86

87
        // default filter settings
88
        filter := &GroupFilterInput{
1✔
89
                Type: GroupTypeFilterOperatorInput{
1✔
90
                        In: []string{
1✔
91
                                model.GroupTypeManual,
1✔
92
                                model.GroupTypeSynced,
1✔
93
                                model.GroupTypeSystem,
1✔
94
                        },
1✔
95
                },
1✔
96
                IsActive: BooleanFilterOperatorInput{Eq: true},
1✔
97
        }
1✔
98

1✔
99
        if input.Name != nil {
2✔
100
                filter.Name = NewStringFilterOperationInput(*input.Name, input.NameFilter)
1✔
101
        }
1✔
102

103
        if len(input.Types) > 0 {
2✔
104
                filter.Type.In = input.Types
1✔
105
        }
1✔
106

107
        if input.IsActive != nil {
2✔
108
                filter.IsActive.Eq = *input.IsActive
1✔
109
        }
1✔
110

111
        return filter
1✔
112
}
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