-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tables): add datatransfer resources
e24c0780dad182d70deef9d741f6c3bfc62919e6
- Loading branch information
Showing
16 changed files
with
161 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Table: yc_datatransfer_endpoints | ||
|
||
This table shows data for YC Data Transfer Endpoints. | ||
|
||
https://yandex.cloud/ru/docs/data-transfer/api-ref/grpc/endpoint_service#Endpoint1 | ||
|
||
The primary key for this table is **id**. | ||
|
||
## Columns | ||
|
||
| Name | Type | | ||
| ------------- | ------------- | | ||
|_cq_id|`uuid`| | ||
|_cq_parent_id|`uuid`| | ||
|cloud_id|`utf8`| | ||
|id (PK)|`utf8`| | ||
|folder_id|`utf8`| | ||
|name|`utf8`| | ||
|description|`utf8`| | ||
|labels|`json`| | ||
|settings|`json`| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Table: yc_datatransfer_transfers | ||
|
||
This table shows data for YC Data Transfer Transfers. | ||
|
||
https://yandex.cloud/ru/docs/data-transfer/api-ref/grpc/transfer_service#Transfer | ||
|
||
The primary key for this table is **id**. | ||
|
||
## Columns | ||
|
||
| Name | Type | | ||
| ------------- | ------------- | | ||
|_cq_id|`uuid`| | ||
|_cq_parent_id|`uuid`| | ||
|cloud_id|`utf8`| | ||
|id (PK)|`utf8`| | ||
|folder_id|`utf8`| | ||
|name|`utf8`| | ||
|description|`utf8`| | ||
|labels|`json`| | ||
|source|`json`| | ||
|target|`json`| | ||
|runtime|`json`| | ||
|status|`utf8`| | ||
|type|`utf8`| | ||
|warning|`utf8`| | ||
|transformation|`json`| | ||
|prestable|`bool`| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package datatransfer | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/cloudquery/plugin-sdk/v4/schema" | ||
"github.com/yandex-cloud/cq-source-yc/client" | ||
"github.com/yandex-cloud/go-genproto/yandex/cloud/datatransfer/v1" | ||
) | ||
|
||
func Endpoints() *schema.Table { | ||
return &schema.Table{ | ||
Name: "yc_datatransfer_endpoints", | ||
Description: `https://yandex.cloud/ru/docs/data-transfer/api-ref/grpc/endpoint_service#Endpoint1`, | ||
Multiplex: client.FolderMultiplex, | ||
Resolver: fetchEndpoints, | ||
Transform: client.TransformWithStruct(&datatransfer.Endpoint{}, client.PrimaryKeyIdTransformer), | ||
Columns: schema.ColumnList{ | ||
client.CloudIdColumn, | ||
}, | ||
} | ||
} | ||
|
||
func fetchEndpoints(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { | ||
c := meta.(*client.Client) | ||
|
||
it := c.SDK.DataTransfer().Endpoint().EndpointIterator(ctx, &datatransfer.ListEndpointsRequest{FolderId: c.FolderId}) | ||
for it.Next() { | ||
res <- it.Value() | ||
} | ||
|
||
return it.Error() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package datatransfer | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/cloudquery/plugin-sdk/v4/schema" | ||
"github.com/yandex-cloud/cq-source-yc/client" | ||
"github.com/yandex-cloud/go-genproto/yandex/cloud/datatransfer/v1" | ||
) | ||
|
||
func Transfers() *schema.Table { | ||
return &schema.Table{ | ||
Name: "yc_datatransfer_transfers", | ||
Description: `https://yandex.cloud/ru/docs/data-transfer/api-ref/grpc/transfer_service#Transfer`, | ||
Multiplex: client.FolderMultiplex, | ||
Resolver: fetchTransfers, | ||
Transform: client.TransformWithStruct(&datatransfer.Transfer{}, client.PrimaryKeyIdTransformer), | ||
Columns: schema.ColumnList{ | ||
client.CloudIdColumn, | ||
}, | ||
} | ||
} | ||
|
||
func fetchTransfers(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { | ||
c := meta.(*client.Client) | ||
|
||
it := c.SDK.DataTransfer().Transfer().TransferIterator(ctx, &datatransfer.ListTransfersRequest{FolderId: c.FolderId}) | ||
for it.Next() { | ||
res <- it.Value() | ||
} | ||
|
||
return it.Error() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters