Skip to content

Commit

Permalink
Support group ssh key and service account (#96)
Browse files Browse the repository at this point in the history
* refactor group endpoints

* ssh key endpoint support

* service-account endpoint support

* e2e tests for ssh key and service account

* changelog & readme

* fix test

* fix test
  • Loading branch information
beevital authored Nov 17, 2023
1 parent 57cb9f5 commit bce7895
Show file tree
Hide file tree
Showing 42 changed files with 1,079 additions and 1,101 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/fivetran/go-fivetran/compare/v0.7.13...HEAD)

## [0.7.15](https://github.com/fivetran/go-fivetran/compare/v0.7.14...v0.7.15)

## Added
- Support for [Retrieve Group Service Account](https://fivetran.com/docs/rest-api/groups#retrievegroupserviceaccount) endpoint.
- Support for [Retrieve Group Public SSH Key](https://fivetran.com/docs/rest-api/groups#retrievegrouppublicsshkey) endpoint.

## [0.7.14](https://github.com/fivetran/go-fivetran/compare/v0.7.13...v0.7.14)

## Added

- Support for missing `auth` fields for connectors.
- OneLake Data-Lake support.


## [0.7.13](https://github.com/fivetran/go-fivetran/compare/v0.7.12...v0.7.13)

## Added
Expand Down
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ REST API Endpoint | REST API Version | SDK Service
[Add a user to a group](https://fivetran.com/docs/rest-api/groups#addausertoagroup) | v1 | [GroupAddUserService](https://pkg.go.dev/github.com/fivetran/go-fivetran#GroupAddUserService)
[Remove a user from a group](https://fivetran.com/docs/rest-api/groups#removeauserfromagroup) | v1 | [GroupRemoveUserService](https://pkg.go.dev/github.com/fivetran/go-fivetran#GroupRemoveUserService)
[Delete a group](https://fivetran.com/docs/rest-api/groups#deleteagroup) | v1 | [GroupDeleteService](https://pkg.go.dev/github.com/fivetran/go-fivetran#GroupDeleteService)
[Retrieve Group Public SSH Key](https://fivetran.com/docs/rest-api/groups#retrievegrouppublicsshkey) | v1 | [GroupSshKeyService](https://pkg.go.dev/github.com/fivetran/go-fivetran/groups#GroupSshKeyService)
[Retrieve Group Service Account](https://fivetran.com/docs/rest-api/groups#retrievegroupserviceaccount) | v1 | [GroupServiceAccountService](https://pkg.go.dev/github.com/fivetran/go-fivetran/groups#GroupServiceAccountService)

### [Destination Management API](https://fivetran.com/docs/rest-api/destinations)

Expand Down Expand Up @@ -147,10 +149,22 @@ REST API Endpoint | REST API Version | SDK Service
### [Certificate Management API](https://fivetran.com/docs/rest-api/certificates)
REST API Endpoint | REST API Version | SDK Service
--- | --- | ---
[Approve a connector certificate](https://fivetran.com/docs/rest-api/certificates#approveaconnectorcertificate) | v1 | [CertificateConnectorCertificateApproveService](https://pkg.go.dev/github.com/fivetran/go-fivetran#CertificateConnectorCertificateApproveService)
[Approve a connector fingerprint](https://fivetran.com/docs/rest-api/certificates#approveaconnectorfingerprint) | v1 | [CertificateConnectorFingerprintApproveService](https://pkg.go.dev/github.com/fivetran/go-fivetran#CertificateConnectorFingerprintApproveService)
[Approve a destination certificate](https://fivetran.com/docs/rest-api/certificates#approveadestinationcertificate) | v1 | [CertificateDestinationCertificateApproveService](https://pkg.go.dev/github.com/fivetran/go-fivetran#CertificateDestinationCertificateApproveService)
[Approve a destination fingerprint](https://fivetran.com/docs/rest-api/certificates#approveadestinationfingerprint) | v1 | [CertificateDestinationFingerprintApproveService](https://pkg.go.dev/github.com/fivetran/go-fivetran#CertificateDestinationFingerprintApproveService)
[Approve a connector certificate](https://fivetran.com/docs/rest-api/certificates#approveaconnectorcertificate) | v1 | [ConnectorCertificateApproveService](https://pkg.go.dev/github.com/fivetran/go-fivetran/certificates#ConnectorCertificateApproveService)
[Approve a connector fingerprint](https://fivetran.com/docs/rest-api/certificates#approveaconnectorfingerprint) | v1 | [ConnectorFingerprintApproveService](https://pkg.go.dev/github.com/fivetran/go-fivetran/fingerprints#ConnectorFingerprintApproveService)
[List all approved certificates for connector](https://fivetran.com/docs/rest-api/certificates#listallapprovedcertificatesforconnector) | v1 | [ConnectorCertificatesListService](https://pkg.go.dev/github.com/fivetran/go-fivetran/certificates#ConnectorCertificatesListService)
[List all approved fingerprints for connector](https://fivetran.com/docs/rest-api/certificates#listallapprovedfingerprintsforconnector) | v1 | [ConnectorFingerprintsListService](https://pkg.go.dev/github.com/fivetran/go-fivetran/fingerprints#ConnectorFingerprintsListService)
[Retrieve a connector certificate details](https://fivetran.com/docs/rest-api/certificates#retrieveaconnectorcertificatedetails) | v1 | [ConnectorCertificateDetailsService](https://pkg.go.dev/github.com/fivetran/go-fivetran/certificates#ConnectorCertificateDetailsService)
[Retrieve a connector fingerprint details](https://fivetran.com/docs/rest-api/certificates#retrieveaconnectorfingerprintdetails) | v1 | [ConnectorFingerprintDetailsService](https://pkg.go.dev/github.com/fivetran/go-fivetran/fingerprints#ConnectorFingerprintDetailsService)
[Revoke a connector certificate](https://fivetran.com/docs/rest-api/certificates#revokeaconnectorcertificate) | v1 | [ConnectorCertificateRevokeService](https://pkg.go.dev/github.com/fivetran/go-fivetran/certificates#ConnectorCertificateRevokeService)
[Revoke a connector fingerprint](https://fivetran.com/docs/rest-api/certificates#revokeaconnectorfingerprint) | v1 | [ConnectorFingerprintRevokeService](https://pkg.go.dev/github.com/fivetran/go-fivetran/fingerprints#ConnectorFingerprintRevokeService)
[Approve a destination certificate](https://fivetran.com/docs/rest-api/certificates#approveadestinationcertificate) | v1 | [DestinationCertificateApproveService](https://pkg.go.dev/github.com/fivetran/go-fivetran/certificates#DestinationCertificateApproveService)
[Approve a destination fingerprint](https://fivetran.com/docs/rest-api/certificates#approveadestinationfingerprint) | v1 | [DestinationFingerprintApproveService](https://pkg.go.dev/github.com/fivetran/go-fivetran/fingerprints#DestinationFingerprintApproveService)
[List all approved certificates for destination](https://fivetran.com/docs/rest-api/certificates#listallapprovedcertificatesfordestination) | v1 | [DestinationCertificatesListService](https://pkg.go.dev/github.com/fivetran/go-fivetran/certificates#DestinationCertificatesListService)
[List all approved fingerprints for destination](https://fivetran.com/docs/rest-api/certificates#listallapprovedfingerprintsfordestination) | v1 | [DestinationFingerprintsListService](https://pkg.go.dev/github.com/fivetran/go-fivetran/fingerprints#DestinationFingerprintsListService)
[Retrieve a destination certificate details](https://fivetran.com/docs/rest-api/certificates#retrieveadestinationcertificatedetails) | v1 | [DestinationCertificateDetailsService](https://pkg.go.dev/github.com/fivetran/go-fivetran/certificates#DestinationCertificateDetailsService)
[Retrieve a destination fingerprint details](https://fivetran.com/docs/rest-api/certificates#retrieveadestinationfingerprintdetails) | v1 | [DestinationFingerprintDetailsService](https://pkg.go.dev/github.com/fivetran/go-fivetran/fingerprints#DestinationFingerprintDetailsService)
[Revoke a destination certificate](https://fivetran.com/docs/rest-api/certificates#revokeadestinationcertificate) | v1 | [DestinationCertificateRevokeService](https://pkg.go.dev/github.com/fivetran/go-fivetran/certificates#DestinationCertificateRevokeService)
[Revoke a destination fingerprint](https://fivetran.com/docs/rest-api/certificates#revokeadestinationfingerprint) | v1 | [DestinationFingerprintRevokeService](https://pkg.go.dev/github.com/fivetran/go-fivetran/fingerprints#DestinationFingerprintRevokeService)

### [Log Service Management](https://fivetran.com/docs/rest-api/log-service-management)

Expand Down
149 changes: 149 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import (
"fmt"
"net/http"

"github.com/fivetran/go-fivetran/certificates"
"github.com/fivetran/go-fivetran/fingerprints"
"github.com/fivetran/go-fivetran/groups"
httputils "github.com/fivetran/go-fivetran/http_utils"
)

Expand Down Expand Up @@ -84,3 +87,149 @@ func (c *Client) commonHeaders() map[string]string {
"User-Agent": userAgent,
}
}

func (c *Client) NewConnectorSync() *ConnectorSyncService {
return &ConnectorSyncService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewCertificateConnectorCertificateApprove() *certificates.ConnectorCertificateApproveService {
return &certificates.ConnectorCertificateApproveService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewCertificateDestinationCertificateApprove() *certificates.DestinationCertificateApproveService {
return &certificates.DestinationCertificateApproveService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewCertificateConnectorFingerprintApprove() *fingerprints.ConnectorFingerprintApproveService {
return &fingerprints.ConnectorFingerprintApproveService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewCertificateDestinationFingerprintApprove() *fingerprints.DestinationFingerprintApproveService {
return &fingerprints.DestinationFingerprintApproveService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorCertificateRevoke() *certificates.ConnectorCertificateRevokeService {
return &certificates.ConnectorCertificateRevokeService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationCertificateRevoke() *certificates.DestinationCertificateRevokeService {
return &certificates.DestinationCertificateRevokeService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorCertificatesList() *certificates.ConnectorCertificatesListService {
return &certificates.ConnectorCertificatesListService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationCertificatesList() *certificates.DestinationCertificatesListService {
return &certificates.DestinationCertificatesListService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorCertificateDetails() *certificates.ConnectorCertificateDetailsService {
return &certificates.ConnectorCertificateDetailsService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationCertificateDetails() *certificates.DestinationCertificateDetailsService {
return &certificates.DestinationCertificateDetailsService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorFingerprintRevoke() *fingerprints.ConnectorFingerprintRevokeService {
return &fingerprints.ConnectorFingerprintRevokeService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationFingerprintRevoke() *fingerprints.DestinationFingerprintRevokeService {
return &fingerprints.DestinationFingerprintRevokeService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorFingerprintsList() *fingerprints.ConnectorFingerprintsListService {
return &fingerprints.ConnectorFingerprintsListService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationFingerprintsList() *fingerprints.DestinationFingerprintsListService {
return &fingerprints.DestinationFingerprintsListService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorFingerprintDetails() *fingerprints.ConnectorFingerprintDetailsService {
return &fingerprints.ConnectorFingerprintDetailsService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationFingerprintDetails() *fingerprints.DestinationFingerprintDetailsService {
return &fingerprints.DestinationFingerprintDetailsService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewGroupCreate() *groups.GroupCreateService {
return &groups.GroupCreateService{HttpService: c.NewHttpService()}
}

func (c *Client) NewGroupDetails() *groups.GroupDetailsService {
return &groups.GroupDetailsService{HttpService: c.NewHttpService()}
}

func (c *Client) NewGroupAddUser() *groups.GroupAddUserService {
return &groups.GroupAddUserService{HttpService: c.NewHttpService()}
}

func (c *Client) NewGroupRemoveUser() *groups.GroupRemoveUserService {
return &groups.GroupRemoveUserService{HttpService: c.NewHttpService()}
}

func (c *Client) NewGroupDelete() *groups.GroupDeleteService {
return &groups.GroupDeleteService{HttpService: c.NewHttpService()}
}

func (c *Client) NewGroupModify() *groups.GroupModifyService {
return &groups.GroupModifyService{HttpService: c.NewHttpService()}
}

func (c *Client) NewGroupListConnectors() *groups.GroupListConnectorsService {
return &groups.GroupListConnectorsService{HttpService: c.NewHttpService()}
}

func (c *Client) NewGroupListUsers() *groups.GroupListUsersService {
return &groups.GroupListUsersService{HttpService: c.NewHttpService()}
}

func (c *Client) NewGroupsList() *groups.GroupsListService {
return &groups.GroupsListService{HttpService: c.NewHttpService()}
}

func (c *Client) NewGroupSshPublicKey() *groups.GroupSshKeyService {
return &groups.GroupSshKeyService{HttpService: c.NewHttpService()}
}

func (c *Client) NewGroupServiceAccount() *groups.GroupServiceAccountService {
return &groups.GroupServiceAccountService{HttpService: c.NewHttpService()}
}
104 changes: 0 additions & 104 deletions fivetran.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package fivetran

import (
"github.com/fivetran/go-fivetran/certificates"
"github.com/fivetran/go-fivetran/connectors"
"github.com/fivetran/go-fivetran/dbt"
"github.com/fivetran/go-fivetran/destinations"
externallogging "github.com/fivetran/go-fivetran/external_logging"
"github.com/fivetran/go-fivetran/fingerprints"
httputils "github.com/fivetran/go-fivetran/http_utils"
)

Expand Down Expand Up @@ -70,108 +68,6 @@ func NewExternalLoggingConfig() *externallogging.ExternalLoggingConfig {
return &externallogging.ExternalLoggingConfig{}
}

func (c *Client) NewConnectorSync() *ConnectorSyncService {
return &ConnectorSyncService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewCertificateConnectorCertificateApprove() *certificates.ConnectorCertificateApproveService {
return &certificates.ConnectorCertificateApproveService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewCertificateDestinationCertificateApprove() *certificates.DestinationCertificateApproveService {
return &certificates.DestinationCertificateApproveService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewCertificateConnectorFingerprintApprove() *fingerprints.ConnectorFingerprintApproveService {
return &fingerprints.ConnectorFingerprintApproveService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewCertificateDestinationFingerprintApprove() *fingerprints.DestinationFingerprintApproveService {
return &fingerprints.DestinationFingerprintApproveService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorCertificateRevoke() *certificates.ConnectorCertificateRevokeService {
return &certificates.ConnectorCertificateRevokeService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationCertificateRevoke() *certificates.DestinationCertificateRevokeService {
return &certificates.DestinationCertificateRevokeService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorCertificatesList() *certificates.ConnectorCertificatesListService {
return &certificates.ConnectorCertificatesListService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationCertificatesList() *certificates.DestinationCertificatesListService {
return &certificates.DestinationCertificatesListService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorCertificateDetails() *certificates.ConnectorCertificateDetailsService {
return &certificates.ConnectorCertificateDetailsService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationCertificateDetails() *certificates.DestinationCertificateDetailsService {
return &certificates.DestinationCertificateDetailsService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorFingerprintRevoke() *fingerprints.ConnectorFingerprintRevokeService {
return &fingerprints.ConnectorFingerprintRevokeService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationFingerprintRevoke() *fingerprints.DestinationFingerprintRevokeService {
return &fingerprints.DestinationFingerprintRevokeService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorFingerprintsList() *fingerprints.ConnectorFingerprintsListService {
return &fingerprints.ConnectorFingerprintsListService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationFingerprintsList() *fingerprints.DestinationFingerprintsListService {
return &fingerprints.DestinationFingerprintsListService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewConnectorFingerprintDetails() *fingerprints.ConnectorFingerprintDetailsService {
return &fingerprints.ConnectorFingerprintDetailsService{
HttpService: c.NewHttpService(),
}
}

func (c *Client) NewDestinationFingerprintDetails() *fingerprints.DestinationFingerprintDetailsService {
return &fingerprints.DestinationFingerprintDetailsService{
HttpService: c.NewHttpService(),
}
}

func Debug(value bool) {
httputils.Debug(value)
}
Expand Down
Loading

0 comments on commit bce7895

Please sign in to comment.