Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transform to get a field value from two different paths #55

Closed
LalitLab opened this issue Mar 8, 2021 · 0 comments
Closed

Add transform to get a field value from two different paths #55

LalitLab opened this issue Mar 8, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@LalitLab
Copy link

LalitLab commented Mar 8, 2021

There are few AWS resources in which the output of GET and LIST API calls differ (The type of struct differs for them).

Can we have a transform through which we can mention 2 paths to get the value ("Path1", "Path2")
If the value is not found in Path1 the transform should try to retrieve it from Path2

For example in aws_dynamodb_backup table

{
	Name:        "backup_status",
	Description: "Current status of the backup. Backup can be in one of the following states: CREATING, ACTIVE, DELETED",
	Type:        proto.ColumnType_STRING,
	Transform:   transform.GetValue("BackupStatus", "BackupDetails.BackupStatus,"),
}

LIST CALL STRUCT BackupSummary

// Contains details for the backup.
type BackupSummary struct {
	_ struct{} `type:"structure"`
	BackupArn *string `min:"37" type:"string"`
	BackupCreationDateTime *time.Time `type:"timestamp"`
	BackupExpiryDateTime *time.Time `type:"timestamp"`
	BackupName *string `min:"3" type:"string"`
	BackupSizeBytes *int64 `type:"long"`
	BackupStatus *string `type:"string" enum:"BackupStatus"`
	BackupType *string `type:"string" enum:"BackupType"`
	TableArn *string `type:"string"`
	TableId *string `type:"string"`
	TableName *string `min:"3" type:"string"`
}

GET CALL STRUCT BackupDescription

type BackupDescription struct {
	_ struct{} `type:"structure"`

	// Contains the details of the backup created for the table.
	BackupDetails *BackupDetails `type:"structure"`

	// Contains the details of the table when the backup was created.
	SourceTableDetails *SourceTableDetails `type:"structure"`

	// Contains the details of the features enabled on the table when the backup
	// was created. For example, LSIs, GSIs, streams, TTL.
	SourceTableFeatureDetails *SourceTableFeatureDetails `type:"structure"`
}

// Contains the details of the backup created for the table.
type BackupDetails struct {
	_ struct{} `type:"structure"`
	BackupArn *string `min:"37" type:"string" required:"true"`
	BackupCreationDateTime *time.Time `type:"timestamp" required:"true"`
	BackupExpiryDateTime *time.Time `type:"timestamp"`
	BackupName *string `min:"3" type:"string" required:"true"`
	BackupSizeBytes *int64 `type:"long"`
	BackupStatus *string `type:"string" required:"true" enum:"BackupStatus"`
	BackupType *string `type:"string" required:"true" enum:"BackupType"`
}

// Contains the details of the table when the backup was created.
type SourceTableDetails struct {
	_ struct{} `type:"structure"`
	BillingMode *string `type:"string" enum:"BillingMode"`
	ItemCount *int64 `type:"long"`
	KeySchema []*KeySchemaElement `min:"1" type:"list" required:"true"`
	ProvisionedThroughput *ProvisionedThroughput `type:"structure" required:"true"`
	TableArn *string `type:"string"`
	TableCreationDateTime *time.Time `type:"timestamp" required:"true"`
	TableId *string `type:"string" required:"true"`
	TableName *string `min:"3" type:"string" required:"true"`
	TableSizeBytes *int64 `type:"long"`
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants