-
Notifications
You must be signed in to change notification settings - Fork 14
/
sourcesftpupdate.go
259 lines (214 loc) · 7.72 KB
/
sourcesftpupdate.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package shared
import (
"encoding/json"
"errors"
"fmt"
"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/pkg/utils"
)
// SourceSftpUpdateSchemasAuthMethod - Connect through ssh key
type SourceSftpUpdateSchemasAuthMethod string
const (
SourceSftpUpdateSchemasAuthMethodSSHKeyAuth SourceSftpUpdateSchemasAuthMethod = "SSH_KEY_AUTH"
)
func (e SourceSftpUpdateSchemasAuthMethod) ToPointer() *SourceSftpUpdateSchemasAuthMethod {
return &e
}
func (e *SourceSftpUpdateSchemasAuthMethod) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "SSH_KEY_AUTH":
*e = SourceSftpUpdateSchemasAuthMethod(v)
return nil
default:
return fmt.Errorf("invalid value for SourceSftpUpdateSchemasAuthMethod: %v", v)
}
}
type SourceSftpUpdateSSHKeyAuthentication struct {
// Connect through ssh key
authMethod SourceSftpUpdateSchemasAuthMethod `const:"SSH_KEY_AUTH" json:"auth_method"`
// OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )
AuthSSHKey string `json:"auth_ssh_key"`
}
func (s SourceSftpUpdateSSHKeyAuthentication) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(s, "", false)
}
func (s *SourceSftpUpdateSSHKeyAuthentication) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
return err
}
return nil
}
func (o *SourceSftpUpdateSSHKeyAuthentication) GetAuthMethod() SourceSftpUpdateSchemasAuthMethod {
return SourceSftpUpdateSchemasAuthMethodSSHKeyAuth
}
func (o *SourceSftpUpdateSSHKeyAuthentication) GetAuthSSHKey() string {
if o == nil {
return ""
}
return o.AuthSSHKey
}
// SourceSftpUpdateAuthMethod - Connect through password authentication
type SourceSftpUpdateAuthMethod string
const (
SourceSftpUpdateAuthMethodSSHPasswordAuth SourceSftpUpdateAuthMethod = "SSH_PASSWORD_AUTH"
)
func (e SourceSftpUpdateAuthMethod) ToPointer() *SourceSftpUpdateAuthMethod {
return &e
}
func (e *SourceSftpUpdateAuthMethod) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "SSH_PASSWORD_AUTH":
*e = SourceSftpUpdateAuthMethod(v)
return nil
default:
return fmt.Errorf("invalid value for SourceSftpUpdateAuthMethod: %v", v)
}
}
type SourceSftpUpdatePasswordAuthentication struct {
// Connect through password authentication
authMethod SourceSftpUpdateAuthMethod `const:"SSH_PASSWORD_AUTH" json:"auth_method"`
// OS-level password for logging into the jump server host
AuthUserPassword string `json:"auth_user_password"`
}
func (s SourceSftpUpdatePasswordAuthentication) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(s, "", false)
}
func (s *SourceSftpUpdatePasswordAuthentication) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
return err
}
return nil
}
func (o *SourceSftpUpdatePasswordAuthentication) GetAuthMethod() SourceSftpUpdateAuthMethod {
return SourceSftpUpdateAuthMethodSSHPasswordAuth
}
func (o *SourceSftpUpdatePasswordAuthentication) GetAuthUserPassword() string {
if o == nil {
return ""
}
return o.AuthUserPassword
}
type SourceSftpUpdateAuthenticationType string
const (
SourceSftpUpdateAuthenticationTypeSourceSftpUpdatePasswordAuthentication SourceSftpUpdateAuthenticationType = "source-sftp-update_Password Authentication"
SourceSftpUpdateAuthenticationTypeSourceSftpUpdateSSHKeyAuthentication SourceSftpUpdateAuthenticationType = "source-sftp-update_SSH Key Authentication"
)
// SourceSftpUpdateAuthentication - The server authentication method
type SourceSftpUpdateAuthentication struct {
SourceSftpUpdatePasswordAuthentication *SourceSftpUpdatePasswordAuthentication
SourceSftpUpdateSSHKeyAuthentication *SourceSftpUpdateSSHKeyAuthentication
Type SourceSftpUpdateAuthenticationType
}
func CreateSourceSftpUpdateAuthenticationSourceSftpUpdatePasswordAuthentication(sourceSftpUpdatePasswordAuthentication SourceSftpUpdatePasswordAuthentication) SourceSftpUpdateAuthentication {
typ := SourceSftpUpdateAuthenticationTypeSourceSftpUpdatePasswordAuthentication
return SourceSftpUpdateAuthentication{
SourceSftpUpdatePasswordAuthentication: &sourceSftpUpdatePasswordAuthentication,
Type: typ,
}
}
func CreateSourceSftpUpdateAuthenticationSourceSftpUpdateSSHKeyAuthentication(sourceSftpUpdateSSHKeyAuthentication SourceSftpUpdateSSHKeyAuthentication) SourceSftpUpdateAuthentication {
typ := SourceSftpUpdateAuthenticationTypeSourceSftpUpdateSSHKeyAuthentication
return SourceSftpUpdateAuthentication{
SourceSftpUpdateSSHKeyAuthentication: &sourceSftpUpdateSSHKeyAuthentication,
Type: typ,
}
}
func (u *SourceSftpUpdateAuthentication) UnmarshalJSON(data []byte) error {
sourceSftpUpdatePasswordAuthentication := new(SourceSftpUpdatePasswordAuthentication)
if err := utils.UnmarshalJSON(data, &sourceSftpUpdatePasswordAuthentication, "", true, true); err == nil {
u.SourceSftpUpdatePasswordAuthentication = sourceSftpUpdatePasswordAuthentication
u.Type = SourceSftpUpdateAuthenticationTypeSourceSftpUpdatePasswordAuthentication
return nil
}
sourceSftpUpdateSSHKeyAuthentication := new(SourceSftpUpdateSSHKeyAuthentication)
if err := utils.UnmarshalJSON(data, &sourceSftpUpdateSSHKeyAuthentication, "", true, true); err == nil {
u.SourceSftpUpdateSSHKeyAuthentication = sourceSftpUpdateSSHKeyAuthentication
u.Type = SourceSftpUpdateAuthenticationTypeSourceSftpUpdateSSHKeyAuthentication
return nil
}
return errors.New("could not unmarshal into supported union types")
}
func (u SourceSftpUpdateAuthentication) MarshalJSON() ([]byte, error) {
if u.SourceSftpUpdatePasswordAuthentication != nil {
return utils.MarshalJSON(u.SourceSftpUpdatePasswordAuthentication, "", true)
}
if u.SourceSftpUpdateSSHKeyAuthentication != nil {
return utils.MarshalJSON(u.SourceSftpUpdateSSHKeyAuthentication, "", true)
}
return nil, errors.New("could not marshal union type: all fields are null")
}
type SourceSftpUpdate struct {
// The server authentication method
Credentials *SourceSftpUpdateAuthentication `json:"credentials,omitempty"`
// The regular expression to specify files for sync in a chosen Folder Path
FilePattern *string `default:"" json:"file_pattern"`
// Coma separated file types. Currently only 'csv' and 'json' types are supported.
FileTypes *string `default:"csv,json" json:"file_types"`
// The directory to search files for sync
FolderPath *string `default:"" json:"folder_path"`
// The server host address
Host string `json:"host"`
// The server port
Port *int64 `default:"22" json:"port"`
// The server user
User string `json:"user"`
}
func (s SourceSftpUpdate) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(s, "", false)
}
func (s *SourceSftpUpdate) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil {
return err
}
return nil
}
func (o *SourceSftpUpdate) GetCredentials() *SourceSftpUpdateAuthentication {
if o == nil {
return nil
}
return o.Credentials
}
func (o *SourceSftpUpdate) GetFilePattern() *string {
if o == nil {
return nil
}
return o.FilePattern
}
func (o *SourceSftpUpdate) GetFileTypes() *string {
if o == nil {
return nil
}
return o.FileTypes
}
func (o *SourceSftpUpdate) GetFolderPath() *string {
if o == nil {
return nil
}
return o.FolderPath
}
func (o *SourceSftpUpdate) GetHost() string {
if o == nil {
return ""
}
return o.Host
}
func (o *SourceSftpUpdate) GetPort() *int64 {
if o == nil {
return nil
}
return o.Port
}
func (o *SourceSftpUpdate) GetUser() string {
if o == nil {
return ""
}
return o.User
}