-
Notifications
You must be signed in to change notification settings - Fork 1
/
metadata.go
56 lines (45 loc) · 1.16 KB
/
metadata.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
/*
* BSD 3-Clause License
* Copyright © 2022. TIBCO Software Inc.
* This file is subject to the license terms contained
* in the license file that is distributed with this file.
*/
package encrypt
import (
"github.com/project-flogo/core/data/coerce"
)
type Settings struct {
}
// Input for the activity
type Input struct {
Data string `md:"data"` // Data to encrypt
Passphrase string `md:"passphrase"` // Encryption passphrase
}
// ToMap for Input
func (i *Input) ToMap() map[string]interface{} {
return map[string]interface{}{
"data": i.Data,
"passphrase": i.Passphrase,
}
}
// FromMap for input
func (i *Input) FromMap(values map[string]interface{}) error {
i.Data, _ = coerce.ToString(values["data"])
i.Passphrase, _ = coerce.ToString(values["passphrase"])
return nil
}
// Output for the activity
type Output struct {
Data string `md:"data"` // Data encrypted
}
// ToMap conver to object
func (o *Output) ToMap() map[string]interface{} {
return map[string]interface{}{
"data": o.Data,
}
}
// FromMap convert to object
func (o *Output) FromMap(values map[string]interface{}) error {
o.Data, _ = coerce.ToString(values["data"])
return nil
}