generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 41
/
gitlab_data_source.go
111 lines (105 loc) · 3.67 KB
/
gitlab_data_source.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 connector
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 DatasourceConnectorGitlab() *schema.Resource {
resource := &schema.Resource{
Description: "Datasource for looking up a Gitlab connector.",
ReadContext: resourceConnectorGitlabRead,
Schema: map[string]*schema.Schema{
"url": {
Description: "URL of the gitlab repository or account.",
Type: schema.TypeString,
Computed: true,
},
"connection_type": {
Description: fmt.Sprintf("Whether the connection we're making is to a gitlab repository or a gitlab account. Valid values are %s.", strings.Join(nextgen.GitConnectorTypeValues, ", ")),
Type: schema.TypeString,
Computed: true,
},
"validation_repo": {
Description: "Repository to test the connection with. This is only used when `connection_type` is `Account`.",
Type: schema.TypeString,
Computed: true,
},
"delegate_selectors": {
Description: "Tags to filter delegates for connection.",
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"api_authentication": {
Description: "Configuration for using the gitlab api. API Access is Computed for using “Git Experience”, for creation of Git based triggers, Webhooks management and updating Git statuses.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"token_ref": {
Description: "Personal access token for interacting with the gitlab api." + secret_ref_text,
Type: schema.TypeString,
Computed: true,
},
},
},
},
"credentials": {
Description: "Credentials to use for the connection.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"http": {
Description: "Authenticate using Username and password over http(s) for the connection.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"username": {
Description: "Username to use for authentication.",
Type: schema.TypeString,
Computed: true,
},
"username_ref": {
Description: "Reference to a secret containing the username to use for authentication." + secret_ref_text,
Type: schema.TypeString,
Computed: true,
},
"token_ref": {
Description: "Reference to a secret containing the personal access to use for authentication." + secret_ref_text,
Type: schema.TypeString,
Computed: true,
},
"password_ref": {
Description: "Reference to a secret containing the password to use for authentication." + secret_ref_text,
Type: schema.TypeString,
Computed: true,
},
},
},
},
"ssh": {
Description: "Authenticate using SSH for the connection.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"ssh_key_ref": {
Description: "Reference to the Harness secret containing the ssh key." + secret_ref_text,
Type: schema.TypeString,
Computed: true,
},
},
},
},
},
},
},
},
}
helpers.SetMultiLevelDatasourceSchemaIdentifierRequired(resource.Schema)
return resource
}