Skip to content

Latest commit

 

History

History
executable file
·
108 lines (88 loc) · 2.33 KB

README.md

File metadata and controls

executable file
·
108 lines (88 loc) · 2.33 KB

Source

Overview

Operations on sources

Available Operations

CreateSource

Create a new source

Example Usage

package main

import(
	"context"
	"log"
	"github.com/fabra-io/go-sdk"
	"github.com/fabra-io/go-sdk/pkg/models/shared"
)

func main() {
    s := fabra.New(
        fabra.WithSecurity(shared.Security{
            APIKeyAuth: "YOUR_API_KEY_HERE",
        }),
    )

    ctx := context.Background()
    res, err := s.Source.CreateSource(ctx, shared.SourceInput{
        BigqueryConfig: &shared.BigQueryConfig{
            Credentials: fabra.String("Paste JSON from GCP"),
            Location: "us-west1",
        },
        ConnectionType: shared.ConnectionTypeEnumBigquery,
        DisplayName: "Frontend Events",
        EndCustomerID: 123,
        MongodbConfig: &shared.MongoDbConfig{
            ConnectionOptions: fabra.String("retryWrites=true&w=majority"),
            Host: "examplecluster.abc123.mongodb.net",
            Password: "securePassword123",
            Username: "jane_doe",
        },
        RedshiftConfig: &shared.RedshiftConfig{
            DatabaseName: "your_database",
            Host: "examplecluster.12345.us-west-1.redshift.amazonaws.com",
            Password: "securePassword123",
            Port: "5432",
            Username: "jane_doe",
        },
        SnowflakeConfig: &shared.SnowflakeConfig{
            DatabaseName: "your_database",
            Host: "abc123.us-east4.gcp.snowflakecomputing.com",
            Password: "securePassword123",
            Role: "your_role",
            Username: "jane_doe",
            WarehouseName: "your_warehouse",
        },
    })
    if err != nil {
        log.Fatal(err)
    }

    if res.CreateSource200ApplicationJSONObject != nil {
        // handle response
    }
}

GetSources

Get all sources

Example Usage

package main

import(
	"context"
	"log"
	"github.com/fabra-io/go-sdk"
)

func main() {
    s := fabra.New(
        fabra.WithSecurity(shared.Security{
            APIKeyAuth: "YOUR_API_KEY_HERE",
        }),
    )

    ctx := context.Background()
    res, err := s.Source.GetSources(ctx)
    if err != nil {
        log.Fatal(err)
    }

    if res.GetSources200ApplicationJSONObject != nil {
        // handle response
    }
}