diff --git a/cmd/meroxa/root/apps/describe_test.go b/cmd/meroxa/root/apps/describe_test.go index fab742ba2..22892dd38 100644 --- a/cmd/meroxa/root/apps/describe_test.go +++ b/cmd/meroxa/root/apps/describe_test.go @@ -89,19 +89,31 @@ func TestDescribeApplicationExecution(t *testing.T) { Destination: null.StringFrom("destination"), }, }, + { + EntityIdentifier: meroxa.EntityIdentifier{ + Name: null.StringFrom("res3"), + }, + Collection: meroxa.ResourceCollection{ + Name: null.StringFrom("res3"), + Destination: null.StringFrom("destination"), + }, + }, } resources := []*meroxa.Resource{ {Name: "res1", UUID: "abc-def", Type: meroxa.ResourceTypePostgres}, {Name: "res2", UUID: "abc-def", Type: meroxa.ResourceTypeBigquery}, + {Name: "res3", UUID: "abc-def", Type: meroxa.ResourceTypeConfluentCloud}, } a.Connectors = []meroxa.EntityIdentifier{ {Name: null.StringFrom("conn1")}, {Name: null.StringFrom("conn2")}, + {Name: null.StringFrom("conn3")}, } connectors := []*meroxa.Connector{ {Name: "conn1", ResourceName: "res1", Type: meroxa.ConnectorTypeSource, State: meroxa.ConnectorStateRunning}, {Name: "conn2", ResourceName: "res2", Type: meroxa.ConnectorTypeDestination, State: meroxa.ConnectorStateRunning}, + {Name: "conn3", ResourceName: "res3", Type: meroxa.ConnectorTypeDestination, State: meroxa.ConnectorStateRunning}, } functions := []*meroxa.Function{ @@ -114,8 +126,10 @@ func TestDescribeApplicationExecution(t *testing.T) { client.EXPECT().GetApplication(ctx, a.Name).Return(&a, nil) client.EXPECT().GetResourceByNameOrID(ctx, "res1").Return(resources[0], nil) client.EXPECT().GetResourceByNameOrID(ctx, "res2").Return(resources[1], nil) + client.EXPECT().GetResourceByNameOrID(ctx, "res3").Return(resources[2], nil) client.EXPECT().GetConnectorByNameOrID(ctx, "conn1").Return(connectors[0], nil) client.EXPECT().GetConnectorByNameOrID(ctx, "conn2").Return(connectors[1], nil) + client.EXPECT().GetConnectorByNameOrID(ctx, "conn3").Return(connectors[2], nil) client.EXPECT().GetFunction(ctx, "fun1").Return(functions[0], nil) dc := &Describe{ diff --git a/cmd/meroxa/root/resources/create.go b/cmd/meroxa/root/resources/create.go index 93970d635..a64e7fc7b 100644 --- a/cmd/meroxa/root/resources/create.go +++ b/cmd/meroxa/root/resources/create.go @@ -112,9 +112,13 @@ $ meroxa resource create snowflake \ --username meroxa_user \ --password $SNOWFLAKE_PRIVATE_KEY -$ meroxa resource create confluentcloud \ - --type confluentcloud \ - -url "kafka+sasl+ssl://$CONFLUENT_USER:$CONFLUENT_PASSWORD@$CONFLUENT_HOST:$CONFLUENT_PORT/?sasl_mechanism=plain"`, +$ meroxa resource create sourcedb \ + --type kafka \ + --url kafka+sasl+ssl://$KAFKA_USER:$KAFKA_PASS@<$BOOTSTRAP_SERVER>?sasl_mechanism=plain + +$ meroxa resource create sourcedb \ + --type confluentcloud \ + --url kafka+sasl+ssl://$API_KEY:$API_SECRET@<$BOOTSTRAP_SERVER>?sasl_mechanism=plain`, } } diff --git a/go.mod b/go.mod index c33a64e1b..a8821b8c3 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/manifoldco/promptui v0.8.0 github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-runewidth v0.0.10 // indirect - github.com/meroxa/meroxa-go v0.0.0-20220810182408-f05df5bf6f6e + github.com/meroxa/meroxa-go v0.0.0-20220912230249-20686297f457 github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 github.com/rivo/uniseg v0.2.0 // indirect diff --git a/go.sum b/go.sum index 1c0297a39..2979e520d 100644 --- a/go.sum +++ b/go.sum @@ -515,8 +515,8 @@ github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lL github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= -github.com/meroxa/meroxa-go v0.0.0-20220810182408-f05df5bf6f6e h1:342YniWwgpSnG3afpXwI+yer2peDX6MSw3yjl3O6dSs= -github.com/meroxa/meroxa-go v0.0.0-20220810182408-f05df5bf6f6e/go.mod h1:qczCsZeXwn2R+JeEVjPkgtIMGROQ1Si8ox+OC2nfOYg= +github.com/meroxa/meroxa-go v0.0.0-20220912230249-20686297f457 h1:+ZwU/WVSFwfoZish4Siiv1/6oObE5zffKl1cocU19/I= +github.com/meroxa/meroxa-go v0.0.0-20220912230249-20686297f457/go.mod h1:qczCsZeXwn2R+JeEVjPkgtIMGROQ1Si8ox+OC2nfOYg= github.com/meroxa/turbine-go v0.0.0-20220808165302-ff929376e177 h1:IlAZCm/UlMnC+5V+OAYlKXa16yGzlLxO1+6EN6PcwxM= github.com/meroxa/turbine-go v0.0.0-20220808165302-ff929376e177/go.mod h1:x6qIhTUBt8961KrUUioSTd1sCsRKMBvZ3LSS2BDUhJo= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= diff --git a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/api_errors.go b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/api_errors.go index eb6ce5e34..c18473e13 100644 --- a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/api_errors.go +++ b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/api_errors.go @@ -2,7 +2,6 @@ package meroxa import ( "encoding/json" - "errors" "fmt" "net/http" "strings" @@ -65,7 +64,7 @@ func parseErrorFromBody(resp *http.Response) (error, error) { if err != nil { // In cases we didn't receive a proper JSON response if _, ok := err.(*json.SyntaxError); ok { - return nil, errors.New(fmt.Sprintf("%s %s", resp.Proto, resp.Status)) + return nil, fmt.Errorf("%s %s", resp.Proto, resp.Status) } return nil, err diff --git a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/auth.go b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/auth.go index e69780bd1..292d03bef 100644 --- a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/auth.go +++ b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/auth.go @@ -162,6 +162,8 @@ func (ts *tokenSource) retrieveToken(client *http.Client, conf *oauth2.Config, r TokenType: tokenRes.TokenType, } raw := make(map[string]interface{}) + + //nolint:errcheck json.Unmarshal(body, &raw) // no error checks for optional fields token = token.WithExtra(raw) diff --git a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/environment.go b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/environment.go index b84315d34..6a8c4951d 100644 --- a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/environment.go +++ b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/environment.go @@ -216,8 +216,7 @@ func (c *client) DeleteEnvironment(ctx context.Context, nameOrUUID string) (*Env var e *Environment err = json.NewDecoder(resp.Body).Decode(&e) - - return e, nil + return e, err } func (c *client) UpdateEnvironment(ctx context.Context, nameOrUUID string, input *UpdateEnvironmentInput) (*Environment, error) { @@ -234,8 +233,7 @@ func (c *client) UpdateEnvironment(ctx context.Context, nameOrUUID string, input var e *Environment err = json.NewDecoder(resp.Body).Decode(&e) - - return e, nil + return e, err } func (c *client) PerformActionOnEnvironment(ctx context.Context, nameOrUUID string, input *RepairEnvironmentInput) (*Environment, error) { @@ -252,6 +250,5 @@ func (c *client) PerformActionOnEnvironment(ctx context.Context, nameOrUUID stri var e *Environment err = json.NewDecoder(resp.Body).Decode(&e) - - return e, nil + return e, err } diff --git a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/meroxa.go b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/meroxa.go index 313e1d4b0..4483a2e5b 100644 --- a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/meroxa.go +++ b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/meroxa.go @@ -45,7 +45,6 @@ func (e EntityIdentifier) GetNameOrUUID() (string, error) { type client struct { baseURL *url.URL userAgent string - token string httpClient *http.Client } diff --git a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/resource_types.go b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/resource_types.go index 7223e040f..cef4e8f91 100644 --- a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/resource_types.go +++ b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/resource_types.go @@ -3,29 +3,30 @@ package meroxa import ( "context" "encoding/json" - "fmt" "net/http" ) type ResourceType string const ( - ResourceTypePostgres ResourceType = "postgres" - ResourceTypeMysql ResourceType = "mysql" - ResourceTypeRedshift ResourceType = "redshift" - ResourceTypeUrl ResourceType = "url" - ResourceTypeS3 ResourceType = "s3" - ResourceTypeMongodb ResourceType = "mongodb" - ResourceTypeElasticsearch ResourceType = "elasticsearch" - ResourceTypeSnowflake ResourceType = "snowflakedb" - ResourceTypeBigquery ResourceType = "bigquery" - ResourceTypeSqlserver ResourceType = "sqlserver" - ResourceTypeCosmosdb ResourceType = "cosmosdb" + ResourceTypePostgres ResourceType = "postgres" + ResourceTypeMysql ResourceType = "mysql" + ResourceTypeRedshift ResourceType = "redshift" + ResourceTypeUrl ResourceType = "url" + ResourceTypeS3 ResourceType = "s3" + ResourceTypeMongodb ResourceType = "mongodb" + ResourceTypeElasticsearch ResourceType = "elasticsearch" + ResourceTypeSnowflake ResourceType = "snowflakedb" + ResourceTypeBigquery ResourceType = "bigquery" + ResourceTypeSqlserver ResourceType = "sqlserver" + ResourceTypeCosmosdb ResourceType = "cosmosdb" + ResourceTypeKafka ResourceType = "kafka" + ResourceTypeConfluentCloud ResourceType = "confluentcloud" ) // ListResourceTypes returns the list of supported resources func (c *client) ListResourceTypes(ctx context.Context) ([]string, error) { - path := fmt.Sprintf("/v1/resource-types") + path := "/v1/resource-types" resp, err := c.MakeRequest(ctx, http.MethodGet, path, nil, nil, nil) if err != nil { diff --git a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/transform.go b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/transform.go index 2a86e7b02..63b21e537 100644 --- a/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/transform.go +++ b/vendor/github.com/meroxa/meroxa-go/pkg/meroxa/transform.go @@ -3,7 +3,6 @@ package meroxa import ( "context" "encoding/json" - "fmt" "net/http" ) @@ -25,7 +24,7 @@ type Transform struct { // ListTransforms returns an array of Transforms (scoped to the calling user) func (c *client) ListTransforms(ctx context.Context) ([]*Transform, error) { - path := fmt.Sprintf("/v1/transforms") + path := "/v1/transforms" resp, err := c.MakeRequest(ctx, http.MethodGet, path, nil, nil, nil) if err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index cbb7a0920..04301dea0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -196,7 +196,7 @@ github.com/mattn/go-runewidth # github.com/mattn/go-shellwords v1.0.12 ## explicit; go 1.13 github.com/mattn/go-shellwords -# github.com/meroxa/meroxa-go v0.0.0-20220810182408-f05df5bf6f6e +# github.com/meroxa/meroxa-go v0.0.0-20220912230249-20686297f457 ## explicit; go 1.17 github.com/meroxa/meroxa-go/pkg/meroxa github.com/meroxa/meroxa-go/pkg/mock