generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 40
/
github_data_source.go
145 lines (139 loc) · 4.89 KB
/
github_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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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 DatasourceConnectorGithub() *schema.Resource {
resource := &schema.Resource{
Description: "Datasource for looking up a Github connector.",
ReadContext: resourceConnectorGithubRead,
Schema: map[string]*schema.Schema{
"url": {
Description: "URL of the github repository or account.",
Type: schema.TypeString,
Computed: true,
},
"connection_type": {
Description: fmt.Sprintf("Whether the connection we're making is to a github repository or a github 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},
},
"execute_on_delegate": {
Description: "Execute on delegate or not.",
Type: schema.TypeBool,
Computed: true,
},
"api_authentication": {
Description: "Configuration for using the github 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{
"github_app": {
Description: "Configuration for using the github app for interacting with the github api.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"installation_id": {
Description: "Enter the Installation ID located in the URL of the installed GitHub App.",
Type: schema.TypeString,
Computed: true,
},
"application_id": {
Description: "Enter the GitHub App ID from the GitHub App General tab.",
Type: schema.TypeString,
Computed: true,
},
"application_id_ref": {
Description: "Reference to the secret containing application id" + secret_ref_text,
Type: schema.TypeString,
Computed: true,
},
"installation_id_ref": {
Description: "Reference to the secret containing installation id." + secret_ref_text,
Type: schema.TypeString,
Computed: true,
},
"private_key_ref": {
Description: "Reference to the secret containing the private key." + secret_ref_text,
Type: schema.TypeString,
Computed: true,
},
},
},
},
"token_ref": {
Description: "Personal access token for interacting with the github 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,
},
},
},
},
"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
}