Skip to content

Commit bc311d7

Browse files
authored
TEAMENG-923: update SDK with latest gRPC services (#63)
1 parent d0bbcc9 commit bc311d7

File tree

8 files changed

+36
-49
lines changed

8 files changed

+36
-49
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 3 deletions
This file was deleted.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.8.3
1+
2.9.0

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/formalco/go-sdk/v2
22

3-
go 1.22.0
3+
go 1.23
44

55
require github.com/dave/jennifer v1.7.1

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
const packageName = "buf.build/gen/go/formal/core/connectrpc/go"
1919
const path = "/core/v1/corev1connect"
20-
const url = "https://v2api.formalcloud.net"
20+
const url = "https://api.joinformal.com"
2121

2222
var directoryPath = os.Getenv("DIRECTORY_PATH")
2323

sdk/client.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,3 @@ func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
1313
req.Header.Add("X-Formal-API-Version", t.apiVersion)
1414
return t.underlyingTransport.RoundTrip(req)
1515
}
16-
17-
func NewClient(apiKey, apiVersion string) *http.Client {
18-
return &http.Client{
19-
Transport: &transport{
20-
apiKey: apiKey,
21-
apiVersion: apiVersion,
22-
underlyingTransport: http.DefaultTransport,
23-
},
24-
}
25-
}

sdk/go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module github.com/formalco/go-sdk/sdk/v2
22

3-
go 1.22.0
3+
go 1.23
44

5-
require buf.build/gen/go/formal/core/connectrpc/go v1.18.1-20250226003025-88fb0896b952.1
5+
require buf.build/gen/go/formal/core/connectrpc/go v1.18.1-20250910185804-029448314944.1
66

77
require (
8-
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.5-20240920164238-5a7b106cbb87.1 // indirect
9-
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.5-20250226003025-88fb0896b952.1 // indirect
10-
buf.build/gen/go/grpc-ecosystem/grpc-gateway/protocolbuffers/go v1.36.5-20240617172850-a48fcebcf8f1.1 // indirect
8+
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.9-20250717185734-6c6e0d3c608e.1 // indirect
9+
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.9-20250910185804-029448314944.1 // indirect
10+
buf.build/gen/go/grpc-ecosystem/grpc-gateway/protocolbuffers/go v1.36.9-20241220201140-4c5ba75caaf8.1 // indirect
1111
connectrpc.com/connect v1.18.1 // indirect
1212
google.golang.org/genproto/googleapis/api v0.0.0-20250127172529-29210b9bc287 // indirect
13-
google.golang.org/protobuf v1.36.5 // indirect
13+
google.golang.org/protobuf v1.36.9 // indirect
1414
)

