generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 41
/
data_source_file.go
111 lines (104 loc) · 2.73 KB
/
data_source_file.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package file_store
import (
"fmt"
"strings"
"github.com/harness/harness-go-sdk/harness/nextgen"
"github.com/harness/terraform-provider-harness/helpers"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func DataSourceFileStoreNodeFile() *schema.Resource {
resource := &schema.Resource{
Description: "Data source for retrieving files.",
ReadContext: resourceFileStoreNodeFileRead,
Schema: map[string]*schema.Schema{
"parent_identifier": {
Description: "File parent identifier on Harness File Store",
Type: schema.TypeString,
Optional: false,
Computed: true,
},
"file_content_path": {
Description: "File content path to be upladed on Harness File Store",
Type: schema.TypeString,
Optional: false,
Computed: true,
},
"mime_type": {
Description: "File mime type",
Type: schema.TypeString,
Optional: false,
Computed: true,
},
"file_usage": {
Description: fmt.Sprintf("File usage. Valid options are %s", strings.Join(nextgen.FileUsageValues, ", ")),
Type: schema.TypeString,
Optional: false,
Computed: true,
},
"content": {
Description: "File content stored on Harness File Store",
Type: schema.TypeString,
Optional: false,
Computed: true,
},
"path": {
Description: "Harness File Store file path",
Type: schema.TypeString,
Optional: false,
Computed: true,
},
"created_by": {
Description: "Created by",
Type: schema.TypeList,
Optional: false,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"email": {
Description: "User email",
Type: schema.TypeString,
Optional: false,
Computed: true,
},
"name": {
Description: "User name",
Type: schema.TypeString,
Optional: false,
Computed: true,
},
},
},
},
"last_modified_by": {
Description: "Last modified by",
Type: schema.TypeList,
Optional: false,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"email": {
Description: "User email",
Type: schema.TypeString,
Optional: false,
Computed: true,
},
"name": {
Description: "User name",
Type: schema.TypeString,
Optional: false,
Computed: true,
},
},
},
},
"last_modified_at": {
Description: "Last modified at",
Type: schema.TypeInt,
Optional: false,
Computed: true,
},
},
}
helpers.SetMultiLevelDatasourceSchemaIdentifierRequired(resource.Schema)
return resource
}