forked from stmcginnis/gofish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
datasecuritylineofservice.go
94 lines (82 loc) · 2.94 KB
/
datasecuritylineofservice.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// SPDX-License-Identifier: BSD-3-Clause
//
package swordfish
import (
"github.com/stmcginnis/gofish/common"
)
// DataSecurityLineOfService is used to describe data security service
// level requirements.
type DataSecurityLineOfService struct {
common.Entity
// ODataContext is the odata context.
ODataContext string `json:"@odata.context"`
// ODataType is the odata type.
ODataType string `json:"@odata.type"`
// AntivirusEngineProvider shall specify an AntiVirus provider.
AntivirusEngineProvider string
// AntivirusScanPolicies shall specify the
// policy for triggering an AntiVirus scan.
AntivirusScanPolicies []AntiVirusScanTrigger
// ChannelEncryptionStrength shall specify a key size in a symmetric
// encryption algorithm for transport channel encryption.
ChannelEncryptionStrength KeySize
// DataSanitizationPolicy shall specify the data sanitization policy.
DataSanitizationPolicy DataSanitizationPolicy
// Description provides a description of this resource.
Description string
// HostAuthenticationType shall specify the
// authentication type for hosts (servers) or initiator endpoints.
HostAuthenticationType AuthenticationType
// MediaEncryptionStrength shall specify a key
// size in a symmetric encryption algorithm for media encryption.
MediaEncryptionStrength KeySize
// SecureChannelProtocol shall specify the
// protocol that provide encrypted communication.
SecureChannelProtocol SecureChannelProtocol
// UserAuthenticationType shall specify the
// authentication type for users (or programs).
UserAuthenticationType AuthenticationType
}
// GetDataSecurityLineOfService will get a DataSecurityLineOfService instance from the service.
func GetDataSecurityLineOfService(c common.Client, uri string) (*DataSecurityLineOfService, error) {
var dataSecurityLineOfService DataSecurityLineOfService
return &dataSecurityLineOfService, dataSecurityLineOfService.Get(c, uri, &dataSecurityLineOfService)
}
// ListReferencedDataSecurityLineOfServices gets the collection of DataSecurityLineOfService from
// a provided reference.
func ListReferencedDataSecurityLineOfServices(c common.Client, link string) ([]*DataSecurityLineOfService, error) { //nolint:dupl
var result []*DataSecurityLineOfService
if link == "" {
return result, nil
}
type GetResult struct {
Item *DataSecurityLineOfService
Link string
Error error
}
ch := make(chan GetResult)
collectionError := common.NewCollectionError()
get := func(link string) {
datasecuritylineofservice, err := GetDataSecurityLineOfService(c, link)
ch <- GetResult{Item: datasecuritylineofservice, Link: link, Error: err}
}
go func() {
err := common.CollectList(get, c, link)
if err != nil {
collectionError.Failures[link] = err
}
close(ch)
}()
for r := range ch {
if r.Error != nil {
collectionError.Failures[r.Link] = r.Error
} else {
result = append(result, r.Item)
}
}
if collectionError.Empty() {
return result, nil
}
return result, collectionError
}