-
Notifications
You must be signed in to change notification settings - Fork 41
/
data_source_jenkins_folder.go
73 lines (68 loc) · 2.13 KB
/
data_source_jenkins_folder.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
package jenkins
import (
"context"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func dataSourceJenkinsFolder() *schema.Resource {
return &schema.Resource{
ReadContext: dataSourceJenkinsFolderRead,
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "The unique name of the JenkinsCI folder.",
Required: true,
ValidateDiagFunc: validateJobName,
},
"display_name": {
Type: schema.TypeString,
Description: "The name of the folder to display in the UI.",
Computed: true,
},
"folder": {
Type: schema.TypeString,
Description: "The folder namespace that the folder exists in.",
Optional: true,
ValidateDiagFunc: validateFolderName,
},
"description": {
Type: schema.TypeString,
Description: "The description of this folder's purpose.",
Computed: true,
},
"security": {
Type: schema.TypeSet,
Description: "The Jenkins project-based security configuration.",
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"inheritance_strategy": {
Type: schema.TypeString,
Description: "The strategy for applying these permissions sets to existing inherited permissions.",
Computed: true,
},
"permissions": {
Type: schema.TypeList,
Computed: true,
Description: "The Jenkins permissions sets that provide access to this folder.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
"template": {
Type: schema.TypeString,
Description: "The configuration file template, used to communicate with Jenkins.",
Computed: true,
},
},
}
}
func dataSourceJenkinsFolderRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
name := d.Get("name").(string)
folderName := d.Get("folder").(string)
d.SetId(formatFolderName(folderName + "/" + name))
return resourceJenkinsFolderRead(ctx, d, meta)
}