@@ -13,7 +13,7 @@ import (
1313 "github.com/stackitcloud/stackit-cli/internal/pkg/testutils"
1414 "github.com/stackitcloud/stackit-cli/internal/pkg/types"
1515 "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
16- "github.com/stackitcloud/stackit-sdk-go/services/intake"
16+ intake "github.com/stackitcloud/stackit-sdk-go/services/intake/v1betaapi "
1717)
1818
1919// Define a unique key for the context to avoid collisions
4040 // testCtx dummy context for testing purposes
4141 testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
4242 // testClient mock API client
43- testClient = & intake.APIClient {}
43+ testClient = & intake.APIClient {
44+ DefaultAPI : & intake.DefaultAPIService {},
45+ }
4446 testProjectId = uuid .NewString ()
4547 testRunnerId = uuid .NewString ()
4648
@@ -106,22 +108,22 @@ func fixtureCreatePayload(mods ...func(payload *intake.CreateIntakePayload)) int
106108 authType := intake .CatalogAuthType (testCatalogAuthType )
107109 testPartitioningType := intake .PartitioningType (testCatalogPartitioning )
108110 payload := intake.CreateIntakePayload {
109- DisplayName : utils . Ptr ( testDisplayName ) ,
110- IntakeRunnerId : utils . Ptr ( testRunnerId ) ,
111+ DisplayName : testDisplayName ,
112+ IntakeRunnerId : testRunnerId ,
111113 Description : utils .Ptr (testDescription ),
112- Labels : utils . Ptr ( testLabels ) ,
113- Catalog : & intake.IntakeCatalog {
114- Uri : utils . Ptr ( testCatalogURI ) ,
115- Warehouse : utils . Ptr ( testCatalogWarehouse ) ,
114+ Labels : testLabels ,
115+ Catalog : intake.IntakeCatalog {
116+ Uri : testCatalogURI ,
117+ Warehouse : testCatalogWarehouse ,
116118 Namespace : utils .Ptr (testCatalogNamespace ),
117119 TableName : utils .Ptr (testCatalogTableName ),
118120 Partitioning : & testPartitioningType ,
119- PartitionBy : utils . Ptr ( testCatalogPartitionBy ) ,
121+ PartitionBy : testCatalogPartitionBy ,
120122 Auth : & intake.CatalogAuth {
121- Type : & authType ,
123+ Type : authType ,
122124 Dremio : & intake.DremioAuth {
123- TokenEndpoint : utils . Ptr ( testDremioTokenEndpoint ) ,
124- PersonalAccessToken : utils . Ptr ( testDremioToken ) ,
125+ TokenEndpoint : testDremioTokenEndpoint ,
126+ PersonalAccessToken : testDremioToken ,
125127 },
126128 },
127129 },
@@ -134,7 +136,7 @@ func fixtureCreatePayload(mods ...func(payload *intake.CreateIntakePayload)) int
134136
135137// fixtureRequest generates an API request for tests
136138func fixtureRequest (mods ... func (request * intake.ApiCreateIntakeRequest )) intake.ApiCreateIntakeRequest {
137- request := testClient .CreateIntake (testCtx , testProjectId , testRegion )
139+ request := testClient .DefaultAPI . CreateIntake (testCtx , testProjectId , testRegion )
138140 request = request .CreateIntakePayload (fixtureCreatePayload ())
139141 for _ , mod := range mods {
140142 mod (& request )
@@ -268,7 +270,7 @@ func TestBuildRequest(t *testing.T) {
268270 expectedRequest : fixtureRequest (func (request * intake.ApiCreateIntakeRequest ) {
269271 * request = (* request ).CreateIntakePayload (fixtureCreatePayload (func (payload * intake.CreateIntakePayload ) {
270272 authType := intake .CatalogAuthType ("none" )
271- payload .Catalog .Auth .Type = & authType
273+ payload .Catalog .Auth .Type = authType
272274 payload .Catalog .Auth .Dremio = nil
273275 }))
274276 }),
@@ -281,6 +283,7 @@ func TestBuildRequest(t *testing.T) {
281283 diff := cmp .Diff (request , tt .expectedRequest ,
282284 cmp .AllowUnexported (tt .expectedRequest ),
283285 cmpopts .EquateComparable (testCtx ),
286+ cmpopts .EquateComparable (testClient .DefaultAPI ),
284287 )
285288 if diff != "" {
286289 t .Fatalf ("Data does not match: %s" , diff )
@@ -305,7 +308,7 @@ func TestOutputResult(t *testing.T) {
305308 args : args {
306309 model : fixtureInputModel (),
307310 projectLabel : "my-project" ,
308- resp : & intake.IntakeResponse {Id : utils . Ptr ( "intake-id-123" ) },
311+ resp : & intake.IntakeResponse {Id : "intake-id-123" },
309312 },
310313 wantErr : false ,
311314 },
@@ -316,7 +319,7 @@ func TestOutputResult(t *testing.T) {
316319 model .Async = true
317320 }),
318321 projectLabel : "my-project" ,
319- resp : & intake.IntakeResponse {Id : utils . Ptr ( "intake-id-123" ) },
322+ resp : & intake.IntakeResponse {Id : "intake-id-123" },
320323 },
321324 wantErr : false ,
322325 },
@@ -326,7 +329,7 @@ func TestOutputResult(t *testing.T) {
326329 model : fixtureInputModel (func (model * inputModel ) {
327330 model .OutputFormat = print .JSONOutputFormat
328331 }),
329- resp : & intake.IntakeResponse {Id : utils . Ptr ( "intake-id-123" ) },
332+ resp : & intake.IntakeResponse {Id : "intake-id-123" },
330333 },
331334 wantErr : false ,
332335 },
0 commit comments