Skip to content

Commit d3172de

Browse files
authored
[feat]: [DBOPS-845]: Support for ServiceAccountToken JDBC connector (#630)
1 parent 432f8fd commit d3172de

File tree

6 files changed

+48
-7
lines changed

6 files changed

+48
-7
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# JdbcServiceAccountDto
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**ServiceAccountTokenRef** | **string** | | [default to null]
7+
8+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
9+

harness/nextgen/enum_jdbc_auth_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ type JDBCAuthType string
44

55
var JDBCAuthTypes = struct {
66
UsernamePassword JDBCAuthType
7+
ServiceAccount JDBCAuthType
78
}{
89
UsernamePassword: "UsernamePassword",
10+
ServiceAccount: "ServiceAccount",
911
}
1012

1113
func (e JDBCAuthType) String() string {

harness/nextgen/model_jdbc_authentication_dto.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ import "encoding/json"
1515
type JdbcAuthenticationDto struct {
1616
Type_ JDBCAuthType `json:"type"`
1717
UsernamePassword *JdbcUserNamePasswordDto `json:"-"`
18+
ServiceAccount *JdbcServiceAccountDto `json:"-"`
1819
Spec json.RawMessage `json:"spec,omitempty"`
1920
}

harness/nextgen/model_jdbc_authentication_serializer.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package nextgen
22

33
import (
44
"encoding/json"
5+
"fmt"
56
)
67

78
func (a *JdbcAuthenticationDto) UnmarshalJSON(data []byte) error {
@@ -19,7 +20,14 @@ func (a *JdbcAuthenticationDto) UnmarshalJSON(data []byte) error {
1920
return err
2021
}
2122

22-
err = json.Unmarshal(aux.Spec, &a.UsernamePassword)
23+
switch a.Type_ {
24+
case JDBCAuthTypes.UsernamePassword:
25+
err = json.Unmarshal(aux.Spec, &a.UsernamePassword)
26+
case JDBCAuthTypes.ServiceAccount:
27+
err = json.Unmarshal(aux.Spec, &a.ServiceAccount)
28+
default:
29+
panic(fmt.Sprintf("unknown jdbc auth method type %s", a.Type_))
30+
}
2331

2432
return err
2533
}
@@ -30,7 +38,14 @@ func (a *JdbcAuthenticationDto) MarshalJSON() ([]byte, error) {
3038
var spec []byte
3139
var err error
3240

33-
spec, err = json.Marshal(a.UsernamePassword)
41+
switch a.Type_ {
42+
case JDBCAuthTypes.UsernamePassword:
43+
spec, err = json.Marshal(a.UsernamePassword)
44+
case JDBCAuthTypes.ServiceAccount:
45+
spec, err = json.Marshal(a.ServiceAccount)
46+
default:
47+
panic(fmt.Sprintf("unknown jdbc auth method type %s", a.Type_))
48+
}
3449

3550
if err != nil {
3651
return nil, err

harness/nextgen/model_jdbc_connector.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ package nextgen
1111

1212
// This contains details of the JDBC connector
1313
type JdbcConnector struct {
14-
Url string `json:"url"`
15-
Auth *JdbcAuthenticationDto `json:"auth,omitempty"`
16-
DelegateSelectors []string `json:"delegateSelectors,omitempty"`
17-
ConnectorType string `json:"connectorType"`
18-
ExecuteOnDelegate bool `json:"executeOnDelegate"`
14+
Url string `json:"url"`
15+
Auth *JdbcAuthenticationDto `json:"auth,omitempty"`
16+
DelegateSelectors []string `json:"delegateSelectors,omitempty"`
17+
ExecuteOnDelegate bool `json:"executeOnDelegate"`
18+
IgnoreTestConnection bool `json:"ignoreTestConnection,omitempty"`
1919
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Harness NextGen Software Delivery Platform API Reference
3+
*
4+
* This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of the breaking change with respect to the generated code stub
5+
*
6+
* API version: 3.0
7+
* Contact: contact@harness.io
8+
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
9+
*/
10+
package nextgen
11+
12+
type JdbcServiceAccountDto struct {
13+
ServiceAccountTokenRef string `json:"serviceAccountTokenRef"`
14+
}

0 commit comments

Comments
 (0)