Skip to content

Commit

Permalink
[feat]: [DBOPS-308]: Onboard JDBC connector (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek-CDC authored Jul 3, 2024
1 parent c6a8384 commit 5a3b700
Show file tree
Hide file tree
Showing 13 changed files with 173 additions and 0 deletions.
8 changes: 8 additions & 0 deletions harness/nextgen/docs/JdbcAuthCredentialsDto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# JdbcAuthCredentialsDto

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10 changes: 10 additions & 0 deletions harness/nextgen/docs/JdbcAuthenticationDto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# JdbcAuthenticationDto

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Type_** | **string** | | [default to null]
**Spec** | [***JdbcAuthCredentialsDto**](JDBCAuthCredentialsDTO.md) | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

12 changes: 12 additions & 0 deletions harness/nextgen/docs/JdbcConnector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# JdbcConnector

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Url** | **string** | | [default to null]
**Auth** | [***JdbcAuthenticationDto**](JDBCAuthenticationDTO.md) | | [optional] [default to null]
**DelegateSelectors** | **[]string** | | [optional] [default to null]
**ConnectorType** | **string** | | [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

11 changes: 11 additions & 0 deletions harness/nextgen/docs/JdbcUserNamePasswordDto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# JdbcUserNamePasswordDto

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Username** | **string** | | [optional] [default to null]
**UsernameRef** | **string** | | [optional] [default to null]
**PasswordRef** | **string** | | [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

3 changes: 3 additions & 0 deletions harness/nextgen/enum_connector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var ConnectorTypes = struct {
Vault ConnectorType
AzureKeyVault ConnectorType
DockerRegistry ConnectorType
JDBC ConnectorType
Local ConnectorType
AwsKms ConnectorType
GcpKms ConnectorType
Expand Down Expand Up @@ -57,6 +58,7 @@ var ConnectorTypes = struct {
Vault: "Vault",
AzureKeyVault: "AzureKeyVault",
DockerRegistry: "DockerRegistry",
JDBC: "JDBC",
Local: "Local",
AwsKms: "AwsKms",
GcpKms: "GcpKms",
Expand Down Expand Up @@ -104,6 +106,7 @@ var ConnectorTypesSlice = []string{
ConnectorTypes.Vault.String(),
ConnectorTypes.AzureKeyVault.String(),
ConnectorTypes.DockerRegistry.String(),
ConnectorTypes.JDBC.String(),
ConnectorTypes.Local.String(),
ConnectorTypes.AwsKms.String(),
ConnectorTypes.GcpKms.String(),
Expand Down
13 changes: 13 additions & 0 deletions harness/nextgen/enum_jdbc_auth_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package nextgen

type JDBCAuthType string

var JDBCAuthTypes = struct {
UsernamePassword JDBCAuthType
}{
UsernamePassword: "UsernamePassword",
}

func (e JDBCAuthType) String() string {
return string(e)
}
1 change: 1 addition & 0 deletions harness/nextgen/model_connector_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type ConnectorInfo struct {
CustomSecretManager *CustomSecretManager `json:"_"`
Datadog *DatadogConnectorDto `json:"-"`
DockerRegistry *DockerConnector `json:"-"`
JDBC *JdbcConnector `json:"-"`
Dynatrace *DynatraceConnectorDto `json:"-"`
Gcp *GcpConnector `json:"-"`
GcpCloudCost *GcpCloudCostConnectorDto `json:"-"`
Expand Down
4 changes: 4 additions & 0 deletions harness/nextgen/model_connector_info_serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ func (a *ConnectorInfo) UnmarshalJSON(data []byte) error {
err = json.Unmarshal(aux.Spec, &a.Datadog)
case ConnectorTypes.DockerRegistry:
err = json.Unmarshal(aux.Spec, &a.DockerRegistry)
case ConnectorTypes.JDBC:
err = json.Unmarshal(aux.Spec, &a.JDBC)
case ConnectorTypes.Dynatrace:
err = json.Unmarshal(aux.Spec, &a.Dynatrace)
case ConnectorTypes.Gcp:
Expand Down Expand Up @@ -137,6 +139,8 @@ func (a *ConnectorInfo) MarshalJSON() ([]byte, error) {
spec, err = json.Marshal(a.Datadog)
case ConnectorTypes.DockerRegistry:
spec, err = json.Marshal(a.DockerRegistry)
case ConnectorTypes.JDBC:
spec, err = json.Marshal(a.JDBC)
case ConnectorTypes.Dynatrace:
spec, err = json.Marshal(a.Dynatrace)
case ConnectorTypes.Gcp:
Expand Down
14 changes: 14 additions & 0 deletions harness/nextgen/model_jdbc_auth_credentials_dto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Harness NextGen Software Delivery Platform API Reference
*
* 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
*
* API version: 3.0
* Contact: contact@harness.io
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package nextgen

// This contains details of credentials for JDBC Authentication
type JdbcAuthCredentialsDto struct {
}
19 changes: 19 additions & 0 deletions harness/nextgen/model_jdbc_authentication_dto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Harness NextGen Software Delivery Platform API Reference
*
* 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
*
* API version: 3.0
* Contact: contact@harness.io
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package nextgen

import "encoding/json"

// This entity contains the details for JDBC Authentication
type JdbcAuthenticationDto struct {
Type_ JDBCAuthType `json:"type"`
UsernamePassword *JdbcUserNamePasswordDto `json:"-"`
Spec json.RawMessage `json:"spec,omitempty"`
}
42 changes: 42 additions & 0 deletions harness/nextgen/model_jdbc_authentication_serializer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package nextgen

import (
"encoding/json"
)

func (a *JdbcAuthenticationDto) UnmarshalJSON(data []byte) error {

type Alias JdbcAuthenticationDto

aux := &struct {
*Alias
}{
Alias: (*Alias)(a),
}

err := json.Unmarshal(data, &aux)
if err != nil {
return err
}

err = json.Unmarshal(aux.Spec, &a.UsernamePassword)

return err
}

func (a *JdbcAuthenticationDto) MarshalJSON() ([]byte, error) {
type Alias JdbcAuthenticationDto

var spec []byte
var err error

spec, err = json.Marshal(a.UsernamePassword)

if err != nil {
return nil, err
}

a.Spec = json.RawMessage(spec)

return json.Marshal((*Alias)(a))
}
19 changes: 19 additions & 0 deletions harness/nextgen/model_jdbc_connector.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Harness NextGen Software Delivery Platform API Reference
*
* 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
*
* API version: 3.0
* Contact: contact@harness.io
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package nextgen

// This contains details of the JDBC connector
type JdbcConnector struct {
Url string `json:"url"`
Auth *JdbcAuthenticationDto `json:"auth,omitempty"`
DelegateSelectors []string `json:"delegateSelectors,omitempty"`
ConnectorType string `json:"connectorType"`
ExecuteOnDelegate bool `json:"executeOnDelegate"`
}
17 changes: 17 additions & 0 deletions harness/nextgen/model_jdbc_user_name_password_dto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Harness NextGen Software Delivery Platform API Reference
*
* 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
*
* API version: 3.0
* Contact: contact@harness.io
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package nextgen

// This entity contains the details of the JDBC Username and Password
type JdbcUserNamePasswordDto struct {
Username string `json:"username,omitempty"`
UsernameRef string `json:"usernameRef,omitempty"`
PasswordRef string `json:"passwordRef"`
}

0 comments on commit 5a3b700

Please sign in to comment.