sdk/go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.5-20240920164238-5a7b106cbb87.1 h1:Ybl3eBypjm69pOWpIo6IIApD7aXkylzjS0TiXZhxi1o=
2-
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.5-20240920164238-5a7b106cbb87.1/go.mod h1:eOqrCVUfhh7SLo00urDe/XhJHljj0dWMZirS0aX7cmc=
3-
buf.build/gen/go/formal/core/connectrpc/go v1.18.1-20250226003025-88fb0896b952.1 h1:GkweUWbK4k0K+J4USX4SwQQSq9POsub75+FLqI1j+EI=
4-
buf.build/gen/go/formal/core/connectrpc/go v1.18.1-20250226003025-88fb0896b952.1/go.mod h1:LOEoK9LSTwQzt5mHK+s5CBhVU44V2Qt1cSh39CeLohU=
5-
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.5-20250226003025-88fb0896b952.1 h1:Lkk/xbt7iZr5niikhMo+MV4u5WMW5QSUDY8Ygnoz3Cg=
6-
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.5-20250226003025-88fb0896b952.1/go.mod h1:ktWxlWHKhhqIUW4LbW41rlyun5U9uSGvWXSFweB6IXA=
7-
buf.build/gen/go/grpc-ecosystem/grpc-gateway/protocolbuffers/go v1.36.5-20240617172850-a48fcebcf8f1.1 h1:LlB+YL2ftBSwvc61C8R37Tm7sepZOP+ilucoSJe3teA=
8-
buf.build/gen/go/grpc-ecosystem/grpc-gateway/protocolbuffers/go v1.36.5-20240617172850-a48fcebcf8f1.1/go.mod h1:LAznaLI+eD1SNx+1NfEgrWtuPofvpEP1NTSuCWp3SBw=
1+
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.9-20250717185734-6c6e0d3c608e.1 h1:u98oQG8CHYBrOWrYdqbyNpKz4Pw02ssv03DsTInnXn8=
2+
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.9-20250717185734-6c6e0d3c608e.1/go.mod h1:aY3zbkNan5F+cGm9lITDP6oxJIwu0dn9KjJuJjWaHkg=
3+
buf.build/gen/go/formal/core/connectrpc/go v1.18.1-20250910185804-029448314944.1 h1:PiM7nXqHl3JWPDVVB4KJHVsMeJhq0YhYnfkQ4vCiNXI=
4+
buf.build/gen/go/formal/core/connectrpc/go v1.18.1-20250910185804-029448314944.1/go.mod h1:Keo6xK26OtzIkB0riDRtSD90JuEi3L8+aKQ0tQBTTlw=
5+
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.9-20250910185804-029448314944.1 h1:IAuwN/R6D5s9USjPHAv57yT5XkBpfNsHhDeZ51+xZ3c=
6+
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.9-20250910185804-029448314944.1/go.mod h1:ETcJWjUm2dnU9DiajKYn0qVRiks69Wp4aeyuh6ltmmE=
7+
buf.build/gen/go/grpc-ecosystem/grpc-gateway/protocolbuffers/go v1.36.9-20241220201140-4c5ba75caaf8.1 h1:BXq2wBGqfVg7ywjTCsj/bkxiZsoCmJPe+aJd1avZ2Zo=
8+
buf.build/gen/go/grpc-ecosystem/grpc-gateway/protocolbuffers/go v1.36.9-20241220201140-4c5ba75caaf8.1/go.mod h1:cyGdcqucRZliu5beS9fw4NIPM0Rb22Jvy5IFLNox2Qs=
99
connectrpc.com/connect v1.18.1 h1:PAg7CjSAGvscaf6YZKUefjoih5Z/qYkyaTrBW8xvYPw=
1010
connectrpc.com/connect v1.18.1/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8=
1111
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
@@ -16,5 +16,5 @@ golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
1616
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
1717
google.golang.org/genproto/googleapis/api v0.0.0-20250127172529-29210b9bc287 h1:A2ni10G3UlplFrWdCDJTl7D7mJ7GSRm37S+PDimaKRw=
1818
google.golang.org/genproto/googleapis/api v0.0.0-20250127172529-29210b9bc287/go.mod h1:iYONQfRdizDB8JJBybql13nArx91jcUk7zCXEsOofM4=
19-
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
20-
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
19+
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
20+
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=

sdk/sdk.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package sdk
22

33
import (
4-
"buf.build/gen/go/formal/core/connectrpc/go/core/v1/corev1connect"
4+
"net/http"
5+
6+
corev1connect "buf.build/gen/go/formal/core/connectrpc/go/core/v1/corev1connect"
57
)
68

7-
const FormalHostUrl string = "https://api.joinformal.com"
9+
const (
10+
FORMAL_HOST_URL string = "https://api.joinformal.com"
11+
)
812

