-
Notifications
You must be signed in to change notification settings - Fork 14
/
sourceauth0update.go
235 lines (192 loc) · 7.92 KB
/
sourceauth0update.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
// 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"
)
type SourceAuth0UpdateSchemasCredentialsAuthenticationMethod string
const (
SourceAuth0UpdateSchemasCredentialsAuthenticationMethodOauth2AccessToken SourceAuth0UpdateSchemasCredentialsAuthenticationMethod = "oauth2_access_token"
)
func (e SourceAuth0UpdateSchemasCredentialsAuthenticationMethod) ToPointer() *SourceAuth0UpdateSchemasCredentialsAuthenticationMethod {
return &e
}
func (e *SourceAuth0UpdateSchemasCredentialsAuthenticationMethod) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "oauth2_access_token":
*e = SourceAuth0UpdateSchemasCredentialsAuthenticationMethod(v)
return nil
default:
return fmt.Errorf("invalid value for SourceAuth0UpdateSchemasCredentialsAuthenticationMethod: %v", v)
}
}
type OAuth2AccessToken struct {
// Also called <a href="https://auth0.com/docs/secure/tokens/access-tokens/get-management-api-access-tokens-for-testing">API Access Token </a> The access token used to call the Auth0 Management API Token. It's a JWT that contains specific grant permissions knowns as scopes.
AccessToken string `json:"access_token"`
authType SourceAuth0UpdateSchemasCredentialsAuthenticationMethod `const:"oauth2_access_token" json:"auth_type"`
}
func (o OAuth2AccessToken) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(o, "", false)
}
func (o *OAuth2AccessToken) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &o, "", false, true); err != nil {
return err
}
return nil
}
func (o *OAuth2AccessToken) GetAccessToken() string {
if o == nil {
return ""
}
return o.AccessToken
}
func (o *OAuth2AccessToken) GetAuthType() SourceAuth0UpdateSchemasCredentialsAuthenticationMethod {
return SourceAuth0UpdateSchemasCredentialsAuthenticationMethodOauth2AccessToken
}
type SourceAuth0UpdateSchemasAuthenticationMethod string
const (
SourceAuth0UpdateSchemasAuthenticationMethodOauth2ConfidentialApplication SourceAuth0UpdateSchemasAuthenticationMethod = "oauth2_confidential_application"
)
func (e SourceAuth0UpdateSchemasAuthenticationMethod) ToPointer() *SourceAuth0UpdateSchemasAuthenticationMethod {
return &e
}
func (e *SourceAuth0UpdateSchemasAuthenticationMethod) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "oauth2_confidential_application":
*e = SourceAuth0UpdateSchemasAuthenticationMethod(v)
return nil
default:
return fmt.Errorf("invalid value for SourceAuth0UpdateSchemasAuthenticationMethod: %v", v)
}
}
type OAuth2ConfidentialApplication struct {
// The audience for the token, which is your API. You can find this in the Identifier field on your <a href="https://manage.auth0.com/#/apis">API's settings tab</a>
Audience string `json:"audience"`
authType SourceAuth0UpdateSchemasAuthenticationMethod `const:"oauth2_confidential_application" json:"auth_type"`
// Your application's Client ID. You can find this value on the <a href="https://manage.auth0.com/#/applications">application's settings tab</a> after you login the admin portal.
ClientID string `json:"client_id"`
// Your application's Client Secret. You can find this value on the <a href="https://manage.auth0.com/#/applications">application's settings tab</a> after you login the admin portal.
ClientSecret string `json:"client_secret"`
}
func (o OAuth2ConfidentialApplication) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(o, "", false)
}
func (o *OAuth2ConfidentialApplication) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &o, "", false, true); err != nil {
return err
}
return nil
}
func (o *OAuth2ConfidentialApplication) GetAudience() string {
if o == nil {
return ""
}
return o.Audience
}
func (o *OAuth2ConfidentialApplication) GetAuthType() SourceAuth0UpdateSchemasAuthenticationMethod {
return SourceAuth0UpdateSchemasAuthenticationMethodOauth2ConfidentialApplication
}
func (o *OAuth2ConfidentialApplication) GetClientID() string {
if o == nil {
return ""
}
return o.ClientID
}
func (o *OAuth2ConfidentialApplication) GetClientSecret() string {
if o == nil {
return ""
}
return o.ClientSecret
}
type SourceAuth0UpdateAuthenticationMethodType string
const (
SourceAuth0UpdateAuthenticationMethodTypeOAuth2ConfidentialApplication SourceAuth0UpdateAuthenticationMethodType = "OAuth2 Confidential Application"
SourceAuth0UpdateAuthenticationMethodTypeOAuth2AccessToken SourceAuth0UpdateAuthenticationMethodType = "OAuth2 Access Token"
)
type SourceAuth0UpdateAuthenticationMethod struct {
OAuth2ConfidentialApplication *OAuth2ConfidentialApplication
OAuth2AccessToken *OAuth2AccessToken
Type SourceAuth0UpdateAuthenticationMethodType
}
func CreateSourceAuth0UpdateAuthenticationMethodOAuth2ConfidentialApplication(oAuth2ConfidentialApplication OAuth2ConfidentialApplication) SourceAuth0UpdateAuthenticationMethod {
typ := SourceAuth0UpdateAuthenticationMethodTypeOAuth2ConfidentialApplication
return SourceAuth0UpdateAuthenticationMethod{
OAuth2ConfidentialApplication: &oAuth2ConfidentialApplication,
Type: typ,
}
}
func CreateSourceAuth0UpdateAuthenticationMethodOAuth2AccessToken(oAuth2AccessToken OAuth2AccessToken) SourceAuth0UpdateAuthenticationMethod {
typ := SourceAuth0UpdateAuthenticationMethodTypeOAuth2AccessToken
return SourceAuth0UpdateAuthenticationMethod{
OAuth2AccessToken: &oAuth2AccessToken,
Type: typ,
}
}
func (u *SourceAuth0UpdateAuthenticationMethod) UnmarshalJSON(data []byte) error {
oAuth2AccessToken := new(OAuth2AccessToken)
if err := utils.UnmarshalJSON(data, &oAuth2AccessToken, "", true, true); err == nil {
u.OAuth2AccessToken = oAuth2AccessToken
u.Type = SourceAuth0UpdateAuthenticationMethodTypeOAuth2AccessToken
return nil
}
oAuth2ConfidentialApplication := new(OAuth2ConfidentialApplication)
if err := utils.UnmarshalJSON(data, &oAuth2ConfidentialApplication, "", true, true); err == nil {
u.OAuth2ConfidentialApplication = oAuth2ConfidentialApplication
u.Type = SourceAuth0UpdateAuthenticationMethodTypeOAuth2ConfidentialApplication
return nil
}
return errors.New("could not unmarshal into supported union types")
}
func (u SourceAuth0UpdateAuthenticationMethod) MarshalJSON() ([]byte, error) {
if u.OAuth2ConfidentialApplication != nil {
return utils.MarshalJSON(u.OAuth2ConfidentialApplication, "", true)
}
if u.OAuth2AccessToken != nil {
return utils.MarshalJSON(u.OAuth2AccessToken, "", true)
}
return nil, errors.New("could not marshal union type: all fields are null")
}
type SourceAuth0Update struct {
// The Authentication API is served over HTTPS. All URLs referenced in the documentation have the following base `https://YOUR_DOMAIN`
BaseURL string `json:"base_url"`
Credentials SourceAuth0UpdateAuthenticationMethod `json:"credentials"`
// UTC date and time in the format 2017-01-25T00:00:00Z. Any data before this date will not be replicated.
StartDate *string `default:"2023-08-05T00:43:59.244Z" json:"start_date"`
}
func (s SourceAuth0Update) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(s, "", false)
}
func (s *SourceAuth0Update) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil {
return err
}
return nil
}
func (o *SourceAuth0Update) GetBaseURL() string {
if o == nil {
return ""
}
return o.BaseURL
}
func (o *SourceAuth0Update) GetCredentials() SourceAuth0UpdateAuthenticationMethod {
if o == nil {
return SourceAuth0UpdateAuthenticationMethod{}
}
return o.Credentials
}
func (o *SourceAuth0Update) GetStartDate() *string {
if o == nil {
return nil
}
return o.StartDate
}