-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.go
42 lines (34 loc) · 813 Bytes
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package ssm
import (
"github.com/mariotoffia/ssm/internal/asm"
"github.com/mariotoffia/ssm/internal/pms"
)
func (s *Serializer) getAndConfigurePms() (*pms.Serializer, error) {
if s.hasconfig {
return pms.NewFromConfig(s.config, s.service).
SeDefaultTier(s.tier), nil
}
pmsRepository, err := pms.New(s.service)
if err != nil {
return nil, err
}
return pmsRepository.SeDefaultTier(s.tier), nil
}
func (s *Serializer) getAndConfigureAsm() (*asm.Serializer, error) {
if s.hasconfig {
return asm.NewFromConfig(s.config, s.service), nil
}
asmRepository, err := asm.New(s.service)
if err != nil {
return nil, err
}
return asmRepository, nil
}
func find(slice []Usage, val Usage) (int, bool) {
for i, item := range slice {
if item == val {
return i, true
}
}
return -1, false
}