diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 8c62ac620..de0f45ab9 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -7eb5ad9a2ed3e3f1055968a2d1014ac92c06fe92 \ No newline at end of file +37b925eba37dfb3d7e05b6ba2d458454ce62d3a0 \ No newline at end of file diff --git a/experimental/mocks/service/catalog/mock_account_storage_credentials_interface.go b/experimental/mocks/service/catalog/mock_account_storage_credentials_interface.go index cc623fca9..ff4db744d 100644 --- a/experimental/mocks/service/catalog/mock_account_storage_credentials_interface.go +++ b/experimental/mocks/service/catalog/mock_account_storage_credentials_interface.go @@ -7,6 +7,8 @@ import ( catalog "github.com/databricks/databricks-sdk-go/service/catalog" + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" ) @@ -296,65 +298,6 @@ func (_c *MockAccountStorageCredentialsInterface_GetByMetastoreIdAndStorageCrede return _c } -// GetByName provides a mock function with given fields: ctx, name -func (_m *MockAccountStorageCredentialsInterface) GetByName(ctx context.Context, name string) (*catalog.StorageCredentialInfo, error) { - ret := _m.Called(ctx, name) - - if len(ret) == 0 { - panic("no return value specified for GetByName") - } - - var r0 *catalog.StorageCredentialInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*catalog.StorageCredentialInfo, error)); ok { - return rf(ctx, name) - } - if rf, ok := ret.Get(0).(func(context.Context, string) *catalog.StorageCredentialInfo); ok { - r0 = rf(ctx, name) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*catalog.StorageCredentialInfo) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, name) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockAccountStorageCredentialsInterface_GetByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByName' -type MockAccountStorageCredentialsInterface_GetByName_Call struct { - *mock.Call -} - -// GetByName is a helper method to define mock.On call -// - ctx context.Context -// - name string -func (_e *MockAccountStorageCredentialsInterface_Expecter) GetByName(ctx interface{}, name interface{}) *MockAccountStorageCredentialsInterface_GetByName_Call { - return &MockAccountStorageCredentialsInterface_GetByName_Call{Call: _e.mock.On("GetByName", ctx, name)} -} - -func (_c *MockAccountStorageCredentialsInterface_GetByName_Call) Run(run func(ctx context.Context, name string)) *MockAccountStorageCredentialsInterface_GetByName_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) - }) - return _c -} - -func (_c *MockAccountStorageCredentialsInterface_GetByName_Call) Return(_a0 *catalog.StorageCredentialInfo, _a1 error) *MockAccountStorageCredentialsInterface_GetByName_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockAccountStorageCredentialsInterface_GetByName_Call) RunAndReturn(run func(context.Context, string) (*catalog.StorageCredentialInfo, error)) *MockAccountStorageCredentialsInterface_GetByName_Call { - _c.Call.Return(run) - return _c -} - // Impl provides a mock function with given fields: func (_m *MockAccountStorageCredentialsInterface) Impl() catalog.AccountStorageCredentialsService { ret := _m.Called() @@ -403,33 +346,23 @@ func (_c *MockAccountStorageCredentialsInterface_Impl_Call) RunAndReturn(run fun } // List provides a mock function with given fields: ctx, request -func (_m *MockAccountStorageCredentialsInterface) List(ctx context.Context, request catalog.ListAccountStorageCredentialsRequest) ([]catalog.StorageCredentialInfo, error) { +func (_m *MockAccountStorageCredentialsInterface) List(ctx context.Context, request catalog.ListAccountStorageCredentialsRequest) listing.Iterator[catalog.StorageCredentialInfo] { ret := _m.Called(ctx, request) if len(ret) == 0 { panic("no return value specified for List") } - var r0 []catalog.StorageCredentialInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.ListAccountStorageCredentialsRequest) ([]catalog.StorageCredentialInfo, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, catalog.ListAccountStorageCredentialsRequest) []catalog.StorageCredentialInfo); ok { + var r0 listing.Iterator[catalog.StorageCredentialInfo] + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListAccountStorageCredentialsRequest) listing.Iterator[catalog.StorageCredentialInfo]); ok { r0 = rf(ctx, request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]catalog.StorageCredentialInfo) + r0 = ret.Get(0).(listing.Iterator[catalog.StorageCredentialInfo]) } } - if rf, ok := ret.Get(1).(func(context.Context, catalog.ListAccountStorageCredentialsRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 + return r0 } // MockAccountStorageCredentialsInterface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' @@ -451,39 +384,39 @@ func (_c *MockAccountStorageCredentialsInterface_List_Call) Run(run func(ctx con return _c } -func (_c *MockAccountStorageCredentialsInterface_List_Call) Return(_a0 []catalog.StorageCredentialInfo, _a1 error) *MockAccountStorageCredentialsInterface_List_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockAccountStorageCredentialsInterface_List_Call) Return(_a0 listing.Iterator[catalog.StorageCredentialInfo]) *MockAccountStorageCredentialsInterface_List_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockAccountStorageCredentialsInterface_List_Call) RunAndReturn(run func(context.Context, catalog.ListAccountStorageCredentialsRequest) ([]catalog.StorageCredentialInfo, error)) *MockAccountStorageCredentialsInterface_List_Call { +func (_c *MockAccountStorageCredentialsInterface_List_Call) RunAndReturn(run func(context.Context, catalog.ListAccountStorageCredentialsRequest) listing.Iterator[catalog.StorageCredentialInfo]) *MockAccountStorageCredentialsInterface_List_Call { _c.Call.Return(run) return _c } -// ListByMetastoreId provides a mock function with given fields: ctx, metastoreId -func (_m *MockAccountStorageCredentialsInterface) ListByMetastoreId(ctx context.Context, metastoreId string) ([]catalog.StorageCredentialInfo, error) { - ret := _m.Called(ctx, metastoreId) +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockAccountStorageCredentialsInterface) ListAll(ctx context.Context, request catalog.ListAccountStorageCredentialsRequest) ([]catalog.StorageCredentialInfo, error) { + ret := _m.Called(ctx, request) if len(ret) == 0 { - panic("no return value specified for ListByMetastoreId") + panic("no return value specified for ListAll") } var r0 []catalog.StorageCredentialInfo var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) ([]catalog.StorageCredentialInfo, error)); ok { - return rf(ctx, metastoreId) + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListAccountStorageCredentialsRequest) ([]catalog.StorageCredentialInfo, error)); ok { + return rf(ctx, request) } - if rf, ok := ret.Get(0).(func(context.Context, string) []catalog.StorageCredentialInfo); ok { - r0 = rf(ctx, metastoreId) + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListAccountStorageCredentialsRequest) []catalog.StorageCredentialInfo); ok { + r0 = rf(ctx, request) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]catalog.StorageCredentialInfo) } } - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, metastoreId) + if rf, ok := ret.Get(1).(func(context.Context, catalog.ListAccountStorageCredentialsRequest) error); ok { + r1 = rf(ctx, request) } else { r1 = ret.Error(1) } @@ -491,58 +424,58 @@ func (_m *MockAccountStorageCredentialsInterface) ListByMetastoreId(ctx context. return r0, r1 } -// MockAccountStorageCredentialsInterface_ListByMetastoreId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListByMetastoreId' -type MockAccountStorageCredentialsInterface_ListByMetastoreId_Call struct { +// MockAccountStorageCredentialsInterface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockAccountStorageCredentialsInterface_ListAll_Call struct { *mock.Call } -// ListByMetastoreId is a helper method to define mock.On call +// ListAll is a helper method to define mock.On call // - ctx context.Context -// - metastoreId string -func (_e *MockAccountStorageCredentialsInterface_Expecter) ListByMetastoreId(ctx interface{}, metastoreId interface{}) *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call { - return &MockAccountStorageCredentialsInterface_ListByMetastoreId_Call{Call: _e.mock.On("ListByMetastoreId", ctx, metastoreId)} +// - request catalog.ListAccountStorageCredentialsRequest +func (_e *MockAccountStorageCredentialsInterface_Expecter) ListAll(ctx interface{}, request interface{}) *MockAccountStorageCredentialsInterface_ListAll_Call { + return &MockAccountStorageCredentialsInterface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} } -func (_c *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call) Run(run func(ctx context.Context, metastoreId string)) *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call { +func (_c *MockAccountStorageCredentialsInterface_ListAll_Call) Run(run func(ctx context.Context, request catalog.ListAccountStorageCredentialsRequest)) *MockAccountStorageCredentialsInterface_ListAll_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) + run(args[0].(context.Context), args[1].(catalog.ListAccountStorageCredentialsRequest)) }) return _c } -func (_c *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call) Return(_a0 []catalog.StorageCredentialInfo, _a1 error) *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call { +func (_c *MockAccountStorageCredentialsInterface_ListAll_Call) Return(_a0 []catalog.StorageCredentialInfo, _a1 error) *MockAccountStorageCredentialsInterface_ListAll_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call) RunAndReturn(run func(context.Context, string) ([]catalog.StorageCredentialInfo, error)) *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call { +func (_c *MockAccountStorageCredentialsInterface_ListAll_Call) RunAndReturn(run func(context.Context, catalog.ListAccountStorageCredentialsRequest) ([]catalog.StorageCredentialInfo, error)) *MockAccountStorageCredentialsInterface_ListAll_Call { _c.Call.Return(run) return _c } -// StorageCredentialInfoNameToIdMap provides a mock function with given fields: ctx, request -func (_m *MockAccountStorageCredentialsInterface) StorageCredentialInfoNameToIdMap(ctx context.Context, request catalog.ListAccountStorageCredentialsRequest) (map[string]string, error) { - ret := _m.Called(ctx, request) +// ListByMetastoreId provides a mock function with given fields: ctx, metastoreId +func (_m *MockAccountStorageCredentialsInterface) ListByMetastoreId(ctx context.Context, metastoreId string) (*catalog.ListAccountStorageCredentialsResponse, error) { + ret := _m.Called(ctx, metastoreId) if len(ret) == 0 { - panic("no return value specified for StorageCredentialInfoNameToIdMap") + panic("no return value specified for ListByMetastoreId") } - var r0 map[string]string + var r0 *catalog.ListAccountStorageCredentialsResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.ListAccountStorageCredentialsRequest) (map[string]string, error)); ok { - return rf(ctx, request) + if rf, ok := ret.Get(0).(func(context.Context, string) (*catalog.ListAccountStorageCredentialsResponse, error)); ok { + return rf(ctx, metastoreId) } - if rf, ok := ret.Get(0).(func(context.Context, catalog.ListAccountStorageCredentialsRequest) map[string]string); ok { - r0 = rf(ctx, request) + if rf, ok := ret.Get(0).(func(context.Context, string) *catalog.ListAccountStorageCredentialsResponse); ok { + r0 = rf(ctx, metastoreId) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string]string) + r0 = ret.Get(0).(*catalog.ListAccountStorageCredentialsResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, catalog.ListAccountStorageCredentialsRequest) error); ok { - r1 = rf(ctx, request) + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, metastoreId) } else { r1 = ret.Error(1) } @@ -550,31 +483,31 @@ func (_m *MockAccountStorageCredentialsInterface) StorageCredentialInfoNameToIdM return r0, r1 } -// MockAccountStorageCredentialsInterface_StorageCredentialInfoNameToIdMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StorageCredentialInfoNameToIdMap' -type MockAccountStorageCredentialsInterface_StorageCredentialInfoNameToIdMap_Call struct { +// MockAccountStorageCredentialsInterface_ListByMetastoreId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListByMetastoreId' +type MockAccountStorageCredentialsInterface_ListByMetastoreId_Call struct { *mock.Call } -// StorageCredentialInfoNameToIdMap is a helper method to define mock.On call +// ListByMetastoreId is a helper method to define mock.On call // - ctx context.Context -// - request catalog.ListAccountStorageCredentialsRequest -func (_e *MockAccountStorageCredentialsInterface_Expecter) StorageCredentialInfoNameToIdMap(ctx interface{}, request interface{}) *MockAccountStorageCredentialsInterface_StorageCredentialInfoNameToIdMap_Call { - return &MockAccountStorageCredentialsInterface_StorageCredentialInfoNameToIdMap_Call{Call: _e.mock.On("StorageCredentialInfoNameToIdMap", ctx, request)} +// - metastoreId string +func (_e *MockAccountStorageCredentialsInterface_Expecter) ListByMetastoreId(ctx interface{}, metastoreId interface{}) *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call { + return &MockAccountStorageCredentialsInterface_ListByMetastoreId_Call{Call: _e.mock.On("ListByMetastoreId", ctx, metastoreId)} } -func (_c *MockAccountStorageCredentialsInterface_StorageCredentialInfoNameToIdMap_Call) Run(run func(ctx context.Context, request catalog.ListAccountStorageCredentialsRequest)) *MockAccountStorageCredentialsInterface_StorageCredentialInfoNameToIdMap_Call { +func (_c *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call) Run(run func(ctx context.Context, metastoreId string)) *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.ListAccountStorageCredentialsRequest)) + run(args[0].(context.Context), args[1].(string)) }) return _c } -func (_c *MockAccountStorageCredentialsInterface_StorageCredentialInfoNameToIdMap_Call) Return(_a0 map[string]string, _a1 error) *MockAccountStorageCredentialsInterface_StorageCredentialInfoNameToIdMap_Call { +func (_c *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call) Return(_a0 *catalog.ListAccountStorageCredentialsResponse, _a1 error) *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockAccountStorageCredentialsInterface_StorageCredentialInfoNameToIdMap_Call) RunAndReturn(run func(context.Context, catalog.ListAccountStorageCredentialsRequest) (map[string]string, error)) *MockAccountStorageCredentialsInterface_StorageCredentialInfoNameToIdMap_Call { +func (_c *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call) RunAndReturn(run func(context.Context, string) (*catalog.ListAccountStorageCredentialsResponse, error)) *MockAccountStorageCredentialsInterface_ListByMetastoreId_Call { _c.Call.Return(run) return _c } diff --git a/experimental/mocks/service/marketplace/mock_consumer_listings_interface.go b/experimental/mocks/service/marketplace/mock_consumer_listings_interface.go index e1b389f9f..4fb554721 100644 --- a/experimental/mocks/service/marketplace/mock_consumer_listings_interface.go +++ b/experimental/mocks/service/marketplace/mock_consumer_listings_interface.go @@ -24,6 +24,65 @@ func (_m *MockConsumerListingsInterface) EXPECT() *MockConsumerListingsInterface return &MockConsumerListingsInterface_Expecter{mock: &_m.Mock} } +// BatchGet provides a mock function with given fields: ctx, request +func (_m *MockConsumerListingsInterface) BatchGet(ctx context.Context, request marketplace.BatchGetListingsRequest) (*marketplace.BatchGetListingsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for BatchGet") + } + + var r0 *marketplace.BatchGetListingsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, marketplace.BatchGetListingsRequest) (*marketplace.BatchGetListingsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, marketplace.BatchGetListingsRequest) *marketplace.BatchGetListingsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marketplace.BatchGetListingsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, marketplace.BatchGetListingsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockConsumerListingsInterface_BatchGet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BatchGet' +type MockConsumerListingsInterface_BatchGet_Call struct { + *mock.Call +} + +// BatchGet is a helper method to define mock.On call +// - ctx context.Context +// - request marketplace.BatchGetListingsRequest +func (_e *MockConsumerListingsInterface_Expecter) BatchGet(ctx interface{}, request interface{}) *MockConsumerListingsInterface_BatchGet_Call { + return &MockConsumerListingsInterface_BatchGet_Call{Call: _e.mock.On("BatchGet", ctx, request)} +} + +func (_c *MockConsumerListingsInterface_BatchGet_Call) Run(run func(ctx context.Context, request marketplace.BatchGetListingsRequest)) *MockConsumerListingsInterface_BatchGet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(marketplace.BatchGetListingsRequest)) + }) + return _c +} + +func (_c *MockConsumerListingsInterface_BatchGet_Call) Return(_a0 *marketplace.BatchGetListingsResponse, _a1 error) *MockConsumerListingsInterface_BatchGet_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockConsumerListingsInterface_BatchGet_Call) RunAndReturn(run func(context.Context, marketplace.BatchGetListingsRequest) (*marketplace.BatchGetListingsResponse, error)) *MockConsumerListingsInterface_BatchGet_Call { + _c.Call.Return(run) + return _c +} + // Get provides a mock function with given fields: ctx, request func (_m *MockConsumerListingsInterface) Get(ctx context.Context, request marketplace.GetListingRequest) (*marketplace.GetListingResponse, error) { ret := _m.Called(ctx, request) diff --git a/experimental/mocks/service/marketplace/mock_consumer_providers_interface.go b/experimental/mocks/service/marketplace/mock_consumer_providers_interface.go index 4aad119a2..55b54f4ce 100644 --- a/experimental/mocks/service/marketplace/mock_consumer_providers_interface.go +++ b/experimental/mocks/service/marketplace/mock_consumer_providers_interface.go @@ -24,6 +24,65 @@ func (_m *MockConsumerProvidersInterface) EXPECT() *MockConsumerProvidersInterfa return &MockConsumerProvidersInterface_Expecter{mock: &_m.Mock} } +// BatchGet provides a mock function with given fields: ctx, request +func (_m *MockConsumerProvidersInterface) BatchGet(ctx context.Context, request marketplace.BatchGetProvidersRequest) (*marketplace.BatchGetProvidersResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for BatchGet") + } + + var r0 *marketplace.BatchGetProvidersResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, marketplace.BatchGetProvidersRequest) (*marketplace.BatchGetProvidersResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, marketplace.BatchGetProvidersRequest) *marketplace.BatchGetProvidersResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marketplace.BatchGetProvidersResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, marketplace.BatchGetProvidersRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockConsumerProvidersInterface_BatchGet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BatchGet' +type MockConsumerProvidersInterface_BatchGet_Call struct { + *mock.Call +} + +// BatchGet is a helper method to define mock.On call +// - ctx context.Context +// - request marketplace.BatchGetProvidersRequest +func (_e *MockConsumerProvidersInterface_Expecter) BatchGet(ctx interface{}, request interface{}) *MockConsumerProvidersInterface_BatchGet_Call { + return &MockConsumerProvidersInterface_BatchGet_Call{Call: _e.mock.On("BatchGet", ctx, request)} +} + +func (_c *MockConsumerProvidersInterface_BatchGet_Call) Run(run func(ctx context.Context, request marketplace.BatchGetProvidersRequest)) *MockConsumerProvidersInterface_BatchGet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(marketplace.BatchGetProvidersRequest)) + }) + return _c +} + +func (_c *MockConsumerProvidersInterface_BatchGet_Call) Return(_a0 *marketplace.BatchGetProvidersResponse, _a1 error) *MockConsumerProvidersInterface_BatchGet_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockConsumerProvidersInterface_BatchGet_Call) RunAndReturn(run func(context.Context, marketplace.BatchGetProvidersRequest) (*marketplace.BatchGetProvidersResponse, error)) *MockConsumerProvidersInterface_BatchGet_Call { + _c.Call.Return(run) + return _c +} + // Get provides a mock function with given fields: ctx, request func (_m *MockConsumerProvidersInterface) Get(ctx context.Context, request marketplace.GetProviderRequest) (*marketplace.GetProviderResponse, error) { ret := _m.Called(ctx, request) diff --git a/experimental/mocks/service/serving/mock_apps_interface.go b/experimental/mocks/service/serving/mock_apps_interface.go index ba56adb35..7ebbff688 100644 --- a/experimental/mocks/service/serving/mock_apps_interface.go +++ b/experimental/mocks/service/serving/mock_apps_interface.go @@ -161,12 +161,106 @@ func (_c *MockAppsInterface_CreateAndWait_Call) RunAndReturn(run func(context.Co return _c } -// CreateDeployment provides a mock function with given fields: ctx, createAppDeploymentRequest -func (_m *MockAppsInterface) CreateDeployment(ctx context.Context, createAppDeploymentRequest serving.CreateAppDeploymentRequest) (*serving.WaitGetDeploymentAppSucceeded[serving.AppDeployment], error) { +// Delete provides a mock function with given fields: ctx, request +func (_m *MockAppsInterface) Delete(ctx context.Context, request serving.DeleteAppRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, serving.DeleteAppRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAppsInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockAppsInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request serving.DeleteAppRequest +func (_e *MockAppsInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockAppsInterface_Delete_Call { + return &MockAppsInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockAppsInterface_Delete_Call) Run(run func(ctx context.Context, request serving.DeleteAppRequest)) *MockAppsInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(serving.DeleteAppRequest)) + }) + return _c +} + +func (_c *MockAppsInterface_Delete_Call) Return(_a0 error) *MockAppsInterface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAppsInterface_Delete_Call) RunAndReturn(run func(context.Context, serving.DeleteAppRequest) error) *MockAppsInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// DeleteByName provides a mock function with given fields: ctx, name +func (_m *MockAppsInterface) DeleteByName(ctx context.Context, name string) error { + ret := _m.Called(ctx, name) + + if len(ret) == 0 { + panic("no return value specified for DeleteByName") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAppsInterface_DeleteByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteByName' +type MockAppsInterface_DeleteByName_Call struct { + *mock.Call +} + +// DeleteByName is a helper method to define mock.On call +// - ctx context.Context +// - name string +func (_e *MockAppsInterface_Expecter) DeleteByName(ctx interface{}, name interface{}) *MockAppsInterface_DeleteByName_Call { + return &MockAppsInterface_DeleteByName_Call{Call: _e.mock.On("DeleteByName", ctx, name)} +} + +func (_c *MockAppsInterface_DeleteByName_Call) Run(run func(ctx context.Context, name string)) *MockAppsInterface_DeleteByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockAppsInterface_DeleteByName_Call) Return(_a0 error) *MockAppsInterface_DeleteByName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAppsInterface_DeleteByName_Call) RunAndReturn(run func(context.Context, string) error) *MockAppsInterface_DeleteByName_Call { + _c.Call.Return(run) + return _c +} + +// Deploy provides a mock function with given fields: ctx, createAppDeploymentRequest +func (_m *MockAppsInterface) Deploy(ctx context.Context, createAppDeploymentRequest serving.CreateAppDeploymentRequest) (*serving.WaitGetDeploymentAppSucceeded[serving.AppDeployment], error) { ret := _m.Called(ctx, createAppDeploymentRequest) if len(ret) == 0 { - panic("no return value specified for CreateDeployment") + panic("no return value specified for Deploy") } var r0 *serving.WaitGetDeploymentAppSucceeded[serving.AppDeployment] @@ -191,37 +285,37 @@ func (_m *MockAppsInterface) CreateDeployment(ctx context.Context, createAppDepl return r0, r1 } -// MockAppsInterface_CreateDeployment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDeployment' -type MockAppsInterface_CreateDeployment_Call struct { +// MockAppsInterface_Deploy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Deploy' +type MockAppsInterface_Deploy_Call struct { *mock.Call } -// CreateDeployment is a helper method to define mock.On call +// Deploy is a helper method to define mock.On call // - ctx context.Context // - createAppDeploymentRequest serving.CreateAppDeploymentRequest -func (_e *MockAppsInterface_Expecter) CreateDeployment(ctx interface{}, createAppDeploymentRequest interface{}) *MockAppsInterface_CreateDeployment_Call { - return &MockAppsInterface_CreateDeployment_Call{Call: _e.mock.On("CreateDeployment", ctx, createAppDeploymentRequest)} +func (_e *MockAppsInterface_Expecter) Deploy(ctx interface{}, createAppDeploymentRequest interface{}) *MockAppsInterface_Deploy_Call { + return &MockAppsInterface_Deploy_Call{Call: _e.mock.On("Deploy", ctx, createAppDeploymentRequest)} } -func (_c *MockAppsInterface_CreateDeployment_Call) Run(run func(ctx context.Context, createAppDeploymentRequest serving.CreateAppDeploymentRequest)) *MockAppsInterface_CreateDeployment_Call { +func (_c *MockAppsInterface_Deploy_Call) Run(run func(ctx context.Context, createAppDeploymentRequest serving.CreateAppDeploymentRequest)) *MockAppsInterface_Deploy_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(serving.CreateAppDeploymentRequest)) }) return _c } -func (_c *MockAppsInterface_CreateDeployment_Call) Return(_a0 *serving.WaitGetDeploymentAppSucceeded[serving.AppDeployment], _a1 error) *MockAppsInterface_CreateDeployment_Call { +func (_c *MockAppsInterface_Deploy_Call) Return(_a0 *serving.WaitGetDeploymentAppSucceeded[serving.AppDeployment], _a1 error) *MockAppsInterface_Deploy_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockAppsInterface_CreateDeployment_Call) RunAndReturn(run func(context.Context, serving.CreateAppDeploymentRequest) (*serving.WaitGetDeploymentAppSucceeded[serving.AppDeployment], error)) *MockAppsInterface_CreateDeployment_Call { +func (_c *MockAppsInterface_Deploy_Call) RunAndReturn(run func(context.Context, serving.CreateAppDeploymentRequest) (*serving.WaitGetDeploymentAppSucceeded[serving.AppDeployment], error)) *MockAppsInterface_Deploy_Call { _c.Call.Return(run) return _c } -// CreateDeploymentAndWait provides a mock function with given fields: ctx, createAppDeploymentRequest, options -func (_m *MockAppsInterface) CreateDeploymentAndWait(ctx context.Context, createAppDeploymentRequest serving.CreateAppDeploymentRequest, options ...retries.Option[serving.AppDeployment]) (*serving.AppDeployment, error) { +// DeployAndWait provides a mock function with given fields: ctx, createAppDeploymentRequest, options +func (_m *MockAppsInterface) DeployAndWait(ctx context.Context, createAppDeploymentRequest serving.CreateAppDeploymentRequest, options ...retries.Option[serving.AppDeployment]) (*serving.AppDeployment, error) { _va := make([]interface{}, len(options)) for _i := range options { _va[_i] = options[_i] @@ -232,7 +326,7 @@ func (_m *MockAppsInterface) CreateDeploymentAndWait(ctx context.Context, create ret := _m.Called(_ca...) if len(ret) == 0 { - panic("no return value specified for CreateDeploymentAndWait") + panic("no return value specified for DeployAndWait") } var r0 *serving.AppDeployment @@ -257,21 +351,21 @@ func (_m *MockAppsInterface) CreateDeploymentAndWait(ctx context.Context, create return r0, r1 } -// MockAppsInterface_CreateDeploymentAndWait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDeploymentAndWait' -type MockAppsInterface_CreateDeploymentAndWait_Call struct { +// MockAppsInterface_DeployAndWait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeployAndWait' +type MockAppsInterface_DeployAndWait_Call struct { *mock.Call } -// CreateDeploymentAndWait is a helper method to define mock.On call +// DeployAndWait is a helper method to define mock.On call // - ctx context.Context // - createAppDeploymentRequest serving.CreateAppDeploymentRequest // - options ...retries.Option[serving.AppDeployment] -func (_e *MockAppsInterface_Expecter) CreateDeploymentAndWait(ctx interface{}, createAppDeploymentRequest interface{}, options ...interface{}) *MockAppsInterface_CreateDeploymentAndWait_Call { - return &MockAppsInterface_CreateDeploymentAndWait_Call{Call: _e.mock.On("CreateDeploymentAndWait", +func (_e *MockAppsInterface_Expecter) DeployAndWait(ctx interface{}, createAppDeploymentRequest interface{}, options ...interface{}) *MockAppsInterface_DeployAndWait_Call { + return &MockAppsInterface_DeployAndWait_Call{Call: _e.mock.On("DeployAndWait", append([]interface{}{ctx, createAppDeploymentRequest}, options...)...)} } -func (_c *MockAppsInterface_CreateDeploymentAndWait_Call) Run(run func(ctx context.Context, createAppDeploymentRequest serving.CreateAppDeploymentRequest, options ...retries.Option[serving.AppDeployment])) *MockAppsInterface_CreateDeploymentAndWait_Call { +func (_c *MockAppsInterface_DeployAndWait_Call) Run(run func(ctx context.Context, createAppDeploymentRequest serving.CreateAppDeploymentRequest, options ...retries.Option[serving.AppDeployment])) *MockAppsInterface_DeployAndWait_Call { _c.Call.Run(func(args mock.Arguments) { variadicArgs := make([]retries.Option[serving.AppDeployment], len(args)-2) for i, a := range args[2:] { @@ -284,106 +378,12 @@ func (_c *MockAppsInterface_CreateDeploymentAndWait_Call) Run(run func(ctx conte return _c } -func (_c *MockAppsInterface_CreateDeploymentAndWait_Call) Return(_a0 *serving.AppDeployment, _a1 error) *MockAppsInterface_CreateDeploymentAndWait_Call { +func (_c *MockAppsInterface_DeployAndWait_Call) Return(_a0 *serving.AppDeployment, _a1 error) *MockAppsInterface_DeployAndWait_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockAppsInterface_CreateDeploymentAndWait_Call) RunAndReturn(run func(context.Context, serving.CreateAppDeploymentRequest, ...retries.Option[serving.AppDeployment]) (*serving.AppDeployment, error)) *MockAppsInterface_CreateDeploymentAndWait_Call { - _c.Call.Return(run) - return _c -} - -// Delete provides a mock function with given fields: ctx, request -func (_m *MockAppsInterface) Delete(ctx context.Context, request serving.DeleteAppRequest) error { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for Delete") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, serving.DeleteAppRequest) error); ok { - r0 = rf(ctx, request) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockAppsInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' -type MockAppsInterface_Delete_Call struct { - *mock.Call -} - -// Delete is a helper method to define mock.On call -// - ctx context.Context -// - request serving.DeleteAppRequest -func (_e *MockAppsInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockAppsInterface_Delete_Call { - return &MockAppsInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} -} - -func (_c *MockAppsInterface_Delete_Call) Run(run func(ctx context.Context, request serving.DeleteAppRequest)) *MockAppsInterface_Delete_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(serving.DeleteAppRequest)) - }) - return _c -} - -func (_c *MockAppsInterface_Delete_Call) Return(_a0 error) *MockAppsInterface_Delete_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockAppsInterface_Delete_Call) RunAndReturn(run func(context.Context, serving.DeleteAppRequest) error) *MockAppsInterface_Delete_Call { - _c.Call.Return(run) - return _c -} - -// DeleteByName provides a mock function with given fields: ctx, name -func (_m *MockAppsInterface) DeleteByName(ctx context.Context, name string) error { - ret := _m.Called(ctx, name) - - if len(ret) == 0 { - panic("no return value specified for DeleteByName") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { - r0 = rf(ctx, name) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockAppsInterface_DeleteByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteByName' -type MockAppsInterface_DeleteByName_Call struct { - *mock.Call -} - -// DeleteByName is a helper method to define mock.On call -// - ctx context.Context -// - name string -func (_e *MockAppsInterface_Expecter) DeleteByName(ctx interface{}, name interface{}) *MockAppsInterface_DeleteByName_Call { - return &MockAppsInterface_DeleteByName_Call{Call: _e.mock.On("DeleteByName", ctx, name)} -} - -func (_c *MockAppsInterface_DeleteByName_Call) Run(run func(ctx context.Context, name string)) *MockAppsInterface_DeleteByName_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) - }) - return _c -} - -func (_c *MockAppsInterface_DeleteByName_Call) Return(_a0 error) *MockAppsInterface_DeleteByName_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockAppsInterface_DeleteByName_Call) RunAndReturn(run func(context.Context, string) error) *MockAppsInterface_DeleteByName_Call { +func (_c *MockAppsInterface_DeployAndWait_Call) RunAndReturn(run func(context.Context, serving.CreateAppDeploymentRequest, ...retries.Option[serving.AppDeployment]) (*serving.AppDeployment, error)) *MockAppsInterface_DeployAndWait_Call { _c.Call.Return(run) return _c } diff --git a/service/catalog/api.go b/service/catalog/api.go index fb20a6ef4..fcfa5423b 100755 --- a/service/catalog/api.go +++ b/service/catalog/api.go @@ -431,31 +431,23 @@ type AccountStorageCredentialsInterface interface { // // Gets a list of all storage credentials that have been assigned to given // metastore. - List(ctx context.Context, request ListAccountStorageCredentialsRequest) ([]StorageCredentialInfo, error) - - // StorageCredentialInfoNameToIdMap calls [AccountStorageCredentialsAPI.List] and creates a map of results with [StorageCredentialInfo].Name as key and [StorageCredentialInfo].Id as value. - // - // Returns an error if there's more than one [StorageCredentialInfo] with the same .Name. - // - // Note: All [StorageCredentialInfo] instances are loaded into memory before creating a map. // // This method is generated by Databricks SDK Code Generator. - StorageCredentialInfoNameToIdMap(ctx context.Context, request ListAccountStorageCredentialsRequest) (map[string]string, error) + List(ctx context.Context, request ListAccountStorageCredentialsRequest) listing.Iterator[StorageCredentialInfo] - // GetByName calls [AccountStorageCredentialsAPI.StorageCredentialInfoNameToIdMap] and returns a single [StorageCredentialInfo]. - // - // Returns an error if there's more than one [StorageCredentialInfo] with the same .Name. + // Get all storage credentials assigned to a metastore. // - // Note: All [StorageCredentialInfo] instances are loaded into memory before returning matching by name. + // Gets a list of all storage credentials that have been assigned to given + // metastore. // // This method is generated by Databricks SDK Code Generator. - GetByName(ctx context.Context, name string) (*StorageCredentialInfo, error) + ListAll(ctx context.Context, request ListAccountStorageCredentialsRequest) ([]StorageCredentialInfo, error) // Get all storage credentials assigned to a metastore. // // Gets a list of all storage credentials that have been assigned to given // metastore. - ListByMetastoreId(ctx context.Context, metastoreId string) ([]StorageCredentialInfo, error) + ListByMetastoreId(ctx context.Context, metastoreId string) (*ListAccountStorageCredentialsResponse, error) // Updates a storage credential. // @@ -552,68 +544,42 @@ func (a *AccountStorageCredentialsAPI) GetByMetastoreIdAndStorageCredentialName( // // Gets a list of all storage credentials that have been assigned to given // metastore. -func (a *AccountStorageCredentialsAPI) List(ctx context.Context, request ListAccountStorageCredentialsRequest) ([]StorageCredentialInfo, error) { - return a.impl.List(ctx, request) -} - -// StorageCredentialInfoNameToIdMap calls [AccountStorageCredentialsAPI.List] and creates a map of results with [StorageCredentialInfo].Name as key and [StorageCredentialInfo].Id as value. -// -// Returns an error if there's more than one [StorageCredentialInfo] with the same .Name. -// -// Note: All [StorageCredentialInfo] instances are loaded into memory before creating a map. // // This method is generated by Databricks SDK Code Generator. -func (a *AccountStorageCredentialsAPI) StorageCredentialInfoNameToIdMap(ctx context.Context, request ListAccountStorageCredentialsRequest) (map[string]string, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") - mapping := map[string]string{} - result, err := a.List(ctx, request) - if err != nil { - return nil, err +func (a *AccountStorageCredentialsAPI) List(ctx context.Context, request ListAccountStorageCredentialsRequest) listing.Iterator[StorageCredentialInfo] { + + getNextPage := func(ctx context.Context, req ListAccountStorageCredentialsRequest) (*ListAccountStorageCredentialsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.impl.List(ctx, req) } - for _, v := range result { - key := v.Name - _, duplicate := mapping[key] - if duplicate { - return nil, fmt.Errorf("duplicate .Name: %s", key) - } - mapping[key] = v.Id + getItems := func(resp *ListAccountStorageCredentialsResponse) []StorageCredentialInfo { + return resp.StorageCredentials } - return mapping, nil + + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + nil) + return iterator } -// GetByName calls [AccountStorageCredentialsAPI.StorageCredentialInfoNameToIdMap] and returns a single [StorageCredentialInfo]. -// -// Returns an error if there's more than one [StorageCredentialInfo] with the same .Name. +// Get all storage credentials assigned to a metastore. // -// Note: All [StorageCredentialInfo] instances are loaded into memory before returning matching by name. +// Gets a list of all storage credentials that have been assigned to given +// metastore. // // This method is generated by Databricks SDK Code Generator. -func (a *AccountStorageCredentialsAPI) GetByName(ctx context.Context, name string) (*StorageCredentialInfo, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") - result, err := a.List(ctx, ListAccountStorageCredentialsRequest{}) - if err != nil { - return nil, err - } - tmp := map[string][]StorageCredentialInfo{} - for _, v := range result { - key := v.Name - tmp[key] = append(tmp[key], v) - } - alternatives, ok := tmp[name] - if !ok || len(alternatives) == 0 { - return nil, fmt.Errorf("StorageCredentialInfo named '%s' does not exist", name) - } - if len(alternatives) > 1 { - return nil, fmt.Errorf("there are %d instances of StorageCredentialInfo named '%s'", len(alternatives), name) - } - return &alternatives[0], nil +func (a *AccountStorageCredentialsAPI) ListAll(ctx context.Context, request ListAccountStorageCredentialsRequest) ([]StorageCredentialInfo, error) { + iterator := a.List(ctx, request) + return listing.ToSlice[StorageCredentialInfo](ctx, iterator) } // Get all storage credentials assigned to a metastore. // // Gets a list of all storage credentials that have been assigned to given // metastore. -func (a *AccountStorageCredentialsAPI) ListByMetastoreId(ctx context.Context, metastoreId string) ([]StorageCredentialInfo, error) { +func (a *AccountStorageCredentialsAPI) ListByMetastoreId(ctx context.Context, metastoreId string) (*ListAccountStorageCredentialsResponse, error) { return a.impl.List(ctx, ListAccountStorageCredentialsRequest{ MetastoreId: metastoreId, }) diff --git a/service/catalog/impl.go b/service/catalog/impl.go index b9e6905be..312d9522c 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -147,13 +147,13 @@ func (a *accountStorageCredentialsImpl) Get(ctx context.Context, request GetAcco return &accountsStorageCredentialInfo, err } -func (a *accountStorageCredentialsImpl) List(ctx context.Context, request ListAccountStorageCredentialsRequest) ([]StorageCredentialInfo, error) { - var storageCredentialInfoList []StorageCredentialInfo +func (a *accountStorageCredentialsImpl) List(ctx context.Context, request ListAccountStorageCredentialsRequest) (*ListAccountStorageCredentialsResponse, error) { + var listAccountStorageCredentialsResponse ListAccountStorageCredentialsResponse path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/storage-credentials", a.client.ConfiguredAccountID(), request.MetastoreId) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &storageCredentialInfoList) - return storageCredentialInfoList, err + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &listAccountStorageCredentialsResponse) + return &listAccountStorageCredentialsResponse, err } func (a *accountStorageCredentialsImpl) Update(ctx context.Context, request AccountsUpdateStorageCredential) (*AccountsStorageCredentialInfo, error) { diff --git a/service/catalog/interface.go b/service/catalog/interface.go index 170b8f656..f5c406a46 100755 --- a/service/catalog/interface.go +++ b/service/catalog/interface.go @@ -108,7 +108,9 @@ type AccountStorageCredentialsService interface { // // Gets a list of all storage credentials that have been assigned to given // metastore. - List(ctx context.Context, request ListAccountStorageCredentialsRequest) ([]StorageCredentialInfo, error) + // + // Use ListAll() to get all StorageCredentialInfo instances + List(ctx context.Context, request ListAccountStorageCredentialsRequest) (*ListAccountStorageCredentialsResponse, error) // Updates a storage credential. // diff --git a/service/catalog/model.go b/service/catalog/model.go index 6298e532b..8a25042f3 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -1179,22 +1179,50 @@ type DataSourceFormat string const DataSourceFormatAvro DataSourceFormat = `AVRO` +const DataSourceFormatBigqueryFormat DataSourceFormat = `BIGQUERY_FORMAT` + const DataSourceFormatCsv DataSourceFormat = `CSV` +const DataSourceFormatDatabricksFormat DataSourceFormat = `DATABRICKS_FORMAT` + const DataSourceFormatDelta DataSourceFormat = `DELTA` const DataSourceFormatDeltasharing DataSourceFormat = `DELTASHARING` +const DataSourceFormatHiveCustom DataSourceFormat = `HIVE_CUSTOM` + +const DataSourceFormatHiveSerde DataSourceFormat = `HIVE_SERDE` + const DataSourceFormatJson DataSourceFormat = `JSON` +const DataSourceFormatMysqlFormat DataSourceFormat = `MYSQL_FORMAT` + +const DataSourceFormatNetsuiteFormat DataSourceFormat = `NETSUITE_FORMAT` + const DataSourceFormatOrc DataSourceFormat = `ORC` const DataSourceFormatParquet DataSourceFormat = `PARQUET` +const DataSourceFormatPostgresqlFormat DataSourceFormat = `POSTGRESQL_FORMAT` + +const DataSourceFormatRedshiftFormat DataSourceFormat = `REDSHIFT_FORMAT` + +const DataSourceFormatSalesforceFormat DataSourceFormat = `SALESFORCE_FORMAT` + +const DataSourceFormatSnowflakeFormat DataSourceFormat = `SNOWFLAKE_FORMAT` + +const DataSourceFormatSqldwFormat DataSourceFormat = `SQLDW_FORMAT` + +const DataSourceFormatSqlserverFormat DataSourceFormat = `SQLSERVER_FORMAT` + const DataSourceFormatText DataSourceFormat = `TEXT` const DataSourceFormatUnityCatalog DataSourceFormat = `UNITY_CATALOG` +const DataSourceFormatVectorIndexFormat DataSourceFormat = `VECTOR_INDEX_FORMAT` + +const DataSourceFormatWorkdayRaasFormat DataSourceFormat = `WORKDAY_RAAS_FORMAT` + // String representation for [fmt.Print] func (f *DataSourceFormat) String() string { return string(*f) @@ -1203,11 +1231,11 @@ func (f *DataSourceFormat) String() string { // Set raw string value and validate it against allowed values func (f *DataSourceFormat) Set(v string) error { switch v { - case `AVRO`, `CSV`, `DELTA`, `DELTASHARING`, `JSON`, `ORC`, `PARQUET`, `TEXT`, `UNITY_CATALOG`: + case `AVRO`, `BIGQUERY_FORMAT`, `CSV`, `DATABRICKS_FORMAT`, `DELTA`, `DELTASHARING`, `HIVE_CUSTOM`, `HIVE_SERDE`, `JSON`, `MYSQL_FORMAT`, `NETSUITE_FORMAT`, `ORC`, `PARQUET`, `POSTGRESQL_FORMAT`, `REDSHIFT_FORMAT`, `SALESFORCE_FORMAT`, `SNOWFLAKE_FORMAT`, `SQLDW_FORMAT`, `SQLSERVER_FORMAT`, `TEXT`, `UNITY_CATALOG`, `VECTOR_INDEX_FORMAT`, `WORKDAY_RAAS_FORMAT`: *f = DataSourceFormat(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "AVRO", "CSV", "DELTA", "DELTASHARING", "JSON", "ORC", "PARQUET", "TEXT", "UNITY_CATALOG"`, v) + return fmt.Errorf(`value "%s" is not one of "AVRO", "BIGQUERY_FORMAT", "CSV", "DATABRICKS_FORMAT", "DELTA", "DELTASHARING", "HIVE_CUSTOM", "HIVE_SERDE", "JSON", "MYSQL_FORMAT", "NETSUITE_FORMAT", "ORC", "PARQUET", "POSTGRESQL_FORMAT", "REDSHIFT_FORMAT", "SALESFORCE_FORMAT", "SNOWFLAKE_FORMAT", "SQLDW_FORMAT", "SQLSERVER_FORMAT", "TEXT", "UNITY_CATALOG", "VECTOR_INDEX_FORMAT", "WORKDAY_RAAS_FORMAT"`, v) } } @@ -2408,6 +2436,11 @@ type ListAccountStorageCredentialsRequest struct { MetastoreId string `json:"-" url:"-"` } +type ListAccountStorageCredentialsResponse struct { + // An array of metastore storage credentials. + StorageCredentials []StorageCredentialInfo `json:"storage_credentials,omitempty"` +} + // List catalogs type ListCatalogsRequest struct { // Whether to include catalogs in the response for which the principal can @@ -4474,8 +4507,14 @@ type TableType string const TableTypeExternal TableType = `EXTERNAL` +const TableTypeExternalShallowClone TableType = `EXTERNAL_SHALLOW_CLONE` + +const TableTypeForeign TableType = `FOREIGN` + const TableTypeManaged TableType = `MANAGED` +const TableTypeManagedShallowClone TableType = `MANAGED_SHALLOW_CLONE` + const TableTypeMaterializedView TableType = `MATERIALIZED_VIEW` const TableTypeStreamingTable TableType = `STREAMING_TABLE` @@ -4490,11 +4529,11 @@ func (f *TableType) String() string { // Set raw string value and validate it against allowed values func (f *TableType) Set(v string) error { switch v { - case `EXTERNAL`, `MANAGED`, `MATERIALIZED_VIEW`, `STREAMING_TABLE`, `VIEW`: + case `EXTERNAL`, `EXTERNAL_SHALLOW_CLONE`, `FOREIGN`, `MANAGED`, `MANAGED_SHALLOW_CLONE`, `MATERIALIZED_VIEW`, `STREAMING_TABLE`, `VIEW`: *f = TableType(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "EXTERNAL", "MANAGED", "MATERIALIZED_VIEW", "STREAMING_TABLE", "VIEW"`, v) + return fmt.Errorf(`value "%s" is not one of "EXTERNAL", "EXTERNAL_SHALLOW_CLONE", "FOREIGN", "MANAGED", "MANAGED_SHALLOW_CLONE", "MATERIALIZED_VIEW", "STREAMING_TABLE", "VIEW"`, v) } } diff --git a/service/compute/model.go b/service/compute/model.go index f849f7998..354002147 100755 --- a/service/compute/model.go +++ b/service/compute/model.go @@ -455,7 +455,8 @@ type ClusterAttributes struct { // ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating // from legacy Passthrough on high concurrency clusters. * // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy - // Passthrough on standard clusters. + // Passthrough on standard clusters. * `LEGACY_SINGLE_USER_STANDARD`: This + // mode provides a way that doesn’t have UC nor passthrough enabled. DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` DockerImage *DockerImage `json:"docker_image,omitempty"` @@ -613,7 +614,8 @@ type ClusterDetails struct { // ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating // from legacy Passthrough on high concurrency clusters. * // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy - // Passthrough on standard clusters. + // Passthrough on standard clusters. * `LEGACY_SINGLE_USER_STANDARD`: This + // mode provides a way that doesn’t have UC nor passthrough enabled. DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` // Tags that are added by Databricks regardless of any `custom_tags`, // including: @@ -1156,7 +1158,8 @@ type ClusterSpec struct { // ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating // from legacy Passthrough on high concurrency clusters. * // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy - // Passthrough on standard clusters. + // Passthrough on standard clusters. * `LEGACY_SINGLE_USER_STANDARD`: This + // mode provides a way that doesn’t have UC nor passthrough enabled. DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` DockerImage *DockerImage `json:"docker_image,omitempty"` @@ -1455,7 +1458,8 @@ type CreateCluster struct { // ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating // from legacy Passthrough on high concurrency clusters. * // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy - // Passthrough on standard clusters. + // Passthrough on standard clusters. * `LEGACY_SINGLE_USER_STANDARD`: This + // mode provides a way that doesn’t have UC nor passthrough enabled. DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` DockerImage *DockerImage `json:"docker_image,omitempty"` @@ -1821,7 +1825,9 @@ func (f *DataPlaneEventDetailsEventType) Type() string { // * `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table ACL // clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating from // legacy Passthrough on high concurrency clusters. * `LEGACY_SINGLE_USER`: This -// mode is for users migrating from legacy Passthrough on standard clusters. +// mode is for users migrating from legacy Passthrough on standard clusters. * +// `LEGACY_SINGLE_USER_STANDARD`: This mode provides a way that doesn’t have +// UC nor passthrough enabled. type DataSecurityMode string // This mode is for users migrating from legacy Passthrough on high concurrency @@ -1832,6 +1838,9 @@ const DataSecurityModeLegacyPassthrough DataSecurityMode = `LEGACY_PASSTHROUGH` // clusters. const DataSecurityModeLegacySingleUser DataSecurityMode = `LEGACY_SINGLE_USER` +// This mode provides a way that doesn’t have UC nor passthrough enabled. +const DataSecurityModeLegacySingleUserStandard DataSecurityMode = `LEGACY_SINGLE_USER_STANDARD` + // This mode is for users migrating from legacy Table ACL clusters. const DataSecurityModeLegacyTableAcl DataSecurityMode = `LEGACY_TABLE_ACL` @@ -1858,11 +1867,11 @@ func (f *DataSecurityMode) String() string { // Set raw string value and validate it against allowed values func (f *DataSecurityMode) Set(v string) error { switch v { - case `LEGACY_PASSTHROUGH`, `LEGACY_SINGLE_USER`, `LEGACY_TABLE_ACL`, `NONE`, `SINGLE_USER`, `USER_ISOLATION`: + case `LEGACY_PASSTHROUGH`, `LEGACY_SINGLE_USER`, `LEGACY_SINGLE_USER_STANDARD`, `LEGACY_TABLE_ACL`, `NONE`, `SINGLE_USER`, `USER_ISOLATION`: *f = DataSecurityMode(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "LEGACY_PASSTHROUGH", "LEGACY_SINGLE_USER", "LEGACY_TABLE_ACL", "NONE", "SINGLE_USER", "USER_ISOLATION"`, v) + return fmt.Errorf(`value "%s" is not one of "LEGACY_PASSTHROUGH", "LEGACY_SINGLE_USER", "LEGACY_SINGLE_USER_STANDARD", "LEGACY_TABLE_ACL", "NONE", "SINGLE_USER", "USER_ISOLATION"`, v) } } @@ -2146,7 +2155,8 @@ type EditCluster struct { // ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating // from legacy Passthrough on high concurrency clusters. * // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy - // Passthrough on standard clusters. + // Passthrough on standard clusters. * `LEGACY_SINGLE_USER_STANDARD`: This + // mode provides a way that doesn’t have UC nor passthrough enabled. DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` DockerImage *DockerImage `json:"docker_image,omitempty"` diff --git a/service/jobs/model.go b/service/jobs/model.go index 5fc900323..3981a1f18 100755 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -650,6 +650,8 @@ type ForEachTaskErrorMessageStats struct { Count int `json:"count,omitempty"` // Describes the error message occured during the iterations. ErrorMessage string `json:"error_message,omitempty"` + // Describes the termination reason for the error message. + TerminationCategory string `json:"termination_category,omitempty"` ForceSendFields []string `json:"-"` } diff --git a/service/marketplace/api.go b/service/marketplace/api.go index d6ea7e048..818448571 100755 --- a/service/marketplace/api.go +++ b/service/marketplace/api.go @@ -440,6 +440,12 @@ type ConsumerListingsInterface interface { // Deprecated: use MockConsumerListingsInterface instead. Impl() ConsumerListingsService + // Get one batch of listings. One may specify up to 50 IDs per request. + // + // Batch get a published listing in the Databricks Marketplace that the consumer + // has access to. + BatchGet(ctx context.Context, request BatchGetListingsRequest) (*BatchGetListingsResponse, error) + // Get listing. // // Get a published listing in the Databricks Marketplace that the consumer has @@ -535,6 +541,14 @@ func (a *ConsumerListingsAPI) Impl() ConsumerListingsService { return a.impl } +// Get one batch of listings. One may specify up to 50 IDs per request. +// +// Batch get a published listing in the Databricks Marketplace that the consumer +// has access to. +func (a *ConsumerListingsAPI) BatchGet(ctx context.Context, request BatchGetListingsRequest) (*BatchGetListingsResponse, error) { + return a.impl.BatchGet(ctx, request) +} + // Get listing. // // Get a published listing in the Databricks Marketplace that the consumer has @@ -836,6 +850,12 @@ type ConsumerProvidersInterface interface { // Deprecated: use MockConsumerProvidersInterface instead. Impl() ConsumerProvidersService + // Get one batch of providers. One may specify up to 50 IDs per request. + // + // Batch get a provider in the Databricks Marketplace with at least one visible + // listing. + BatchGet(ctx context.Context, request BatchGetProvidersRequest) (*BatchGetProvidersResponse, error) + // Get a provider. // // Get a provider in the Databricks Marketplace with at least one visible @@ -912,6 +932,14 @@ func (a *ConsumerProvidersAPI) Impl() ConsumerProvidersService { return a.impl } +// Get one batch of providers. One may specify up to 50 IDs per request. +// +// Batch get a provider in the Databricks Marketplace with at least one visible +// listing. +func (a *ConsumerProvidersAPI) BatchGet(ctx context.Context, request BatchGetProvidersRequest) (*BatchGetProvidersResponse, error) { + return a.impl.BatchGet(ctx, request) +} + // Get a provider. // // Get a provider in the Databricks Marketplace with at least one visible diff --git a/service/marketplace/impl.go b/service/marketplace/impl.go index a9c85828e..81072eec0 100755 --- a/service/marketplace/impl.go +++ b/service/marketplace/impl.go @@ -90,6 +90,15 @@ type consumerListingsImpl struct { client *client.DatabricksClient } +func (a *consumerListingsImpl) BatchGet(ctx context.Context, request BatchGetListingsRequest) (*BatchGetListingsResponse, error) { + var batchGetListingsResponse BatchGetListingsResponse + path := "/api/2.1/marketplace-consumer/listings:batchGet" + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &batchGetListingsResponse) + return &batchGetListingsResponse, err +} + func (a *consumerListingsImpl) Get(ctx context.Context, request GetListingRequest) (*GetListingResponse, error) { var getListingResponse GetListingResponse path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v", request.Id) @@ -155,6 +164,15 @@ type consumerProvidersImpl struct { client *client.DatabricksClient } +func (a *consumerProvidersImpl) BatchGet(ctx context.Context, request BatchGetProvidersRequest) (*BatchGetProvidersResponse, error) { + var batchGetProvidersResponse BatchGetProvidersResponse + path := "/api/2.1/marketplace-consumer/providers:batchGet" + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &batchGetProvidersResponse) + return &batchGetProvidersResponse, err +} + func (a *consumerProvidersImpl) Get(ctx context.Context, request GetProviderRequest) (*GetProviderResponse, error) { var getProviderResponse GetProviderResponse path := fmt.Sprintf("/api/2.1/marketplace-consumer/providers/%v", request.Id) diff --git a/service/marketplace/interface.go b/service/marketplace/interface.go index 51263c1e9..ca7e60b7c 100755 --- a/service/marketplace/interface.go +++ b/service/marketplace/interface.go @@ -72,6 +72,12 @@ type ConsumerInstallationsService interface { // products that are available for consumption. type ConsumerListingsService interface { + // Get one batch of listings. One may specify up to 50 IDs per request. + // + // Batch get a published listing in the Databricks Marketplace that the + // consumer has access to. + BatchGet(ctx context.Context, request BatchGetListingsRequest) (*BatchGetListingsResponse, error) + // Get listing. // // Get a published listing in the Databricks Marketplace that the consumer @@ -122,6 +128,12 @@ type ConsumerPersonalizationRequestsService interface { // Providers are the entities that publish listings to the Marketplace. type ConsumerProvidersService interface { + // Get one batch of providers. One may specify up to 50 IDs per request. + // + // Batch get a provider in the Databricks Marketplace with at least one + // visible listing. + BatchGet(ctx context.Context, request BatchGetProvidersRequest) (*BatchGetProvidersResponse, error) + // Get a provider. // // Get a provider in the Databricks Marketplace with at least one visible diff --git a/service/marketplace/model.go b/service/marketplace/model.go index 5c1045d5d..efc78aa57 100755 --- a/service/marketplace/model.go +++ b/service/marketplace/model.go @@ -53,6 +53,24 @@ func (f *AssetType) Type() string { return "AssetType" } +// Get one batch of listings. One may specify up to 50 IDs per request. +type BatchGetListingsRequest struct { + Ids []string `json:"-" url:"ids,omitempty"` +} + +type BatchGetListingsResponse struct { + Listings []Listing `json:"listings,omitempty"` +} + +// Get one batch of providers. One may specify up to 50 IDs per request. +type BatchGetProvidersRequest struct { + Ids []string `json:"-" url:"ids,omitempty"` +} + +type BatchGetProvidersResponse struct { + Providers []ProviderInfo `json:"providers,omitempty"` +} + type Category string const CategoryAdvertisingAndMarketing Category = `ADVERTISING_AND_MARKETING` diff --git a/service/oauth2/model.go b/service/oauth2/model.go index defc930e2..b313af902 100755 --- a/service/oauth2/model.go +++ b/service/oauth2/model.go @@ -114,6 +114,23 @@ func (s CreateServicePrincipalSecretResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type DataPlaneInfo struct { + // Authorization details as a string. + AuthorizationDetails string `json:"authorization_details,omitempty"` + // The URL of the endpoint for this operation in the dataplane. + EndpointUrl string `json:"endpoint_url,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *DataPlaneInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DataPlaneInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type DeleteCustomAppIntegrationOutput struct { } diff --git a/service/serving/api.go b/service/serving/api.go index 2771bdba0..64e30bc0d 100755 --- a/service/serving/api.go +++ b/service/serving/api.go @@ -32,7 +32,7 @@ type AppsInterface interface { WaitGetDeploymentAppSucceeded(ctx context.Context, appName string, deploymentId string, timeout time.Duration, callback func(*AppDeployment)) (*AppDeployment, error) - // Create an App. + // Create an app. // // Creates a new app. Create(ctx context.Context, createAppRequest CreateAppRequest) (*WaitGetAppIdle[App], error) @@ -45,100 +45,100 @@ type AppsInterface interface { // Deprecated: use [AppsAPIInterface.Create].Get() or [AppsAPIInterface.WaitGetAppIdle] CreateAndWait(ctx context.Context, createAppRequest CreateAppRequest, options ...retries.Option[App]) (*App, error) - // Create an App Deployment. - // - // Creates an app deployment for the app with the supplied name. - CreateDeployment(ctx context.Context, createAppDeploymentRequest CreateAppDeploymentRequest) (*WaitGetDeploymentAppSucceeded[AppDeployment], error) - - // Calls [AppsAPIInterface.CreateDeployment] and waits to reach SUCCEEDED state - // - // You can override the default timeout of 20 minutes by calling adding - // retries.Timeout[AppDeployment](60*time.Minute) functional option. - // - // Deprecated: use [AppsAPIInterface.CreateDeployment].Get() or [AppsAPIInterface.WaitGetDeploymentAppSucceeded] - CreateDeploymentAndWait(ctx context.Context, createAppDeploymentRequest CreateAppDeploymentRequest, options ...retries.Option[AppDeployment]) (*AppDeployment, error) - - // Delete an App. + // Delete an app. // // Deletes an app. Delete(ctx context.Context, request DeleteAppRequest) error - // Delete an App. + // Delete an app. // // Deletes an app. DeleteByName(ctx context.Context, name string) error - // Get an App. + // Create an app deployment. + // + // Creates an app deployment for the app with the supplied name. + Deploy(ctx context.Context, createAppDeploymentRequest CreateAppDeploymentRequest) (*WaitGetDeploymentAppSucceeded[AppDeployment], error) + + // Calls [AppsAPIInterface.Deploy] and waits to reach SUCCEEDED state + // + // You can override the default timeout of 20 minutes by calling adding + // retries.Timeout[AppDeployment](60*time.Minute) functional option. + // + // Deprecated: use [AppsAPIInterface.Deploy].Get() or [AppsAPIInterface.WaitGetDeploymentAppSucceeded] + DeployAndWait(ctx context.Context, createAppDeploymentRequest CreateAppDeploymentRequest, options ...retries.Option[AppDeployment]) (*AppDeployment, error) + + // Get an app. // // Retrieves information for the app with the supplied name. Get(ctx context.Context, request GetAppRequest) (*App, error) - // Get an App. + // Get an app. // // Retrieves information for the app with the supplied name. GetByName(ctx context.Context, name string) (*App, error) - // Get an App Deployment. + // Get an app deployment. // // Retrieves information for the app deployment with the supplied name and // deployment id. GetDeployment(ctx context.Context, request GetAppDeploymentRequest) (*AppDeployment, error) - // Get an App Deployment. + // Get an app deployment. // // Retrieves information for the app deployment with the supplied name and // deployment id. GetDeploymentByAppNameAndDeploymentId(ctx context.Context, appName string, deploymentId string) (*AppDeployment, error) - // Get App Environment. + // Get app environment. // // Retrieves app environment. GetEnvironment(ctx context.Context, request GetAppEnvironmentRequest) (*AppEnvironment, error) - // Get App Environment. + // Get app environment. // // Retrieves app environment. GetEnvironmentByName(ctx context.Context, name string) (*AppEnvironment, error) - // List Apps. + // List apps. // // Lists all apps in the workspace. // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListAppsRequest) listing.Iterator[App] - // List Apps. + // List apps. // // Lists all apps in the workspace. // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListAppsRequest) ([]App, error) - // List App Deployments. + // List app deployments. // // Lists all app deployments for the app with the supplied name. // // This method is generated by Databricks SDK Code Generator. ListDeployments(ctx context.Context, request ListAppDeploymentsRequest) listing.Iterator[AppDeployment] - // List App Deployments. + // List app deployments. // // Lists all app deployments for the app with the supplied name. // // This method is generated by Databricks SDK Code Generator. ListDeploymentsAll(ctx context.Context, request ListAppDeploymentsRequest) ([]AppDeployment, error) - // List App Deployments. + // List app deployments. // // Lists all app deployments for the app with the supplied name. ListDeploymentsByAppName(ctx context.Context, appName string) (*ListAppDeploymentsResponse, error) - // Stop an App. + // Stop an app. // // Stops the active deployment of the app in the workspace. Stop(ctx context.Context, request StopAppRequest) error - // Update an App. + // Update an app. // // Updates the app with the supplied name. Update(ctx context.Context, request UpdateAppRequest) (*App, error) @@ -291,7 +291,7 @@ func (w *WaitGetDeploymentAppSucceeded[R]) GetWithTimeout(timeout time.Duration) return w.Poll(timeout, w.callback) } -// Create an App. +// Create an app. // // Creates a new app. func (a *AppsAPI) Create(ctx context.Context, createAppRequest CreateAppRequest) (*WaitGetAppIdle[App], error) { @@ -337,11 +337,27 @@ func (a *AppsAPI) CreateAndWait(ctx context.Context, createAppRequest CreateAppR return wait.Get() } -// Create an App Deployment. +// Delete an app. +// +// Deletes an app. +func (a *AppsAPI) Delete(ctx context.Context, request DeleteAppRequest) error { + return a.impl.Delete(ctx, request) +} + +// Delete an app. +// +// Deletes an app. +func (a *AppsAPI) DeleteByName(ctx context.Context, name string) error { + return a.impl.Delete(ctx, DeleteAppRequest{ + Name: name, + }) +} + +// Create an app deployment. // // Creates an app deployment for the app with the supplied name. -func (a *AppsAPI) CreateDeployment(ctx context.Context, createAppDeploymentRequest CreateAppDeploymentRequest) (*WaitGetDeploymentAppSucceeded[AppDeployment], error) { - appDeployment, err := a.impl.CreateDeployment(ctx, createAppDeploymentRequest) +func (a *AppsAPI) Deploy(ctx context.Context, createAppDeploymentRequest CreateAppDeploymentRequest) (*WaitGetDeploymentAppSucceeded[AppDeployment], error) { + appDeployment, err := a.impl.Deploy(ctx, createAppDeploymentRequest) if err != nil { return nil, err } @@ -357,14 +373,14 @@ func (a *AppsAPI) CreateDeployment(ctx context.Context, createAppDeploymentReque }, nil } -// Calls [AppsAPI.CreateDeployment] and waits to reach SUCCEEDED state +// Calls [AppsAPI.Deploy] and waits to reach SUCCEEDED state // // You can override the default timeout of 20 minutes by calling adding // retries.Timeout[AppDeployment](60*time.Minute) functional option. // -// Deprecated: use [AppsAPI.CreateDeployment].Get() or [AppsAPI.WaitGetDeploymentAppSucceeded] -func (a *AppsAPI) CreateDeploymentAndWait(ctx context.Context, createAppDeploymentRequest CreateAppDeploymentRequest, options ...retries.Option[AppDeployment]) (*AppDeployment, error) { - wait, err := a.CreateDeployment(ctx, createAppDeploymentRequest) +// Deprecated: use [AppsAPI.Deploy].Get() or [AppsAPI.WaitGetDeploymentAppSucceeded] +func (a *AppsAPI) DeployAndWait(ctx context.Context, createAppDeploymentRequest CreateAppDeploymentRequest, options ...retries.Option[AppDeployment]) (*AppDeployment, error) { + wait, err := a.Deploy(ctx, createAppDeploymentRequest) if err != nil { return nil, err } @@ -384,30 +400,14 @@ func (a *AppsAPI) CreateDeploymentAndWait(ctx context.Context, createAppDeployme return wait.Get() } -// Delete an App. -// -// Deletes an app. -func (a *AppsAPI) Delete(ctx context.Context, request DeleteAppRequest) error { - return a.impl.Delete(ctx, request) -} - -// Delete an App. -// -// Deletes an app. -func (a *AppsAPI) DeleteByName(ctx context.Context, name string) error { - return a.impl.Delete(ctx, DeleteAppRequest{ - Name: name, - }) -} - -// Get an App. +// Get an app. // // Retrieves information for the app with the supplied name. func (a *AppsAPI) Get(ctx context.Context, request GetAppRequest) (*App, error) { return a.impl.Get(ctx, request) } -// Get an App. +// Get an app. // // Retrieves information for the app with the supplied name. func (a *AppsAPI) GetByName(ctx context.Context, name string) (*App, error) { @@ -416,7 +416,7 @@ func (a *AppsAPI) GetByName(ctx context.Context, name string) (*App, error) { }) } -// Get an App Deployment. +// Get an app deployment. // // Retrieves information for the app deployment with the supplied name and // deployment id. @@ -424,7 +424,7 @@ func (a *AppsAPI) GetDeployment(ctx context.Context, request GetAppDeploymentReq return a.impl.GetDeployment(ctx, request) } -// Get an App Deployment. +// Get an app deployment. // // Retrieves information for the app deployment with the supplied name and // deployment id. @@ -435,14 +435,14 @@ func (a *AppsAPI) GetDeploymentByAppNameAndDeploymentId(ctx context.Context, app }) } -// Get App Environment. +// Get app environment. // // Retrieves app environment. func (a *AppsAPI) GetEnvironment(ctx context.Context, request GetAppEnvironmentRequest) (*AppEnvironment, error) { return a.impl.GetEnvironment(ctx, request) } -// Get App Environment. +// Get app environment. // // Retrieves app environment. func (a *AppsAPI) GetEnvironmentByName(ctx context.Context, name string) (*AppEnvironment, error) { @@ -451,7 +451,7 @@ func (a *AppsAPI) GetEnvironmentByName(ctx context.Context, name string) (*AppEn }) } -// List Apps. +// List apps. // // Lists all apps in the workspace. // @@ -480,7 +480,7 @@ func (a *AppsAPI) List(ctx context.Context, request ListAppsRequest) listing.Ite return iterator } -// List Apps. +// List apps. // // Lists all apps in the workspace. // @@ -490,7 +490,7 @@ func (a *AppsAPI) ListAll(ctx context.Context, request ListAppsRequest) ([]App, return listing.ToSlice[App](ctx, iterator) } -// List App Deployments. +// List app deployments. // // Lists all app deployments for the app with the supplied name. // @@ -519,7 +519,7 @@ func (a *AppsAPI) ListDeployments(ctx context.Context, request ListAppDeployment return iterator } -// List App Deployments. +// List app deployments. // // Lists all app deployments for the app with the supplied name. // @@ -529,7 +529,7 @@ func (a *AppsAPI) ListDeploymentsAll(ctx context.Context, request ListAppDeploym return listing.ToSlice[AppDeployment](ctx, iterator) } -// List App Deployments. +// List app deployments. // // Lists all app deployments for the app with the supplied name. func (a *AppsAPI) ListDeploymentsByAppName(ctx context.Context, appName string) (*ListAppDeploymentsResponse, error) { @@ -538,14 +538,14 @@ func (a *AppsAPI) ListDeploymentsByAppName(ctx context.Context, appName string) }) } -// Stop an App. +// Stop an app. // // Stops the active deployment of the app in the workspace. func (a *AppsAPI) Stop(ctx context.Context, request StopAppRequest) error { return a.impl.Stop(ctx, request) } -// Update an App. +// Update an app. // // Updates the app with the supplied name. func (a *AppsAPI) Update(ctx context.Context, request UpdateAppRequest) (*App, error) { diff --git a/service/serving/impl.go b/service/serving/impl.go index bbaee1b8f..c267d2002 100755 --- a/service/serving/impl.go +++ b/service/serving/impl.go @@ -25,16 +25,6 @@ func (a *appsImpl) Create(ctx context.Context, request CreateAppRequest) (*App, return &app, err } -func (a *appsImpl) CreateDeployment(ctx context.Context, request CreateAppDeploymentRequest) (*AppDeployment, error) { - var appDeployment AppDeployment - path := fmt.Sprintf("/api/2.0/preview/apps/%v/deployments", request.AppName) - headers := make(map[string]string) - headers["Accept"] = "application/json" - headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPost, path, headers, request, &appDeployment) - return &appDeployment, err -} - func (a *appsImpl) Delete(ctx context.Context, request DeleteAppRequest) error { var deleteResponse DeleteResponse path := fmt.Sprintf("/api/2.0/preview/apps/%v", request.Name) @@ -44,6 +34,16 @@ func (a *appsImpl) Delete(ctx context.Context, request DeleteAppRequest) error { return err } +func (a *appsImpl) Deploy(ctx context.Context, request CreateAppDeploymentRequest) (*AppDeployment, error) { + var appDeployment AppDeployment + path := fmt.Sprintf("/api/2.0/preview/apps/%v/deployments", request.AppName) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, request, &appDeployment) + return &appDeployment, err +} + func (a *appsImpl) Get(ctx context.Context, request GetAppRequest) (*App, error) { var app App path := fmt.Sprintf("/api/2.0/preview/apps/%v", request.Name) diff --git a/service/serving/interface.go b/service/serving/interface.go index 6ee7f076f..61350c543 100755 --- a/service/serving/interface.go +++ b/service/serving/interface.go @@ -11,57 +11,57 @@ import ( // through single sign-on. type AppsService interface { - // Create an App. + // Create an app. // // Creates a new app. Create(ctx context.Context, request CreateAppRequest) (*App, error) - // Create an App Deployment. - // - // Creates an app deployment for the app with the supplied name. - CreateDeployment(ctx context.Context, request CreateAppDeploymentRequest) (*AppDeployment, error) - - // Delete an App. + // Delete an app. // // Deletes an app. Delete(ctx context.Context, request DeleteAppRequest) error - // Get an App. + // Create an app deployment. + // + // Creates an app deployment for the app with the supplied name. + Deploy(ctx context.Context, request CreateAppDeploymentRequest) (*AppDeployment, error) + + // Get an app. // // Retrieves information for the app with the supplied name. Get(ctx context.Context, request GetAppRequest) (*App, error) - // Get an App Deployment. + // Get an app deployment. // // Retrieves information for the app deployment with the supplied name and // deployment id. GetDeployment(ctx context.Context, request GetAppDeploymentRequest) (*AppDeployment, error) - // Get App Environment. + // Get app environment. // // Retrieves app environment. GetEnvironment(ctx context.Context, request GetAppEnvironmentRequest) (*AppEnvironment, error) - // List Apps. + // List apps. // // Lists all apps in the workspace. // // Use ListAll() to get all App instances, which will iterate over every result page. List(ctx context.Context, request ListAppsRequest) (*ListAppsResponse, error) - // List App Deployments. + // List app deployments. // // Lists all app deployments for the app with the supplied name. // // Use ListDeploymentsAll() to get all AppDeployment instances, which will iterate over every result page. ListDeployments(ctx context.Context, request ListAppDeploymentsRequest) (*ListAppDeploymentsResponse, error) - // Stop an App. + // Stop an app. // // Stops the active deployment of the app in the workspace. Stop(ctx context.Context, request StopAppRequest) error - // Update an App. + // Update an app. // // Updates the app with the supplied name. Update(ctx context.Context, request UpdateAppRequest) (*App, error) diff --git a/service/serving/model.go b/service/serving/model.go index 410e4e8ab..72d976efb 100755 --- a/service/serving/model.go +++ b/service/serving/model.go @@ -7,6 +7,7 @@ import ( "io" "github.com/databricks/databricks-sdk-go/marshal" + "github.com/databricks/databricks-sdk-go/service/oauth2" ) type Ai21LabsConfig struct { @@ -77,8 +78,7 @@ type App struct { // The description of the app. Description string `json:"description,omitempty"` // The name of the app. The name must contain only lowercase alphanumeric - // characters and hyphens and be between 2 and 30 characters long. It must - // be unique within the workspace. + // characters and hyphens. It must be unique within the workspace. Name string `json:"name"` // The pending deployment of the app. PendingDeployment *AppDeployment `json:"pending_deployment,omitempty"` @@ -111,7 +111,15 @@ type AppDeployment struct { DeploymentArtifacts *AppDeploymentArtifacts `json:"deployment_artifacts,omitempty"` // The unique id of the deployment. DeploymentId string `json:"deployment_id,omitempty"` - // The source code path of the deployment. + // The mode of which the deployment will manage the source code. + Mode AppDeploymentMode `json:"mode"` + // The workspace file system path of the source code used to create the app + // deployment. This is different from + // `deployment_artifacts.source_code_path`, which is the path used by the + // deployed app. The former refers to the original source code location of + // the app in the workspace during deployment creation, whereas the latter + // provides a system generated stable snapshotted source code path used by + // the deployment. SourceCodePath string `json:"source_code_path"` // Status and status message of the deployment Status *AppDeploymentStatus `json:"status,omitempty"` @@ -130,7 +138,8 @@ func (s AppDeployment) MarshalJSON() ([]byte, error) { } type AppDeploymentArtifacts struct { - // The source code of the deployment. + // The snapshotted workspace file system path of the source code loaded by + // the deployed app. SourceCodePath string `json:"source_code_path,omitempty"` ForceSendFields []string `json:"-"` @@ -144,9 +153,36 @@ func (s AppDeploymentArtifacts) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -type AppDeploymentState string +type AppDeploymentMode string + +const AppDeploymentModeAutoSync AppDeploymentMode = `AUTO_SYNC` + +const AppDeploymentModeModeUnspecified AppDeploymentMode = `MODE_UNSPECIFIED` + +const AppDeploymentModeSnapshot AppDeploymentMode = `SNAPSHOT` + +// String representation for [fmt.Print] +func (f *AppDeploymentMode) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppDeploymentMode) Set(v string) error { + switch v { + case `AUTO_SYNC`, `MODE_UNSPECIFIED`, `SNAPSHOT`: + *f = AppDeploymentMode(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "AUTO_SYNC", "MODE_UNSPECIFIED", "SNAPSHOT"`, v) + } +} -const AppDeploymentStateCancelled AppDeploymentState = `CANCELLED` +// Type always returns AppDeploymentMode to satisfy [pflag.Value] interface +func (f *AppDeploymentMode) Type() string { + return "AppDeploymentMode" +} + +type AppDeploymentState string const AppDeploymentStateFailed AppDeploymentState = `FAILED` @@ -166,11 +202,11 @@ func (f *AppDeploymentState) String() string { // Set raw string value and validate it against allowed values func (f *AppDeploymentState) Set(v string) error { switch v { - case `CANCELLED`, `FAILED`, `IN_PROGRESS`, `STATE_UNSPECIFIED`, `STOPPED`, `SUCCEEDED`: + case `FAILED`, `IN_PROGRESS`, `STATE_UNSPECIFIED`, `STOPPED`, `SUCCEEDED`: *f = AppDeploymentState(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "CANCELLED", "FAILED", "IN_PROGRESS", "STATE_UNSPECIFIED", "STOPPED", "SUCCEEDED"`, v) + return fmt.Errorf(`value "%s" is not one of "FAILED", "IN_PROGRESS", "STATE_UNSPECIFIED", "STOPPED", "SUCCEEDED"`, v) } } @@ -208,24 +244,16 @@ const AppStateDeleted AppState = `DELETED` const AppStateDeleting AppState = `DELETING` -const AppStateDeployed AppState = `DEPLOYED` - -const AppStateDeploying AppState = `DEPLOYING` - const AppStateError AppState = `ERROR` const AppStateIdle AppState = `IDLE` -const AppStateReady AppState = `READY` - const AppStateRunning AppState = `RUNNING` const AppStateStarting AppState = `STARTING` const AppStateStateUnspecified AppState = `STATE_UNSPECIFIED` -const AppStateUpdating AppState = `UPDATING` - // String representation for [fmt.Print] func (f *AppState) String() string { return string(*f) @@ -234,11 +262,11 @@ func (f *AppState) String() string { // Set raw string value and validate it against allowed values func (f *AppState) Set(v string) error { switch v { - case `CREATING`, `DELETED`, `DELETING`, `DEPLOYED`, `DEPLOYING`, `ERROR`, `IDLE`, `READY`, `RUNNING`, `STARTING`, `STATE_UNSPECIFIED`, `UPDATING`: + case `CREATING`, `DELETED`, `DELETING`, `ERROR`, `IDLE`, `RUNNING`, `STARTING`, `STATE_UNSPECIFIED`: *f = AppState(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "CREATING", "DELETED", "DELETING", "DEPLOYED", "DEPLOYING", "ERROR", "IDLE", "READY", "RUNNING", "STARTING", "STATE_UNSPECIFIED", "UPDATING"`, v) + return fmt.Errorf(`value "%s" is not one of "CREATING", "DELETED", "DELETING", "ERROR", "IDLE", "RUNNING", "STARTING", "STATE_UNSPECIFIED"`, v) } } @@ -386,7 +414,15 @@ type CohereConfig struct { type CreateAppDeploymentRequest struct { // The name of the app. AppName string `json:"-" url:"-"` - // The source code path of the deployment. + // The mode of which the deployment will manage the source code. + Mode AppDeploymentMode `json:"mode"` + // The workspace file system path of the source code used to create the app + // deployment. This is different from + // `deployment_artifacts.source_code_path`, which is the path used by the + // deployed app. The former refers to the original source code location of + // the app in the workspace during deployment creation, whereas the latter + // provides a system generated stable snapshotted source code path used by + // the deployment. SourceCodePath string `json:"source_code_path"` } @@ -394,8 +430,7 @@ type CreateAppRequest struct { // The description of the app. Description string `json:"description,omitempty"` // The name of the app. The name must contain only lowercase alphanumeric - // characters and hyphens and be between 2 and 30 characters long. It must - // be unique within the workspace. + // characters and hyphens. It must be unique within the workspace. Name string `json:"name"` ForceSendFields []string `json:"-"` @@ -454,7 +489,7 @@ type DataframeSplitInput struct { Index []int `json:"index,omitempty"` } -// Delete an App +// Delete an app type DeleteAppRequest struct { // The name of the app. Name string `json:"-" url:"-"` @@ -823,7 +858,7 @@ func (s FoundationModel) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Get an App Deployment +// Get an app deployment type GetAppDeploymentRequest struct { // The name of the app. AppName string `json:"-" url:"-"` @@ -831,13 +866,13 @@ type GetAppDeploymentRequest struct { DeploymentId string `json:"-" url:"-"` } -// Get App Environment +// Get app environment type GetAppEnvironmentRequest struct { // The name of the app. Name string `json:"-" url:"-"` } -// Get an App +// Get an app type GetAppRequest struct { // The name of the app. Name string `json:"-" url:"-"` @@ -878,7 +913,7 @@ type GetServingEndpointRequest struct { Name string `json:"-" url:"-"` } -// List App Deployments +// List app deployments type ListAppDeploymentsRequest struct { // The name of the app. AppName string `json:"-" url:"-"` @@ -916,7 +951,7 @@ func (s ListAppDeploymentsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// List Apps +// List apps type ListAppsRequest struct { // Upper bound for items returned. PageSize int `json:"-" url:"page_size,omitempty"` @@ -966,6 +1001,11 @@ type LogsRequest struct { ServedModelName string `json:"-" url:"-"` } +type ModelDataPlaneInfo struct { + // Information required to query DataPlane API 'query' endpoint. + QueryInfo *oauth2.DataPlaneInfo `json:"query_info,omitempty"` +} + type OpenAiConfig struct { // This field is only required for Azure AD OpenAI and is the Microsoft // Entra Client ID. @@ -1815,6 +1855,8 @@ type ServingEndpointDetailed struct { CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // The email of the user who created the serving endpoint. Creator string `json:"creator,omitempty"` + // Information required to query DataPlane APIs. + DataPlaneInfo *ModelDataPlaneInfo `json:"data_plane_info,omitempty"` // Endpoint invocation url if route optimization is enabled for endpoint EndpointUrl string `json:"endpoint_url,omitempty"` // System-generated ID of the endpoint. This is used to refer to the @@ -1984,8 +2026,7 @@ type UpdateAppRequest struct { // The description of the app. Description string `json:"description,omitempty"` // The name of the app. The name must contain only lowercase alphanumeric - // characters and hyphens and be between 2 and 30 characters long. It must - // be unique within the workspace. + // characters and hyphens. It must be unique within the workspace. Name string `json:"name" url:"-"` ForceSendFields []string `json:"-"` diff --git a/service/sql/model.go b/service/sql/model.go index 431cdbdea..e08608ba1 100755 --- a/service/sql/model.go +++ b/service/sql/model.go @@ -2352,8 +2352,7 @@ type QueryInfo struct { CanSubscribeToLiveQuery bool `json:"canSubscribeToLiveQuery,omitempty"` // Channel information for the SQL warehouse at the time of query execution ChannelUsed *ChannelInfo `json:"channel_used,omitempty"` - // Total execution time of the query from the client’s point of view, in - // milliseconds. + // Total execution time of the statement ( excluding result fetch time ). Duration int `json:"duration,omitempty"` // Alias for `warehouse_id`. EndpointId string `json:"endpoint_id,omitempty"`