| 764 | } |
| 765 | |
| 766 | func (def SourceDef) Serialize() (*pb.SourceVariant, error) { |
| 767 | serialized := &pb.SourceVariant{ |
| 768 | Name: def.Name, |
| 769 | Variant: def.Variant, |
| 770 | Description: def.Description, |
| 771 | Owner: def.Owner, |
| 772 | Status: &pb.ResourceStatus{Status: pb.ResourceStatus_CREATED}, |
| 773 | Provider: def.Provider, |
| 774 | Schedule: def.Schedule, |
| 775 | Tags: &pb.Tags{Tag: def.Tags}, |
| 776 | Properties: def.Properties.Serialize(), |
| 777 | } |
| 778 | var err error |
| 779 | switch x := def.Definition.(type) { |
| 780 | case TransformationSource: |
| 781 | serialized.Definition, err = def.Definition.(TransformationSource).Serialize() |
| 782 | case PrimaryDataSource: |
| 783 | serialized.Definition, err = def.Definition.(PrimaryDataSource).Serialize() |
| 784 | case nil: |
| 785 | return nil, fmt.Errorf("SourceDef Definition not set") |
| 786 | default: |
| 787 | return nil, fmt.Errorf("SourceDef Definition has unexpected type %T", x) |
| 788 | } |
| 789 | if err != nil { |
| 790 | return nil, err |
| 791 | } |
| 792 | return serialized, nil |
| 793 | } |
| 794 | |
| 795 | func (client *Client) CreateSourceVariant(ctx context.Context, def SourceDef) error { |
| 796 | serialized, err := def.Serialize() |