913
type FormalSDK struct {
1014
ConnectorServiceClient corev1connect.ConnectorServiceClient
@@ -13,8 +17,8 @@ type FormalSDK struct {
1317
IntegrationCloudServiceClient corev1connect.IntegrationCloudServiceClient
1418
IntegrationDataCatalogServiceClient corev1connect.IntegrationDataCatalogServiceClient
1519
IntegrationsLogServiceClient corev1connect.IntegrationsLogServiceClient
16-
IntegrationMfaServiceClient corev1connect.IntegrationMfaServiceClient
1720
IntegrationMDMServiceClient corev1connect.IntegrationMDMServiceClient
21+
IntegrationMfaServiceClient corev1connect.IntegrationMfaServiceClient
1822
InventoryServiceClient corev1connect.InventoryServiceClient
1923
LogsServiceClient corev1connect.LogsServiceClient
2024
MonitorsServiceClient corev1connect.MonitorsServiceClient
@@ -23,36 +27,32 @@ type FormalSDK struct {
2327
PolicyDataLoaderServiceClient corev1connect.PolicyDataLoaderServiceClient
2428
ResourceServiceClient corev1connect.ResourceServiceClient
2529
SatelliteServiceClient corev1connect.SatelliteServiceClient
26-
SessionServiceClient corev1connect.SessionsServiceClient
30+
SessionsServiceClient corev1connect.SessionsServiceClient
2731
SidecarServiceClient corev1connect.SidecarServiceClient
2832
SpaceServiceClient corev1connect.SpaceServiceClient
2933
TrackersServiceClient corev1connect.TrackersServiceClient
3034
UserServiceClient corev1connect.UserServiceClient
3135
}
3236

33-
// New creates a new FormalSDK instance
3437
func New(apiKey string) *FormalSDK {
35-
return NewWithUrl(apiKey, FormalHostUrl)
38+
return NewWithUrl(apiKey, FORMAL_HOST_URL)
3639
}
3740

38-
// NewWithUrl creates a new FormalSDK instance with a custom URL
39-
func NewWithUrl(apiKey, url string) *FormalSDK {
40-
return NewWithParams(apiKey, "2025-02-24", url)
41-
}
42-
43-
// NewWithParams creates a new FormalSDK instance with all custom params
44-
func NewWithParams(apiKey, apiVersion, url string) *FormalSDK {
45-
httpClient := NewClient(apiKey, apiVersion)
46-
41+
func NewWithUrl(apiKey string, url string) *FormalSDK {
42+
httpClient := &http.Client{Transport: &transport{
43+
apiKey: apiKey,
44+
apiVersion: "2025-02-24",
45+
underlyingTransport: http.DefaultTransport,
46+
}}
4747
return &FormalSDK{
4848
ConnectorServiceClient: corev1connect.NewConnectorServiceClient(httpClient, url),
4949
GroupServiceClient: corev1connect.NewGroupServiceClient(httpClient, url),
5050
IntegrationBIServiceClient: corev1connect.NewIntegrationBIServiceClient(httpClient, url),
5151
IntegrationCloudServiceClient: corev1connect.NewIntegrationCloudServiceClient(httpClient, url),
5252
IntegrationDataCatalogServiceClient: corev1connect.NewIntegrationDataCatalogServiceClient(httpClient, url),
53+
IntegrationMDMServiceClient: corev1connect.NewIntegrationMDMServiceClient(httpClient, url),
5354
IntegrationMfaServiceClient: corev1connect.NewIntegrationMfaServiceClient(httpClient, url),
5455
IntegrationsLogServiceClient: corev1connect.NewIntegrationsLogServiceClient(httpClient, url),
55-
IntegrationMDMServiceClient: corev1connect.NewIntegrationMDMServiceClient(httpClient, url),
5656
InventoryServiceClient: corev1connect.NewInventoryServiceClient(httpClient, url),
5757
LogsServiceClient: corev1connect.NewLogsServiceClient(httpClient, url),
5858
MonitorsServiceClient: corev1connect.NewMonitorsServiceClient(httpClient, url),
@@ -61,7 +61,7 @@ func NewWithParams(apiKey, apiVersion, url string) *FormalSDK {
6161
PolicyDataLoaderServiceClient: corev1connect.NewPolicyDataLoaderServiceClient(httpClient, url),
6262
ResourceServiceClient: corev1connect.NewResourceServiceClient(httpClient, url),
6363
SatelliteServiceClient: corev1connect.NewSatelliteServiceClient(httpClient, url),
64-
SessionServiceClient: corev1connect.NewSessionsServiceClient(httpClient, url),
64+
SessionsServiceClient: corev1connect.NewSessionsServiceClient(httpClient, url),
6565
SidecarServiceClient: corev1connect.NewSidecarServiceClient(httpClient, url),
6666
SpaceServiceClient: corev1connect.NewSpaceServiceClient(httpClient, url),
6767
TrackersServiceClient: corev1connect.NewTrackersServiceClient(httpClient, url),

0 commit comments

Comments
 (0)