parent
7ba5f66512
commit
f8f1ee34ea
|
@ -11,34 +11,34 @@ import (
|
||||||
|
|
||||||
// NewIngestParams is a prams type
|
// NewIngestParams is a prams type
|
||||||
type NewIngestParams struct {
|
type NewIngestParams struct {
|
||||||
accountID string
|
AccountID string
|
||||||
backendID string
|
BackendID string
|
||||||
objectType string
|
ObjectType string
|
||||||
objList []*devops_models.Ingest
|
ObjList []*devops_models.Ingest
|
||||||
principal *User
|
Principal *User
|
||||||
ref string
|
Ref string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewIngest is an ingest helper function
|
// NewIngest is an ingest helper function
|
||||||
func NewIngest(params *NewIngestParams) (string, error) {
|
func NewIngest(params *NewIngestParams) (string, error) {
|
||||||
sugar.Debug("ops.newIngest: 📥")
|
sugar.Debug("ops.newIngest: 📥")
|
||||||
if params.accountID == "" || params.principal.TenantID == "" {
|
if params.AccountID == "" || params.Principal.TenantID == "" {
|
||||||
return "", fmt.Errorf("ops.newIngest: 💣 ⛔ params.AccountID or params.TaxnexusAccount are blank")
|
return "", fmt.Errorf("ops.newIngest: 💣 ⛔ params.AccountID or params.TaxnexusAccount are blank")
|
||||||
}
|
}
|
||||||
dt := time.Now().Format(dateTimeFormat)
|
dt := time.Now().Format(dateTimeFormat)
|
||||||
theIngest := &devops_models.Ingest{
|
theIngest := &devops_models.Ingest{
|
||||||
AccountID: ¶ms.accountID,
|
AccountID: ¶ms.AccountID,
|
||||||
BackendID: params.backendID,
|
BackendID: params.BackendID,
|
||||||
EndDate: dt,
|
EndDate: dt,
|
||||||
ID: uuid.New().String(),
|
ID: uuid.New().String(),
|
||||||
IngestDate: dt,
|
IngestDate: dt,
|
||||||
IngestType: "fabric",
|
IngestType: "fabric",
|
||||||
ObjectType: ¶ms.objectType,
|
ObjectType: ¶ms.ObjectType,
|
||||||
Ref: params.ref,
|
Ref: params.Ref,
|
||||||
StartDate: dt,
|
StartDate: dt,
|
||||||
Status: "new",
|
Status: "new",
|
||||||
}
|
}
|
||||||
params.objList = []*devops_models.Ingest{theIngest}
|
params.ObjList = []*devops_models.Ingest{theIngest}
|
||||||
_, err := PostIngests(params)
|
_, err := PostIngests(params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -49,12 +49,12 @@ func NewIngest(params *NewIngestParams) (string, error) {
|
||||||
|
|
||||||
// PostIngests is an ingest helper function
|
// PostIngests is an ingest helper function
|
||||||
func PostIngests(params *NewIngestParams) ([]*devops_models.Ingest, error) {
|
func PostIngests(params *NewIngestParams) ([]*devops_models.Ingest, error) {
|
||||||
sugar.Debugf("ops.postIngests: 📥 len=%d", len(params.objList))
|
sugar.Debugf("ops.postIngests: 📥 len=%d", len(params.ObjList))
|
||||||
devopsParams := ingest.NewPostIngestsParams()
|
devopsParams := ingest.NewPostIngestsParams()
|
||||||
devopsParams.IngestRequest = &devops_models.IngestRequest{
|
devopsParams.IngestRequest = &devops_models.IngestRequest{
|
||||||
Data: params.objList,
|
Data: params.ObjList,
|
||||||
}
|
}
|
||||||
response, err := devopsClient.Ingest.PostIngests(devopsParams, params.principal.Auth)
|
response, err := devopsClient.Ingest.PostIngests(devopsParams, params.Principal.Auth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
sugar.Errorf("ops.postIngests: 💣 ⛔ post to devops error %w", err)
|
sugar.Errorf("ops.postIngests: 💣 ⛔ post to devops error %w", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue