diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 9834ec958..347bf5ee5 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -3ae6f76120079424c8654263eafbc30ec0551854 \ No newline at end of file +universe:/home/parth.bansal/universetwo \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 7627c02f7..974c4b1b8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -26,14 +26,17 @@ experimental/mocks/service/catalog/mock_grants_interface.go linguist-generated=t experimental/mocks/service/catalog/mock_metastores_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_model_versions_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_online_tables_interface.go linguist-generated=true +experimental/mocks/service/catalog/mock_policies_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_quality_monitors_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_registered_models_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_resource_quotas_interface.go linguist-generated=true +experimental/mocks/service/catalog/mock_rfa_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_schemas_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_storage_credentials_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_system_schemas_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_table_constraints_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_tables_interface.go linguist-generated=true +experimental/mocks/service/catalog/mock_temporary_path_credentials_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_temporary_table_credentials_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_volumes_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_workspace_bindings_interface.go linguist-generated=true @@ -61,14 +64,20 @@ experimental/mocks/service/iam/mock_access_control_interface.go linguist-generat experimental/mocks/service/iam/mock_account_access_control_interface.go linguist-generated=true experimental/mocks/service/iam/mock_account_access_control_proxy_interface.go linguist-generated=true experimental/mocks/service/iam/mock_account_groups_interface.go linguist-generated=true +experimental/mocks/service/iam/mock_account_groups_v2_interface.go linguist-generated=true experimental/mocks/service/iam/mock_account_service_principals_interface.go linguist-generated=true +experimental/mocks/service/iam/mock_account_service_principals_v2_interface.go linguist-generated=true experimental/mocks/service/iam/mock_account_users_interface.go linguist-generated=true +experimental/mocks/service/iam/mock_account_users_v2_interface.go linguist-generated=true experimental/mocks/service/iam/mock_current_user_interface.go linguist-generated=true experimental/mocks/service/iam/mock_groups_interface.go linguist-generated=true +experimental/mocks/service/iam/mock_groups_v2_interface.go linguist-generated=true experimental/mocks/service/iam/mock_permission_migration_interface.go linguist-generated=true experimental/mocks/service/iam/mock_permissions_interface.go linguist-generated=true experimental/mocks/service/iam/mock_service_principals_interface.go linguist-generated=true +experimental/mocks/service/iam/mock_service_principals_v2_interface.go linguist-generated=true experimental/mocks/service/iam/mock_users_interface.go linguist-generated=true +experimental/mocks/service/iam/mock_users_v2_interface.go linguist-generated=true experimental/mocks/service/iam/mock_workspace_assignment_interface.go linguist-generated=true experimental/mocks/service/jobs/mock_jobs_interface.go linguist-generated=true experimental/mocks/service/jobs/mock_policy_compliance_for_jobs_interface.go linguist-generated=true @@ -170,12 +179,19 @@ experimental/mocks/service/workspace/mock_secrets_interface.go linguist-generate experimental/mocks/service/workspace/mock_workspace_interface.go linguist-generated=true internal/generatedtests/http_call_test.go linguist-generated=true internal/generatedtests/json_marshall_test.go linguist-generated=true +internal/generatedtests/lro_call_test.go linguist-generated=true +internal/testspecs/service/common/api.go linguist-generated=true +internal/testspecs/service/common/impl.go linguist-generated=true +internal/testspecs/service/common/model.go linguist-generated=true internal/testspecs/service/httpcallv2/api.go linguist-generated=true internal/testspecs/service/httpcallv2/impl.go linguist-generated=true internal/testspecs/service/httpcallv2/model.go linguist-generated=true internal/testspecs/service/jsonmarshallv2/api.go linguist-generated=true internal/testspecs/service/jsonmarshallv2/impl.go linguist-generated=true internal/testspecs/service/jsonmarshallv2/model.go linguist-generated=true +internal/testspecs/service/lrotesting/api.go linguist-generated=true +internal/testspecs/service/lrotesting/impl.go linguist-generated=true +internal/testspecs/service/lrotesting/model.go linguist-generated=true service/agentbricks/api.go linguist-generated=true service/agentbricks/impl.go linguist-generated=true service/agentbricks/interface.go linguist-generated=true @@ -216,6 +232,10 @@ service/iam/api.go linguist-generated=true service/iam/impl.go linguist-generated=true service/iam/interface.go linguist-generated=true service/iam/model.go linguist-generated=true +service/iamv2/api.go linguist-generated=true +service/iamv2/impl.go linguist-generated=true +service/iamv2/interface.go linguist-generated=true +service/iamv2/model.go linguist-generated=true service/jobs/api.go linguist-generated=true service/jobs/impl.go linguist-generated=true service/jobs/interface.go linguist-generated=true @@ -253,6 +273,10 @@ service/settings/api.go linguist-generated=true service/settings/impl.go linguist-generated=true service/settings/interface.go linguist-generated=true service/settings/model.go linguist-generated=true +service/settingsv2/api.go linguist-generated=true +service/settingsv2/impl.go linguist-generated=true +service/settingsv2/interface.go linguist-generated=true +service/settingsv2/model.go linguist-generated=true service/sharing/api.go linguist-generated=true service/sharing/impl.go linguist-generated=true service/sharing/interface.go linguist-generated=true @@ -261,6 +285,10 @@ service/sql/api.go linguist-generated=true service/sql/impl.go linguist-generated=true service/sql/interface.go linguist-generated=true service/sql/model.go linguist-generated=true +service/tags/api.go linguist-generated=true +service/tags/impl.go linguist-generated=true +service/tags/interface.go linguist-generated=true +service/tags/model.go linguist-generated=true service/vectorsearch/api.go linguist-generated=true service/vectorsearch/impl.go linguist-generated=true service/vectorsearch/interface.go linguist-generated=true diff --git a/account_client.go b/account_client.go index fa466e0f8..74c73798e 100755 --- a/account_client.go +++ b/account_client.go @@ -11,9 +11,11 @@ import ( "github.com/databricks/databricks-sdk-go/service/billing" "github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/iam" + "github.com/databricks/databricks-sdk-go/service/iamv2" "github.com/databricks/databricks-sdk-go/service/oauth2" "github.com/databricks/databricks-sdk-go/service/provisioning" "github.com/databricks/databricks-sdk-go/service/settings" + "github.com/databricks/databricks-sdk-go/service/settingsv2" ) type AccountClient struct { @@ -131,7 +133,11 @@ type AccountClient struct { // policies in Unity Catalog to groups, instead of to users individually. // All Databricks account identities can be assigned as members of groups, // and members inherit permissions that are assigned to their group. - Groups iam.AccountGroupsInterface + GroupsV2 iam.AccountGroupsV2Interface + + // These APIs are used to manage identities and the workspace access of + // these identities in . + IamV2 iamv2.AccountIamV2Interface // The Accounts IP Access List API enables account admins to configure IP // access lists for access to the account console. @@ -352,12 +358,15 @@ type AccountClient struct { // interactive users do not need any write, delete, or modify privileges in // production. This eliminates the risk of a user overwriting production // data by accident. - ServicePrincipals iam.AccountServicePrincipalsInterface + ServicePrincipalsV2 iam.AccountServicePrincipalsV2Interface // Accounts Settings API allows users to manage settings at the account // level. Settings settings.AccountSettingsInterface + // APIs to manage account level settings + SettingsV2 settingsv2.AccountSettingsV2Interface + // These APIs manage storage configurations for this workspace. A root // storage S3 bucket in your account is required to store objects like // cluster logs, notebook revisions, and job results. You can also use the @@ -387,7 +396,7 @@ type AccountClient struct { // in your identity provider and that user’s account will also be removed // from Databricks account. This ensures a consistent offboarding process // and prevents unauthorized users from accessing sensitive data. - Users iam.AccountUsersInterface + UsersV2 iam.AccountUsersV2Interface // These APIs manage VPC endpoint configurations for this account. VpcEndpoints provisioning.VpcEndpointsInterface @@ -416,6 +425,44 @@ type AccountClient struct { // platform or on a select custom plan that allows multiple workspaces per // account. Workspaces provisioning.WorkspacesInterface + + // Groups simplify identity management, making it easier to assign access to + // Databricks account, data, and other securable objects. + // + // It is best practice to assign access to workspaces and access-control + // policies in Unity Catalog to groups, instead of to users individually. + // All Databricks account identities can be assigned as members of groups, + // and members inherit permissions that are assigned to their group. + // + // Deprecated: Use the GroupsV2 API instead. + Groups iam.AccountGroupsInterface + + // Identities for use with jobs, automated tools, and systems such as + // scripts, apps, and CI/CD platforms. Databricks recommends creating + // service principals to run production jobs or modify production data. If + // all processes that act on production data run with service principals, + // interactive users do not need any write, delete, or modify privileges in + // production. This eliminates the risk of a user overwriting production + // data by accident. + // + // Deprecated: Use the ServicePrincipalsV2 API instead. + ServicePrincipals iam.AccountServicePrincipalsInterface + + // User identities recognized by Databricks and represented by email + // addresses. + // + // Databricks recommends using SCIM provisioning to sync users and groups + // automatically from your identity provider to your Databricks account. + // SCIM streamlines onboarding a new employee or team by using your identity + // provider to create users and groups in Databricks account and give them + // the proper level of access. When a user leaves your organization or no + // longer needs access to Databricks account, admins can terminate the user + // in your identity provider and that user’s account will also be removed + // from Databricks account. This ensures a consistent offboarding process + // and prevents unauthorized users from accessing sensitive data. + // + // Deprecated: Use the UsersV2 API instead. + Users iam.AccountUsersInterface } var ErrNotAccountClient = errors.New("invalid Databricks Account configuration") @@ -454,7 +501,8 @@ func NewAccountClient(c ...*Config) (*AccountClient, error) { CustomAppIntegration: oauth2.NewCustomAppIntegration(apiClient), EncryptionKeys: provisioning.NewEncryptionKeys(apiClient), FederationPolicy: oauth2.NewAccountFederationPolicy(apiClient), - Groups: iam.NewAccountGroups(apiClient), + GroupsV2: iam.NewAccountGroupsV2(apiClient), + IamV2: iamv2.NewAccountIamV2(apiClient), IpAccessLists: settings.NewAccountIpAccessLists(apiClient), LogDelivery: billing.NewLogDelivery(apiClient), MetastoreAssignments: catalog.NewAccountMetastoreAssignments(apiClient), @@ -467,15 +515,19 @@ func NewAccountClient(c ...*Config) (*AccountClient, error) { PublishedAppIntegration: oauth2.NewPublishedAppIntegration(apiClient), ServicePrincipalFederationPolicy: oauth2.NewServicePrincipalFederationPolicy(apiClient), ServicePrincipalSecrets: oauth2.NewServicePrincipalSecrets(apiClient), - ServicePrincipals: iam.NewAccountServicePrincipals(apiClient), + ServicePrincipalsV2: iam.NewAccountServicePrincipalsV2(apiClient), Settings: settings.NewAccountSettings(apiClient), + SettingsV2: settingsv2.NewAccountSettingsV2(apiClient), Storage: provisioning.NewStorage(apiClient), StorageCredentials: catalog.NewAccountStorageCredentials(apiClient), UsageDashboards: billing.NewUsageDashboards(apiClient), - Users: iam.NewAccountUsers(apiClient), + UsersV2: iam.NewAccountUsersV2(apiClient), VpcEndpoints: provisioning.NewVpcEndpoints(apiClient), WorkspaceAssignment: iam.NewWorkspaceAssignment(apiClient), WorkspaceNetworkConfiguration: settings.NewWorkspaceNetworkConfiguration(apiClient), Workspaces: provisioning.NewWorkspaces(apiClient), + Groups: iam.NewAccountGroups(apiClient), + ServicePrincipals: iam.NewAccountServicePrincipals(apiClient), + Users: iam.NewAccountUsers(apiClient), }, nil } diff --git a/experimental/mocks/mock_account_client.go b/experimental/mocks/mock_account_client.go index 543978a7b..8ba9b74db 100755 --- a/experimental/mocks/mock_account_client.go +++ b/experimental/mocks/mock_account_client.go @@ -11,9 +11,11 @@ import ( "github.com/databricks/databricks-sdk-go/experimental/mocks/service/billing" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/catalog" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/iam" + "github.com/databricks/databricks-sdk-go/experimental/mocks/service/iamv2" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/oauth2" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/provisioning" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/settings" + "github.com/databricks/databricks-sdk-go/experimental/mocks/service/settingsv2" ) type MockAccountClient struct { @@ -38,7 +40,8 @@ func NewMockAccountClient(t interface { CustomAppIntegration: oauth2.NewMockCustomAppIntegrationInterface(t), EncryptionKeys: provisioning.NewMockEncryptionKeysInterface(t), FederationPolicy: oauth2.NewMockAccountFederationPolicyInterface(t), - Groups: iam.NewMockAccountGroupsInterface(t), + GroupsV2: iam.NewMockAccountGroupsV2Interface(t), + IamV2: iamv2.NewMockAccountIamV2Interface(t), IpAccessLists: settings.NewMockAccountIpAccessListsInterface(t), LogDelivery: billing.NewMockLogDeliveryInterface(t), MetastoreAssignments: catalog.NewMockAccountMetastoreAssignmentsInterface(t), @@ -51,12 +54,13 @@ func NewMockAccountClient(t interface { PublishedAppIntegration: oauth2.NewMockPublishedAppIntegrationInterface(t), ServicePrincipalFederationPolicy: oauth2.NewMockServicePrincipalFederationPolicyInterface(t), ServicePrincipalSecrets: oauth2.NewMockServicePrincipalSecretsInterface(t), - ServicePrincipals: iam.NewMockAccountServicePrincipalsInterface(t), + ServicePrincipalsV2: iam.NewMockAccountServicePrincipalsV2Interface(t), Settings: settings.NewMockAccountSettingsInterface(t), + SettingsV2: settingsv2.NewMockAccountSettingsV2Interface(t), Storage: provisioning.NewMockStorageInterface(t), StorageCredentials: catalog.NewMockAccountStorageCredentialsInterface(t), UsageDashboards: billing.NewMockUsageDashboardsInterface(t), - Users: iam.NewMockAccountUsersInterface(t), + UsersV2: iam.NewMockAccountUsersV2Interface(t), VpcEndpoints: provisioning.NewMockVpcEndpointsInterface(t), WorkspaceAssignment: iam.NewMockWorkspaceAssignmentInterface(t), WorkspaceNetworkConfiguration: settings.NewMockWorkspaceNetworkConfigurationInterface(t), @@ -210,10 +214,18 @@ func (m *MockAccountClient) GetMockAccountFederationPolicyAPI() *oauth2.MockAcco return api } -func (m *MockAccountClient) GetMockAccountGroupsAPI() *iam.MockAccountGroupsInterface { - api, ok := m.AccountClient.Groups.(*iam.MockAccountGroupsInterface) +func (m *MockAccountClient) GetMockAccountGroupsV2API() *iam.MockAccountGroupsV2Interface { + api, ok := m.AccountClient.GroupsV2.(*iam.MockAccountGroupsV2Interface) if !ok { - panic(fmt.Sprintf("expected Groups to be *iam.MockAccountGroupsInterface, actual was %T", m.AccountClient.Groups)) + panic(fmt.Sprintf("expected GroupsV2 to be *iam.MockAccountGroupsV2Interface, actual was %T", m.AccountClient.GroupsV2)) + } + return api +} + +func (m *MockAccountClient) GetMockAccountIamV2API() *iamv2.MockAccountIamV2Interface { + api, ok := m.AccountClient.IamV2.(*iamv2.MockAccountIamV2Interface) + if !ok { + panic(fmt.Sprintf("expected IamV2 to be *iamv2.MockAccountIamV2Interface, actual was %T", m.AccountClient.IamV2)) } return api } @@ -314,10 +326,10 @@ func (m *MockAccountClient) GetMockServicePrincipalSecretsAPI() *oauth2.MockServ return api } -func (m *MockAccountClient) GetMockAccountServicePrincipalsAPI() *iam.MockAccountServicePrincipalsInterface { - api, ok := m.AccountClient.ServicePrincipals.(*iam.MockAccountServicePrincipalsInterface) +func (m *MockAccountClient) GetMockAccountServicePrincipalsV2API() *iam.MockAccountServicePrincipalsV2Interface { + api, ok := m.AccountClient.ServicePrincipalsV2.(*iam.MockAccountServicePrincipalsV2Interface) if !ok { - panic(fmt.Sprintf("expected ServicePrincipals to be *iam.MockAccountServicePrincipalsInterface, actual was %T", m.AccountClient.ServicePrincipals)) + panic(fmt.Sprintf("expected ServicePrincipalsV2 to be *iam.MockAccountServicePrincipalsV2Interface, actual was %T", m.AccountClient.ServicePrincipalsV2)) } return api } @@ -330,6 +342,14 @@ func (m *MockAccountClient) GetMockAccountSettingsAPI() *settings.MockAccountSet return api } +func (m *MockAccountClient) GetMockAccountSettingsV2API() *settingsv2.MockAccountSettingsV2Interface { + api, ok := m.AccountClient.SettingsV2.(*settingsv2.MockAccountSettingsV2Interface) + if !ok { + panic(fmt.Sprintf("expected SettingsV2 to be *settingsv2.MockAccountSettingsV2Interface, actual was %T", m.AccountClient.SettingsV2)) + } + return api +} + func (m *MockAccountClient) GetMockStorageAPI() *provisioning.MockStorageInterface { api, ok := m.AccountClient.Storage.(*provisioning.MockStorageInterface) if !ok { @@ -354,10 +374,10 @@ func (m *MockAccountClient) GetMockUsageDashboardsAPI() *billing.MockUsageDashbo return api } -func (m *MockAccountClient) GetMockAccountUsersAPI() *iam.MockAccountUsersInterface { - api, ok := m.AccountClient.Users.(*iam.MockAccountUsersInterface) +func (m *MockAccountClient) GetMockAccountUsersV2API() *iam.MockAccountUsersV2Interface { + api, ok := m.AccountClient.UsersV2.(*iam.MockAccountUsersV2Interface) if !ok { - panic(fmt.Sprintf("expected Users to be *iam.MockAccountUsersInterface, actual was %T", m.AccountClient.Users)) + panic(fmt.Sprintf("expected UsersV2 to be *iam.MockAccountUsersV2Interface, actual was %T", m.AccountClient.UsersV2)) } return api } diff --git a/experimental/mocks/mock_workspace_client.go b/experimental/mocks/mock_workspace_client.go index 874a0a27e..6fc843f82 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -17,6 +17,7 @@ import ( "github.com/databricks/databricks-sdk-go/experimental/mocks/service/database" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/files" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/iam" + "github.com/databricks/databricks-sdk-go/experimental/mocks/service/iamv2" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/jobs" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/marketplace" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/ml" @@ -25,8 +26,10 @@ import ( "github.com/databricks/databricks-sdk-go/experimental/mocks/service/qualitymonitorv2" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/serving" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/settings" + "github.com/databricks/databricks-sdk-go/experimental/mocks/service/settingsv2" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/sharing" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/sql" + "github.com/databricks/databricks-sdk-go/experimental/mocks/service/tags" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/vectorsearch" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/workspace" ) @@ -52,6 +55,7 @@ func NewMockWorkspaceClient(t interface { AlertsLegacy: sql.NewMockAlertsLegacyInterface(t), AlertsV2: sql.NewMockAlertsV2Interface(t), Apps: apps.NewMockAppsInterface(t), + AppsSettings: apps.NewMockAppsSettingsInterface(t), ArtifactAllowlists: catalog.NewMockArtifactAllowlistsInterface(t), Catalogs: catalog.NewMockCatalogsInterface(t), CleanRoomAssetRevisions: cleanrooms.NewMockCleanRoomAssetRevisionsInterface(t), @@ -75,12 +79,15 @@ func NewMockWorkspaceClient(t interface { Dashboards: sql.NewMockDashboardsInterface(t), DataSources: sql.NewMockDataSourcesInterface(t), Database: database.NewMockDatabaseInterface(t), + DatabaseProject: database.NewMockDatabaseProjectInterface(t), Dbfs: files.NewMockDbfsInterface(t), DbsqlPermissions: sql.NewMockDbsqlPermissionsInterface(t), + EntityTagAssignments: catalog.NewMockEntityTagAssignmentsInterface(t), Experiments: ml.NewMockExperimentsInterface(t), ExternalLineage: catalog.NewMockExternalLineageInterface(t), ExternalLocations: catalog.NewMockExternalLocationsInterface(t), ExternalMetadata: catalog.NewMockExternalMetadataInterface(t), + FeatureEngineering: ml.NewMockFeatureEngineeringInterface(t), FeatureStore: ml.NewMockFeatureStoreInterface(t), Files: files.NewMockFilesInterface(t), Forecasting: ml.NewMockForecastingInterface(t), @@ -89,7 +96,7 @@ func NewMockWorkspaceClient(t interface { GitCredentials: workspace.NewMockGitCredentialsInterface(t), GlobalInitScripts: compute.NewMockGlobalInitScriptsInterface(t), Grants: catalog.NewMockGrantsInterface(t), - Groups: iam.NewMockGroupsInterface(t), + GroupsV2: iam.NewMockGroupsV2Interface(t), InstancePools: compute.NewMockInstancePoolsInterface(t), InstanceProfiles: compute.NewMockInstanceProfilesInterface(t), IpAccessLists: settings.NewMockIpAccessListsInterface(t), @@ -122,6 +129,7 @@ func NewMockWorkspaceClient(t interface { QualityMonitors: catalog.NewMockQualityMonitorsInterface(t), Queries: sql.NewMockQueriesInterface(t), QueriesLegacy: sql.NewMockQueriesLegacyInterface(t), + QueryExecution: dashboards.NewMockQueryExecutionInterface(t), QueryHistory: sql.NewMockQueryHistoryInterface(t), QueryVisualizations: sql.NewMockQueryVisualizationsInterface(t), QueryVisualizationsLegacy: sql.NewMockQueryVisualizationsLegacyInterface(t), @@ -132,10 +140,11 @@ func NewMockWorkspaceClient(t interface { RegisteredModels: catalog.NewMockRegisteredModelsInterface(t), Repos: workspace.NewMockReposInterface(t), ResourceQuotas: catalog.NewMockResourceQuotasInterface(t), + Rfa: catalog.NewMockRfaInterface(t), Schemas: catalog.NewMockSchemasInterface(t), Secrets: workspace.NewMockSecretsInterface(t), ServicePrincipalSecretsProxy: oauth2.NewMockServicePrincipalSecretsProxyInterface(t), - ServicePrincipals: iam.NewMockServicePrincipalsInterface(t), + ServicePrincipalsV2: iam.NewMockServicePrincipalsV2Interface(t), ServingEndpoints: serving.NewMockServingEndpointsInterface(t), ServingEndpointsDataPlane: serving.NewMockServingEndpointsDataPlaneInterface(t), Settings: settings.NewMockSettingsInterface(t), @@ -145,11 +154,13 @@ func NewMockWorkspaceClient(t interface { SystemSchemas: catalog.NewMockSystemSchemasInterface(t), TableConstraints: catalog.NewMockTableConstraintsInterface(t), Tables: catalog.NewMockTablesInterface(t), + TagAssignments: tags.NewMockTagAssignmentsInterface(t), + TagPolicies: tags.NewMockTagPoliciesInterface(t), TemporaryPathCredentials: catalog.NewMockTemporaryPathCredentialsInterface(t), TemporaryTableCredentials: catalog.NewMockTemporaryTableCredentialsInterface(t), TokenManagement: settings.NewMockTokenManagementInterface(t), Tokens: settings.NewMockTokensInterface(t), - Users: iam.NewMockUsersInterface(t), + UsersV2: iam.NewMockUsersV2Interface(t), VectorSearchEndpoints: vectorsearch.NewMockVectorSearchEndpointsInterface(t), VectorSearchIndexes: vectorsearch.NewMockVectorSearchIndexesInterface(t), Volumes: catalog.NewMockVolumesInterface(t), @@ -157,6 +168,8 @@ func NewMockWorkspaceClient(t interface { Workspace: workspace.NewMockWorkspaceInterface(t), WorkspaceBindings: catalog.NewMockWorkspaceBindingsInterface(t), WorkspaceConf: settings.NewMockWorkspaceConfInterface(t), + WorkspaceIamV2: iamv2.NewMockWorkspaceIamV2Interface(t), + WorkspaceSettingsV2: settingsv2.NewMockWorkspaceSettingsV2Interface(t), }, } @@ -397,6 +410,14 @@ func (m *MockWorkspaceClient) GetMockAppsAPI() *apps.MockAppsInterface { return api } +func (m *MockWorkspaceClient) GetMockAppsSettingsAPI() *apps.MockAppsSettingsInterface { + api, ok := m.WorkspaceClient.AppsSettings.(*apps.MockAppsSettingsInterface) + if !ok { + panic(fmt.Sprintf("expected AppsSettings to be *apps.MockAppsSettingsInterface, actual was %T", m.WorkspaceClient.AppsSettings)) + } + return api +} + func (m *MockWorkspaceClient) GetMockArtifactAllowlistsAPI() *catalog.MockArtifactAllowlistsInterface { api, ok := m.WorkspaceClient.ArtifactAllowlists.(*catalog.MockArtifactAllowlistsInterface) if !ok { @@ -581,6 +602,14 @@ func (m *MockWorkspaceClient) GetMockDatabaseAPI() *database.MockDatabaseInterfa return api } +func (m *MockWorkspaceClient) GetMockDatabaseProjectAPI() *database.MockDatabaseProjectInterface { + api, ok := m.WorkspaceClient.DatabaseProject.(*database.MockDatabaseProjectInterface) + if !ok { + panic(fmt.Sprintf("expected DatabaseProject to be *database.MockDatabaseProjectInterface, actual was %T", m.WorkspaceClient.DatabaseProject)) + } + return api +} + func (m *MockWorkspaceClient) GetMockDbfsAPI() *files.MockDbfsInterface { api, ok := m.WorkspaceClient.Dbfs.(*files.MockDbfsInterface) if !ok { @@ -597,6 +626,14 @@ func (m *MockWorkspaceClient) GetMockDbsqlPermissionsAPI() *sql.MockDbsqlPermiss return api } +func (m *MockWorkspaceClient) GetMockEntityTagAssignmentsAPI() *catalog.MockEntityTagAssignmentsInterface { + api, ok := m.WorkspaceClient.EntityTagAssignments.(*catalog.MockEntityTagAssignmentsInterface) + if !ok { + panic(fmt.Sprintf("expected EntityTagAssignments to be *catalog.MockEntityTagAssignmentsInterface, actual was %T", m.WorkspaceClient.EntityTagAssignments)) + } + return api +} + func (m *MockWorkspaceClient) GetMockExperimentsAPI() *ml.MockExperimentsInterface { api, ok := m.WorkspaceClient.Experiments.(*ml.MockExperimentsInterface) if !ok { @@ -629,6 +666,14 @@ func (m *MockWorkspaceClient) GetMockExternalMetadataAPI() *catalog.MockExternal return api } +func (m *MockWorkspaceClient) GetMockFeatureEngineeringAPI() *ml.MockFeatureEngineeringInterface { + api, ok := m.WorkspaceClient.FeatureEngineering.(*ml.MockFeatureEngineeringInterface) + if !ok { + panic(fmt.Sprintf("expected FeatureEngineering to be *ml.MockFeatureEngineeringInterface, actual was %T", m.WorkspaceClient.FeatureEngineering)) + } + return api +} + func (m *MockWorkspaceClient) GetMockFeatureStoreAPI() *ml.MockFeatureStoreInterface { api, ok := m.WorkspaceClient.FeatureStore.(*ml.MockFeatureStoreInterface) if !ok { @@ -693,10 +738,10 @@ func (m *MockWorkspaceClient) GetMockGrantsAPI() *catalog.MockGrantsInterface { return api } -func (m *MockWorkspaceClient) GetMockGroupsAPI() *iam.MockGroupsInterface { - api, ok := m.WorkspaceClient.Groups.(*iam.MockGroupsInterface) +func (m *MockWorkspaceClient) GetMockGroupsV2API() *iam.MockGroupsV2Interface { + api, ok := m.WorkspaceClient.GroupsV2.(*iam.MockGroupsV2Interface) if !ok { - panic(fmt.Sprintf("expected Groups to be *iam.MockGroupsInterface, actual was %T", m.WorkspaceClient.Groups)) + panic(fmt.Sprintf("expected GroupsV2 to be *iam.MockGroupsV2Interface, actual was %T", m.WorkspaceClient.GroupsV2)) } return api } @@ -957,6 +1002,14 @@ func (m *MockWorkspaceClient) GetMockQueriesLegacyAPI() *sql.MockQueriesLegacyIn return api } +func (m *MockWorkspaceClient) GetMockQueryExecutionAPI() *dashboards.MockQueryExecutionInterface { + api, ok := m.WorkspaceClient.QueryExecution.(*dashboards.MockQueryExecutionInterface) + if !ok { + panic(fmt.Sprintf("expected QueryExecution to be *dashboards.MockQueryExecutionInterface, actual was %T", m.WorkspaceClient.QueryExecution)) + } + return api +} + func (m *MockWorkspaceClient) GetMockQueryHistoryAPI() *sql.MockQueryHistoryInterface { api, ok := m.WorkspaceClient.QueryHistory.(*sql.MockQueryHistoryInterface) if !ok { @@ -1037,6 +1090,14 @@ func (m *MockWorkspaceClient) GetMockResourceQuotasAPI() *catalog.MockResourceQu return api } +func (m *MockWorkspaceClient) GetMockRfaAPI() *catalog.MockRfaInterface { + api, ok := m.WorkspaceClient.Rfa.(*catalog.MockRfaInterface) + if !ok { + panic(fmt.Sprintf("expected Rfa to be *catalog.MockRfaInterface, actual was %T", m.WorkspaceClient.Rfa)) + } + return api +} + func (m *MockWorkspaceClient) GetMockSchemasAPI() *catalog.MockSchemasInterface { api, ok := m.WorkspaceClient.Schemas.(*catalog.MockSchemasInterface) if !ok { @@ -1061,10 +1122,10 @@ func (m *MockWorkspaceClient) GetMockServicePrincipalSecretsProxyAPI() *oauth2.M return api } -func (m *MockWorkspaceClient) GetMockServicePrincipalsAPI() *iam.MockServicePrincipalsInterface { - api, ok := m.WorkspaceClient.ServicePrincipals.(*iam.MockServicePrincipalsInterface) +func (m *MockWorkspaceClient) GetMockServicePrincipalsV2API() *iam.MockServicePrincipalsV2Interface { + api, ok := m.WorkspaceClient.ServicePrincipalsV2.(*iam.MockServicePrincipalsV2Interface) if !ok { - panic(fmt.Sprintf("expected ServicePrincipals to be *iam.MockServicePrincipalsInterface, actual was %T", m.WorkspaceClient.ServicePrincipals)) + panic(fmt.Sprintf("expected ServicePrincipalsV2 to be *iam.MockServicePrincipalsV2Interface, actual was %T", m.WorkspaceClient.ServicePrincipalsV2)) } return api } @@ -1141,6 +1202,22 @@ func (m *MockWorkspaceClient) GetMockTablesAPI() *catalog.MockTablesInterface { return api } +func (m *MockWorkspaceClient) GetMockTagAssignmentsAPI() *tags.MockTagAssignmentsInterface { + api, ok := m.WorkspaceClient.TagAssignments.(*tags.MockTagAssignmentsInterface) + if !ok { + panic(fmt.Sprintf("expected TagAssignments to be *tags.MockTagAssignmentsInterface, actual was %T", m.WorkspaceClient.TagAssignments)) + } + return api +} + +func (m *MockWorkspaceClient) GetMockTagPoliciesAPI() *tags.MockTagPoliciesInterface { + api, ok := m.WorkspaceClient.TagPolicies.(*tags.MockTagPoliciesInterface) + if !ok { + panic(fmt.Sprintf("expected TagPolicies to be *tags.MockTagPoliciesInterface, actual was %T", m.WorkspaceClient.TagPolicies)) + } + return api +} + func (m *MockWorkspaceClient) GetMockTemporaryPathCredentialsAPI() *catalog.MockTemporaryPathCredentialsInterface { api, ok := m.WorkspaceClient.TemporaryPathCredentials.(*catalog.MockTemporaryPathCredentialsInterface) if !ok { @@ -1173,10 +1250,10 @@ func (m *MockWorkspaceClient) GetMockTokensAPI() *settings.MockTokensInterface { return api } -func (m *MockWorkspaceClient) GetMockUsersAPI() *iam.MockUsersInterface { - api, ok := m.WorkspaceClient.Users.(*iam.MockUsersInterface) +func (m *MockWorkspaceClient) GetMockUsersV2API() *iam.MockUsersV2Interface { + api, ok := m.WorkspaceClient.UsersV2.(*iam.MockUsersV2Interface) if !ok { - panic(fmt.Sprintf("expected Users to be *iam.MockUsersInterface, actual was %T", m.WorkspaceClient.Users)) + panic(fmt.Sprintf("expected UsersV2 to be *iam.MockUsersV2Interface, actual was %T", m.WorkspaceClient.UsersV2)) } return api } @@ -1236,3 +1313,19 @@ func (m *MockWorkspaceClient) GetMockWorkspaceConfAPI() *settings.MockWorkspaceC } return api } + +func (m *MockWorkspaceClient) GetMockWorkspaceIamV2API() *iamv2.MockWorkspaceIamV2Interface { + api, ok := m.WorkspaceClient.WorkspaceIamV2.(*iamv2.MockWorkspaceIamV2Interface) + if !ok { + panic(fmt.Sprintf("expected WorkspaceIamV2 to be *iamv2.MockWorkspaceIamV2Interface, actual was %T", m.WorkspaceClient.WorkspaceIamV2)) + } + return api +} + +func (m *MockWorkspaceClient) GetMockWorkspaceSettingsV2API() *settingsv2.MockWorkspaceSettingsV2Interface { + api, ok := m.WorkspaceClient.WorkspaceSettingsV2.(*settingsv2.MockWorkspaceSettingsV2Interface) + if !ok { + panic(fmt.Sprintf("expected WorkspaceSettingsV2 to be *settingsv2.MockWorkspaceSettingsV2Interface, actual was %T", m.WorkspaceClient.WorkspaceSettingsV2)) + } + return api +} diff --git a/experimental/mocks/service/apps/mock_apps_settings_interface.go b/experimental/mocks/service/apps/mock_apps_settings_interface.go new file mode 100644 index 000000000..257700f7f --- /dev/null +++ b/experimental/mocks/service/apps/mock_apps_settings_interface.go @@ -0,0 +1,384 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package apps + +import ( + context "context" + + apps "github.com/databricks/databricks-sdk-go/service/apps" + + listing "github.com/databricks/databricks-sdk-go/listing" + + mock "github.com/stretchr/testify/mock" +) + +// MockAppsSettingsInterface is an autogenerated mock type for the AppsSettingsInterface type +type MockAppsSettingsInterface struct { + mock.Mock +} + +type MockAppsSettingsInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockAppsSettingsInterface) EXPECT() *MockAppsSettingsInterface_Expecter { + return &MockAppsSettingsInterface_Expecter{mock: &_m.Mock} +} + +// CreateCustomTemplate provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) CreateCustomTemplate(ctx context.Context, request apps.CreateCustomTemplateRequest) (*apps.CustomTemplate, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateCustomTemplate") + } + + var r0 *apps.CustomTemplate + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, apps.CreateCustomTemplateRequest) (*apps.CustomTemplate, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, apps.CreateCustomTemplateRequest) *apps.CustomTemplate); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*apps.CustomTemplate) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, apps.CreateCustomTemplateRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAppsSettingsInterface_CreateCustomTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateCustomTemplate' +type MockAppsSettingsInterface_CreateCustomTemplate_Call struct { + *mock.Call +} + +// CreateCustomTemplate is a helper method to define mock.On call +// - ctx context.Context +// - request apps.CreateCustomTemplateRequest +func (_e *MockAppsSettingsInterface_Expecter) CreateCustomTemplate(ctx interface{}, request interface{}) *MockAppsSettingsInterface_CreateCustomTemplate_Call { + return &MockAppsSettingsInterface_CreateCustomTemplate_Call{Call: _e.mock.On("CreateCustomTemplate", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_CreateCustomTemplate_Call) Run(run func(ctx context.Context, request apps.CreateCustomTemplateRequest)) *MockAppsSettingsInterface_CreateCustomTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.CreateCustomTemplateRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_CreateCustomTemplate_Call) Return(_a0 *apps.CustomTemplate, _a1 error) *MockAppsSettingsInterface_CreateCustomTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAppsSettingsInterface_CreateCustomTemplate_Call) RunAndReturn(run func(context.Context, apps.CreateCustomTemplateRequest) (*apps.CustomTemplate, error)) *MockAppsSettingsInterface_CreateCustomTemplate_Call { + _c.Call.Return(run) + return _c +} + +// DeleteCustomTemplate provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) DeleteCustomTemplate(ctx context.Context, request apps.DeleteCustomTemplateRequest) (*apps.CustomTemplate, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteCustomTemplate") + } + + var r0 *apps.CustomTemplate + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, apps.DeleteCustomTemplateRequest) (*apps.CustomTemplate, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, apps.DeleteCustomTemplateRequest) *apps.CustomTemplate); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*apps.CustomTemplate) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, apps.DeleteCustomTemplateRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAppsSettingsInterface_DeleteCustomTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteCustomTemplate' +type MockAppsSettingsInterface_DeleteCustomTemplate_Call struct { + *mock.Call +} + +// DeleteCustomTemplate is a helper method to define mock.On call +// - ctx context.Context +// - request apps.DeleteCustomTemplateRequest +func (_e *MockAppsSettingsInterface_Expecter) DeleteCustomTemplate(ctx interface{}, request interface{}) *MockAppsSettingsInterface_DeleteCustomTemplate_Call { + return &MockAppsSettingsInterface_DeleteCustomTemplate_Call{Call: _e.mock.On("DeleteCustomTemplate", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_DeleteCustomTemplate_Call) Run(run func(ctx context.Context, request apps.DeleteCustomTemplateRequest)) *MockAppsSettingsInterface_DeleteCustomTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.DeleteCustomTemplateRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_DeleteCustomTemplate_Call) Return(_a0 *apps.CustomTemplate, _a1 error) *MockAppsSettingsInterface_DeleteCustomTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAppsSettingsInterface_DeleteCustomTemplate_Call) RunAndReturn(run func(context.Context, apps.DeleteCustomTemplateRequest) (*apps.CustomTemplate, error)) *MockAppsSettingsInterface_DeleteCustomTemplate_Call { + _c.Call.Return(run) + return _c +} + +// GetCustomTemplate provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) GetCustomTemplate(ctx context.Context, request apps.GetCustomTemplateRequest) (*apps.CustomTemplate, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetCustomTemplate") + } + + var r0 *apps.CustomTemplate + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, apps.GetCustomTemplateRequest) (*apps.CustomTemplate, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, apps.GetCustomTemplateRequest) *apps.CustomTemplate); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*apps.CustomTemplate) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, apps.GetCustomTemplateRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAppsSettingsInterface_GetCustomTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCustomTemplate' +type MockAppsSettingsInterface_GetCustomTemplate_Call struct { + *mock.Call +} + +// GetCustomTemplate is a helper method to define mock.On call +// - ctx context.Context +// - request apps.GetCustomTemplateRequest +func (_e *MockAppsSettingsInterface_Expecter) GetCustomTemplate(ctx interface{}, request interface{}) *MockAppsSettingsInterface_GetCustomTemplate_Call { + return &MockAppsSettingsInterface_GetCustomTemplate_Call{Call: _e.mock.On("GetCustomTemplate", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_GetCustomTemplate_Call) Run(run func(ctx context.Context, request apps.GetCustomTemplateRequest)) *MockAppsSettingsInterface_GetCustomTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.GetCustomTemplateRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_GetCustomTemplate_Call) Return(_a0 *apps.CustomTemplate, _a1 error) *MockAppsSettingsInterface_GetCustomTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAppsSettingsInterface_GetCustomTemplate_Call) RunAndReturn(run func(context.Context, apps.GetCustomTemplateRequest) (*apps.CustomTemplate, error)) *MockAppsSettingsInterface_GetCustomTemplate_Call { + _c.Call.Return(run) + return _c +} + +// ListCustomTemplates provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) ListCustomTemplates(ctx context.Context, request apps.ListCustomTemplatesRequest) listing.Iterator[apps.CustomTemplate] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListCustomTemplates") + } + + var r0 listing.Iterator[apps.CustomTemplate] + if rf, ok := ret.Get(0).(func(context.Context, apps.ListCustomTemplatesRequest) listing.Iterator[apps.CustomTemplate]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[apps.CustomTemplate]) + } + } + + return r0 +} + +// MockAppsSettingsInterface_ListCustomTemplates_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCustomTemplates' +type MockAppsSettingsInterface_ListCustomTemplates_Call struct { + *mock.Call +} + +// ListCustomTemplates is a helper method to define mock.On call +// - ctx context.Context +// - request apps.ListCustomTemplatesRequest +func (_e *MockAppsSettingsInterface_Expecter) ListCustomTemplates(ctx interface{}, request interface{}) *MockAppsSettingsInterface_ListCustomTemplates_Call { + return &MockAppsSettingsInterface_ListCustomTemplates_Call{Call: _e.mock.On("ListCustomTemplates", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplates_Call) Run(run func(ctx context.Context, request apps.ListCustomTemplatesRequest)) *MockAppsSettingsInterface_ListCustomTemplates_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.ListCustomTemplatesRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplates_Call) Return(_a0 listing.Iterator[apps.CustomTemplate]) *MockAppsSettingsInterface_ListCustomTemplates_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplates_Call) RunAndReturn(run func(context.Context, apps.ListCustomTemplatesRequest) listing.Iterator[apps.CustomTemplate]) *MockAppsSettingsInterface_ListCustomTemplates_Call { + _c.Call.Return(run) + return _c +} + +// ListCustomTemplatesAll provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) ListCustomTemplatesAll(ctx context.Context, request apps.ListCustomTemplatesRequest) ([]apps.CustomTemplate, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListCustomTemplatesAll") + } + + var r0 []apps.CustomTemplate + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, apps.ListCustomTemplatesRequest) ([]apps.CustomTemplate, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, apps.ListCustomTemplatesRequest) []apps.CustomTemplate); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]apps.CustomTemplate) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, apps.ListCustomTemplatesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAppsSettingsInterface_ListCustomTemplatesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCustomTemplatesAll' +type MockAppsSettingsInterface_ListCustomTemplatesAll_Call struct { + *mock.Call +} + +// ListCustomTemplatesAll is a helper method to define mock.On call +// - ctx context.Context +// - request apps.ListCustomTemplatesRequest +func (_e *MockAppsSettingsInterface_Expecter) ListCustomTemplatesAll(ctx interface{}, request interface{}) *MockAppsSettingsInterface_ListCustomTemplatesAll_Call { + return &MockAppsSettingsInterface_ListCustomTemplatesAll_Call{Call: _e.mock.On("ListCustomTemplatesAll", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplatesAll_Call) Run(run func(ctx context.Context, request apps.ListCustomTemplatesRequest)) *MockAppsSettingsInterface_ListCustomTemplatesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.ListCustomTemplatesRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplatesAll_Call) Return(_a0 []apps.CustomTemplate, _a1 error) *MockAppsSettingsInterface_ListCustomTemplatesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplatesAll_Call) RunAndReturn(run func(context.Context, apps.ListCustomTemplatesRequest) ([]apps.CustomTemplate, error)) *MockAppsSettingsInterface_ListCustomTemplatesAll_Call { + _c.Call.Return(run) + return _c +} + +// UpdateCustomTemplate provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) UpdateCustomTemplate(ctx context.Context, request apps.UpdateCustomTemplateRequest) (*apps.CustomTemplate, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateCustomTemplate") + } + + var r0 *apps.CustomTemplate + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, apps.UpdateCustomTemplateRequest) (*apps.CustomTemplate, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, apps.UpdateCustomTemplateRequest) *apps.CustomTemplate); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*apps.CustomTemplate) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, apps.UpdateCustomTemplateRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAppsSettingsInterface_UpdateCustomTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCustomTemplate' +type MockAppsSettingsInterface_UpdateCustomTemplate_Call struct { + *mock.Call +} + +// UpdateCustomTemplate is a helper method to define mock.On call +// - ctx context.Context +// - request apps.UpdateCustomTemplateRequest +func (_e *MockAppsSettingsInterface_Expecter) UpdateCustomTemplate(ctx interface{}, request interface{}) *MockAppsSettingsInterface_UpdateCustomTemplate_Call { + return &MockAppsSettingsInterface_UpdateCustomTemplate_Call{Call: _e.mock.On("UpdateCustomTemplate", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_UpdateCustomTemplate_Call) Run(run func(ctx context.Context, request apps.UpdateCustomTemplateRequest)) *MockAppsSettingsInterface_UpdateCustomTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.UpdateCustomTemplateRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_UpdateCustomTemplate_Call) Return(_a0 *apps.CustomTemplate, _a1 error) *MockAppsSettingsInterface_UpdateCustomTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAppsSettingsInterface_UpdateCustomTemplate_Call) RunAndReturn(run func(context.Context, apps.UpdateCustomTemplateRequest) (*apps.CustomTemplate, error)) *MockAppsSettingsInterface_UpdateCustomTemplate_Call { + _c.Call.Return(run) + return _c +} + +// NewMockAppsSettingsInterface creates a new instance of MockAppsSettingsInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockAppsSettingsInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockAppsSettingsInterface { + mock := &MockAppsSettingsInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/catalog/mock_entity_tag_assignments_interface.go b/experimental/mocks/service/catalog/mock_entity_tag_assignments_interface.go new file mode 100644 index 000000000..ce084df78 --- /dev/null +++ b/experimental/mocks/service/catalog/mock_entity_tag_assignments_interface.go @@ -0,0 +1,372 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package catalog + +import ( + context "context" + + catalog "github.com/databricks/databricks-sdk-go/service/catalog" + + listing "github.com/databricks/databricks-sdk-go/listing" + + mock "github.com/stretchr/testify/mock" +) + +// MockEntityTagAssignmentsInterface is an autogenerated mock type for the EntityTagAssignmentsInterface type +type MockEntityTagAssignmentsInterface struct { + mock.Mock +} + +type MockEntityTagAssignmentsInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockEntityTagAssignmentsInterface) EXPECT() *MockEntityTagAssignmentsInterface_Expecter { + return &MockEntityTagAssignmentsInterface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) Create(ctx context.Context, request catalog.CreateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *catalog.EntityTagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateEntityTagAssignmentRequest) *catalog.EntityTagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.EntityTagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.CreateEntityTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEntityTagAssignmentsInterface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockEntityTagAssignmentsInterface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.CreateEntityTagAssignmentRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) Create(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_Create_Call { + return &MockEntityTagAssignmentsInterface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_Create_Call) Run(run func(ctx context.Context, request catalog.CreateEntityTagAssignmentRequest)) *MockEntityTagAssignmentsInterface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.CreateEntityTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Create_Call) Return(_a0 *catalog.EntityTagAssignment, _a1 error) *MockEntityTagAssignmentsInterface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Create_Call) RunAndReturn(run func(context.Context, catalog.CreateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)) *MockEntityTagAssignmentsInterface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) Delete(ctx context.Context, request catalog.DeleteEntityTagAssignmentRequest) 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, catalog.DeleteEntityTagAssignmentRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockEntityTagAssignmentsInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockEntityTagAssignmentsInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.DeleteEntityTagAssignmentRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_Delete_Call { + return &MockEntityTagAssignmentsInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_Delete_Call) Run(run func(ctx context.Context, request catalog.DeleteEntityTagAssignmentRequest)) *MockEntityTagAssignmentsInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.DeleteEntityTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Delete_Call) Return(_a0 error) *MockEntityTagAssignmentsInterface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Delete_Call) RunAndReturn(run func(context.Context, catalog.DeleteEntityTagAssignmentRequest) error) *MockEntityTagAssignmentsInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) Get(ctx context.Context, request catalog.GetEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *catalog.EntityTagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetEntityTagAssignmentRequest) *catalog.EntityTagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.EntityTagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.GetEntityTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEntityTagAssignmentsInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockEntityTagAssignmentsInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.GetEntityTagAssignmentRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) Get(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_Get_Call { + return &MockEntityTagAssignmentsInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_Get_Call) Run(run func(ctx context.Context, request catalog.GetEntityTagAssignmentRequest)) *MockEntityTagAssignmentsInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.GetEntityTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Get_Call) Return(_a0 *catalog.EntityTagAssignment, _a1 error) *MockEntityTagAssignmentsInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Get_Call) RunAndReturn(run func(context.Context, catalog.GetEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)) *MockEntityTagAssignmentsInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) List(ctx context.Context, request catalog.ListEntityTagAssignmentsRequest) listing.Iterator[catalog.EntityTagAssignment] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[catalog.EntityTagAssignment] + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListEntityTagAssignmentsRequest) listing.Iterator[catalog.EntityTagAssignment]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[catalog.EntityTagAssignment]) + } + } + + return r0 +} + +// MockEntityTagAssignmentsInterface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockEntityTagAssignmentsInterface_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.ListEntityTagAssignmentsRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) List(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_List_Call { + return &MockEntityTagAssignmentsInterface_List_Call{Call: _e.mock.On("List", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_List_Call) Run(run func(ctx context.Context, request catalog.ListEntityTagAssignmentsRequest)) *MockEntityTagAssignmentsInterface_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.ListEntityTagAssignmentsRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_List_Call) Return(_a0 listing.Iterator[catalog.EntityTagAssignment]) *MockEntityTagAssignmentsInterface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_List_Call) RunAndReturn(run func(context.Context, catalog.ListEntityTagAssignmentsRequest) listing.Iterator[catalog.EntityTagAssignment]) *MockEntityTagAssignmentsInterface_List_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) ListAll(ctx context.Context, request catalog.ListEntityTagAssignmentsRequest) ([]catalog.EntityTagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []catalog.EntityTagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListEntityTagAssignmentsRequest) ([]catalog.EntityTagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListEntityTagAssignmentsRequest) []catalog.EntityTagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]catalog.EntityTagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.ListEntityTagAssignmentsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEntityTagAssignmentsInterface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockEntityTagAssignmentsInterface_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.ListEntityTagAssignmentsRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) ListAll(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_ListAll_Call { + return &MockEntityTagAssignmentsInterface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_ListAll_Call) Run(run func(ctx context.Context, request catalog.ListEntityTagAssignmentsRequest)) *MockEntityTagAssignmentsInterface_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.ListEntityTagAssignmentsRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_ListAll_Call) Return(_a0 []catalog.EntityTagAssignment, _a1 error) *MockEntityTagAssignmentsInterface_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_ListAll_Call) RunAndReturn(run func(context.Context, catalog.ListEntityTagAssignmentsRequest) ([]catalog.EntityTagAssignment, error)) *MockEntityTagAssignmentsInterface_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) Update(ctx context.Context, request catalog.UpdateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *catalog.EntityTagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateEntityTagAssignmentRequest) *catalog.EntityTagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.EntityTagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.UpdateEntityTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEntityTagAssignmentsInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockEntityTagAssignmentsInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.UpdateEntityTagAssignmentRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) Update(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_Update_Call { + return &MockEntityTagAssignmentsInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_Update_Call) Run(run func(ctx context.Context, request catalog.UpdateEntityTagAssignmentRequest)) *MockEntityTagAssignmentsInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.UpdateEntityTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Update_Call) Return(_a0 *catalog.EntityTagAssignment, _a1 error) *MockEntityTagAssignmentsInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Update_Call) RunAndReturn(run func(context.Context, catalog.UpdateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)) *MockEntityTagAssignmentsInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockEntityTagAssignmentsInterface creates a new instance of MockEntityTagAssignmentsInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockEntityTagAssignmentsInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockEntityTagAssignmentsInterface { + mock := &MockEntityTagAssignmentsInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/catalog/mock_rfa_interface.go b/experimental/mocks/service/catalog/mock_rfa_interface.go new file mode 100644 index 000000000..aef5a79f9 --- /dev/null +++ b/experimental/mocks/service/catalog/mock_rfa_interface.go @@ -0,0 +1,215 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package catalog + +import ( + context "context" + + catalog "github.com/databricks/databricks-sdk-go/service/catalog" + + mock "github.com/stretchr/testify/mock" +) + +// MockRfaInterface is an autogenerated mock type for the RfaInterface type +type MockRfaInterface struct { + mock.Mock +} + +type MockRfaInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockRfaInterface) EXPECT() *MockRfaInterface_Expecter { + return &MockRfaInterface_Expecter{mock: &_m.Mock} +} + +// BatchCreateAccessRequests provides a mock function with given fields: ctx, request +func (_m *MockRfaInterface) BatchCreateAccessRequests(ctx context.Context, request catalog.BatchCreateAccessRequestsRequest) (*catalog.BatchCreateAccessRequestsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for BatchCreateAccessRequests") + } + + var r0 *catalog.BatchCreateAccessRequestsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.BatchCreateAccessRequestsRequest) (*catalog.BatchCreateAccessRequestsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.BatchCreateAccessRequestsRequest) *catalog.BatchCreateAccessRequestsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.BatchCreateAccessRequestsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.BatchCreateAccessRequestsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRfaInterface_BatchCreateAccessRequests_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BatchCreateAccessRequests' +type MockRfaInterface_BatchCreateAccessRequests_Call struct { + *mock.Call +} + +// BatchCreateAccessRequests is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.BatchCreateAccessRequestsRequest +func (_e *MockRfaInterface_Expecter) BatchCreateAccessRequests(ctx interface{}, request interface{}) *MockRfaInterface_BatchCreateAccessRequests_Call { + return &MockRfaInterface_BatchCreateAccessRequests_Call{Call: _e.mock.On("BatchCreateAccessRequests", ctx, request)} +} + +func (_c *MockRfaInterface_BatchCreateAccessRequests_Call) Run(run func(ctx context.Context, request catalog.BatchCreateAccessRequestsRequest)) *MockRfaInterface_BatchCreateAccessRequests_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.BatchCreateAccessRequestsRequest)) + }) + return _c +} + +func (_c *MockRfaInterface_BatchCreateAccessRequests_Call) Return(_a0 *catalog.BatchCreateAccessRequestsResponse, _a1 error) *MockRfaInterface_BatchCreateAccessRequests_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRfaInterface_BatchCreateAccessRequests_Call) RunAndReturn(run func(context.Context, catalog.BatchCreateAccessRequestsRequest) (*catalog.BatchCreateAccessRequestsResponse, error)) *MockRfaInterface_BatchCreateAccessRequests_Call { + _c.Call.Return(run) + return _c +} + +// GetAccessRequestDestinations provides a mock function with given fields: ctx, request +func (_m *MockRfaInterface) GetAccessRequestDestinations(ctx context.Context, request catalog.GetAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetAccessRequestDestinations") + } + + var r0 *catalog.AccessRequestDestinations + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetAccessRequestDestinationsRequest) *catalog.AccessRequestDestinations); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.AccessRequestDestinations) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.GetAccessRequestDestinationsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRfaInterface_GetAccessRequestDestinations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAccessRequestDestinations' +type MockRfaInterface_GetAccessRequestDestinations_Call struct { + *mock.Call +} + +// GetAccessRequestDestinations is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.GetAccessRequestDestinationsRequest +func (_e *MockRfaInterface_Expecter) GetAccessRequestDestinations(ctx interface{}, request interface{}) *MockRfaInterface_GetAccessRequestDestinations_Call { + return &MockRfaInterface_GetAccessRequestDestinations_Call{Call: _e.mock.On("GetAccessRequestDestinations", ctx, request)} +} + +func (_c *MockRfaInterface_GetAccessRequestDestinations_Call) Run(run func(ctx context.Context, request catalog.GetAccessRequestDestinationsRequest)) *MockRfaInterface_GetAccessRequestDestinations_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.GetAccessRequestDestinationsRequest)) + }) + return _c +} + +func (_c *MockRfaInterface_GetAccessRequestDestinations_Call) Return(_a0 *catalog.AccessRequestDestinations, _a1 error) *MockRfaInterface_GetAccessRequestDestinations_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRfaInterface_GetAccessRequestDestinations_Call) RunAndReturn(run func(context.Context, catalog.GetAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error)) *MockRfaInterface_GetAccessRequestDestinations_Call { + _c.Call.Return(run) + return _c +} + +// UpdateAccessRequestDestinations provides a mock function with given fields: ctx, request +func (_m *MockRfaInterface) UpdateAccessRequestDestinations(ctx context.Context, request catalog.UpdateAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateAccessRequestDestinations") + } + + var r0 *catalog.AccessRequestDestinations + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateAccessRequestDestinationsRequest) *catalog.AccessRequestDestinations); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.AccessRequestDestinations) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.UpdateAccessRequestDestinationsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRfaInterface_UpdateAccessRequestDestinations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAccessRequestDestinations' +type MockRfaInterface_UpdateAccessRequestDestinations_Call struct { + *mock.Call +} + +// UpdateAccessRequestDestinations is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.UpdateAccessRequestDestinationsRequest +func (_e *MockRfaInterface_Expecter) UpdateAccessRequestDestinations(ctx interface{}, request interface{}) *MockRfaInterface_UpdateAccessRequestDestinations_Call { + return &MockRfaInterface_UpdateAccessRequestDestinations_Call{Call: _e.mock.On("UpdateAccessRequestDestinations", ctx, request)} +} + +func (_c *MockRfaInterface_UpdateAccessRequestDestinations_Call) Run(run func(ctx context.Context, request catalog.UpdateAccessRequestDestinationsRequest)) *MockRfaInterface_UpdateAccessRequestDestinations_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.UpdateAccessRequestDestinationsRequest)) + }) + return _c +} + +func (_c *MockRfaInterface_UpdateAccessRequestDestinations_Call) Return(_a0 *catalog.AccessRequestDestinations, _a1 error) *MockRfaInterface_UpdateAccessRequestDestinations_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRfaInterface_UpdateAccessRequestDestinations_Call) RunAndReturn(run func(context.Context, catalog.UpdateAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error)) *MockRfaInterface_UpdateAccessRequestDestinations_Call { + _c.Call.Return(run) + return _c +} + +// NewMockRfaInterface creates a new instance of MockRfaInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockRfaInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockRfaInterface { + mock := &MockRfaInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/compute/mock_libraries_interface.go b/experimental/mocks/service/compute/mock_libraries_interface.go index 23304e2d5..bc98492c9 100644 --- a/experimental/mocks/service/compute/mock_libraries_interface.go +++ b/experimental/mocks/service/compute/mock_libraries_interface.go @@ -300,6 +300,218 @@ func (_c *MockLibrariesInterface_ClusterStatusByClusterId_Call) RunAndReturn(run return _c } +// CreateDefaultBaseEnvironment provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) CreateDefaultBaseEnvironment(ctx context.Context, request compute.CreateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDefaultBaseEnvironment") + } + + var r0 *compute.DefaultBaseEnvironment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, compute.CreateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, compute.CreateDefaultBaseEnvironmentRequest) *compute.DefaultBaseEnvironment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*compute.DefaultBaseEnvironment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, compute.CreateDefaultBaseEnvironmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLibrariesInterface_CreateDefaultBaseEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDefaultBaseEnvironment' +type MockLibrariesInterface_CreateDefaultBaseEnvironment_Call struct { + *mock.Call +} + +// CreateDefaultBaseEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request compute.CreateDefaultBaseEnvironmentRequest +func (_e *MockLibrariesInterface_Expecter) CreateDefaultBaseEnvironment(ctx interface{}, request interface{}) *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call { + return &MockLibrariesInterface_CreateDefaultBaseEnvironment_Call{Call: _e.mock.On("CreateDefaultBaseEnvironment", ctx, request)} +} + +func (_c *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call) Run(run func(ctx context.Context, request compute.CreateDefaultBaseEnvironmentRequest)) *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.CreateDefaultBaseEnvironmentRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call) Return(_a0 *compute.DefaultBaseEnvironment, _a1 error) *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call) RunAndReturn(run func(context.Context, compute.CreateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)) *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDefaultBaseEnvironment provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) DeleteDefaultBaseEnvironment(ctx context.Context, request compute.DeleteDefaultBaseEnvironmentRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteDefaultBaseEnvironment") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, compute.DeleteDefaultBaseEnvironmentRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDefaultBaseEnvironment' +type MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call struct { + *mock.Call +} + +// DeleteDefaultBaseEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request compute.DeleteDefaultBaseEnvironmentRequest +func (_e *MockLibrariesInterface_Expecter) DeleteDefaultBaseEnvironment(ctx interface{}, request interface{}) *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call { + return &MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call{Call: _e.mock.On("DeleteDefaultBaseEnvironment", ctx, request)} +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call) Run(run func(ctx context.Context, request compute.DeleteDefaultBaseEnvironmentRequest)) *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.DeleteDefaultBaseEnvironmentRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call) Return(_a0 error) *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call) RunAndReturn(run func(context.Context, compute.DeleteDefaultBaseEnvironmentRequest) error) *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDefaultBaseEnvironmentById provides a mock function with given fields: ctx, id +func (_m *MockLibrariesInterface) DeleteDefaultBaseEnvironmentById(ctx context.Context, id string) error { + ret := _m.Called(ctx, id) + + if len(ret) == 0 { + panic("no return value specified for DeleteDefaultBaseEnvironmentById") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDefaultBaseEnvironmentById' +type MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call struct { + *mock.Call +} + +// DeleteDefaultBaseEnvironmentById is a helper method to define mock.On call +// - ctx context.Context +// - id string +func (_e *MockLibrariesInterface_Expecter) DeleteDefaultBaseEnvironmentById(ctx interface{}, id interface{}) *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call { + return &MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call{Call: _e.mock.On("DeleteDefaultBaseEnvironmentById", ctx, id)} +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call) Run(run func(ctx context.Context, id string)) *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call) Return(_a0 error) *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call) RunAndReturn(run func(context.Context, string) error) *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call { + _c.Call.Return(run) + return _c +} + +// GetDefaultBaseEnvironment provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) GetDefaultBaseEnvironment(ctx context.Context, request compute.GetDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDefaultBaseEnvironment") + } + + var r0 *compute.DefaultBaseEnvironment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, compute.GetDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, compute.GetDefaultBaseEnvironmentRequest) *compute.DefaultBaseEnvironment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*compute.DefaultBaseEnvironment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, compute.GetDefaultBaseEnvironmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLibrariesInterface_GetDefaultBaseEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDefaultBaseEnvironment' +type MockLibrariesInterface_GetDefaultBaseEnvironment_Call struct { + *mock.Call +} + +// GetDefaultBaseEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request compute.GetDefaultBaseEnvironmentRequest +func (_e *MockLibrariesInterface_Expecter) GetDefaultBaseEnvironment(ctx interface{}, request interface{}) *MockLibrariesInterface_GetDefaultBaseEnvironment_Call { + return &MockLibrariesInterface_GetDefaultBaseEnvironment_Call{Call: _e.mock.On("GetDefaultBaseEnvironment", ctx, request)} +} + +func (_c *MockLibrariesInterface_GetDefaultBaseEnvironment_Call) Run(run func(ctx context.Context, request compute.GetDefaultBaseEnvironmentRequest)) *MockLibrariesInterface_GetDefaultBaseEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.GetDefaultBaseEnvironmentRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_GetDefaultBaseEnvironment_Call) Return(_a0 *compute.DefaultBaseEnvironment, _a1 error) *MockLibrariesInterface_GetDefaultBaseEnvironment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLibrariesInterface_GetDefaultBaseEnvironment_Call) RunAndReturn(run func(context.Context, compute.GetDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)) *MockLibrariesInterface_GetDefaultBaseEnvironment_Call { + _c.Call.Return(run) + return _c +} + // Install provides a mock function with given fields: ctx, request func (_m *MockLibrariesInterface) Install(ctx context.Context, request compute.InstallLibraries) error { ret := _m.Called(ctx, request) @@ -347,6 +559,208 @@ func (_c *MockLibrariesInterface_Install_Call) RunAndReturn(run func(context.Con return _c } +// ListDefaultBaseEnvironments provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) ListDefaultBaseEnvironments(ctx context.Context, request compute.ListDefaultBaseEnvironmentsRequest) listing.Iterator[compute.DefaultBaseEnvironment] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDefaultBaseEnvironments") + } + + var r0 listing.Iterator[compute.DefaultBaseEnvironment] + if rf, ok := ret.Get(0).(func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) listing.Iterator[compute.DefaultBaseEnvironment]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[compute.DefaultBaseEnvironment]) + } + } + + return r0 +} + +// MockLibrariesInterface_ListDefaultBaseEnvironments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDefaultBaseEnvironments' +type MockLibrariesInterface_ListDefaultBaseEnvironments_Call struct { + *mock.Call +} + +// ListDefaultBaseEnvironments is a helper method to define mock.On call +// - ctx context.Context +// - request compute.ListDefaultBaseEnvironmentsRequest +func (_e *MockLibrariesInterface_Expecter) ListDefaultBaseEnvironments(ctx interface{}, request interface{}) *MockLibrariesInterface_ListDefaultBaseEnvironments_Call { + return &MockLibrariesInterface_ListDefaultBaseEnvironments_Call{Call: _e.mock.On("ListDefaultBaseEnvironments", ctx, request)} +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironments_Call) Run(run func(ctx context.Context, request compute.ListDefaultBaseEnvironmentsRequest)) *MockLibrariesInterface_ListDefaultBaseEnvironments_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.ListDefaultBaseEnvironmentsRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironments_Call) Return(_a0 listing.Iterator[compute.DefaultBaseEnvironment]) *MockLibrariesInterface_ListDefaultBaseEnvironments_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironments_Call) RunAndReturn(run func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) listing.Iterator[compute.DefaultBaseEnvironment]) *MockLibrariesInterface_ListDefaultBaseEnvironments_Call { + _c.Call.Return(run) + return _c +} + +// ListDefaultBaseEnvironmentsAll provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) ListDefaultBaseEnvironmentsAll(ctx context.Context, request compute.ListDefaultBaseEnvironmentsRequest) ([]compute.DefaultBaseEnvironment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDefaultBaseEnvironmentsAll") + } + + var r0 []compute.DefaultBaseEnvironment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) ([]compute.DefaultBaseEnvironment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) []compute.DefaultBaseEnvironment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]compute.DefaultBaseEnvironment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDefaultBaseEnvironmentsAll' +type MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call struct { + *mock.Call +} + +// ListDefaultBaseEnvironmentsAll is a helper method to define mock.On call +// - ctx context.Context +// - request compute.ListDefaultBaseEnvironmentsRequest +func (_e *MockLibrariesInterface_Expecter) ListDefaultBaseEnvironmentsAll(ctx interface{}, request interface{}) *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call { + return &MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call{Call: _e.mock.On("ListDefaultBaseEnvironmentsAll", ctx, request)} +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call) Run(run func(ctx context.Context, request compute.ListDefaultBaseEnvironmentsRequest)) *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.ListDefaultBaseEnvironmentsRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call) Return(_a0 []compute.DefaultBaseEnvironment, _a1 error) *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call) RunAndReturn(run func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) ([]compute.DefaultBaseEnvironment, error)) *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call { + _c.Call.Return(run) + return _c +} + +// RefreshDefaultBaseEnvironments provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) RefreshDefaultBaseEnvironments(ctx context.Context, request compute.RefreshDefaultBaseEnvironmentsRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for RefreshDefaultBaseEnvironments") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, compute.RefreshDefaultBaseEnvironmentsRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RefreshDefaultBaseEnvironments' +type MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call struct { + *mock.Call +} + +// RefreshDefaultBaseEnvironments is a helper method to define mock.On call +// - ctx context.Context +// - request compute.RefreshDefaultBaseEnvironmentsRequest +func (_e *MockLibrariesInterface_Expecter) RefreshDefaultBaseEnvironments(ctx interface{}, request interface{}) *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call { + return &MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call{Call: _e.mock.On("RefreshDefaultBaseEnvironments", ctx, request)} +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call) Run(run func(ctx context.Context, request compute.RefreshDefaultBaseEnvironmentsRequest)) *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.RefreshDefaultBaseEnvironmentsRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call) Return(_a0 error) *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call) RunAndReturn(run func(context.Context, compute.RefreshDefaultBaseEnvironmentsRequest) error) *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call { + _c.Call.Return(run) + return _c +} + +// RefreshDefaultBaseEnvironmentsByIds provides a mock function with given fields: ctx, ids +func (_m *MockLibrariesInterface) RefreshDefaultBaseEnvironmentsByIds(ctx context.Context, ids []string) error { + ret := _m.Called(ctx, ids) + + if len(ret) == 0 { + panic("no return value specified for RefreshDefaultBaseEnvironmentsByIds") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, []string) error); ok { + r0 = rf(ctx, ids) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RefreshDefaultBaseEnvironmentsByIds' +type MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call struct { + *mock.Call +} + +// RefreshDefaultBaseEnvironmentsByIds is a helper method to define mock.On call +// - ctx context.Context +// - ids []string +func (_e *MockLibrariesInterface_Expecter) RefreshDefaultBaseEnvironmentsByIds(ctx interface{}, ids interface{}) *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call { + return &MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call{Call: _e.mock.On("RefreshDefaultBaseEnvironmentsByIds", ctx, ids)} +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call) Run(run func(ctx context.Context, ids []string)) *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]string)) + }) + return _c +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call) Return(_a0 error) *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call) RunAndReturn(run func(context.Context, []string) error) *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call { + _c.Call.Return(run) + return _c +} + // Uninstall provides a mock function with given fields: ctx, request func (_m *MockLibrariesInterface) Uninstall(ctx context.Context, request compute.UninstallLibraries) error { ret := _m.Called(ctx, request) @@ -456,6 +870,124 @@ func (_c *MockLibrariesInterface_UpdateAndWait_Call) RunAndReturn(run func(conte return _c } +// UpdateDefaultBaseEnvironment provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) UpdateDefaultBaseEnvironment(ctx context.Context, request compute.UpdateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDefaultBaseEnvironment") + } + + var r0 *compute.DefaultBaseEnvironment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, compute.UpdateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, compute.UpdateDefaultBaseEnvironmentRequest) *compute.DefaultBaseEnvironment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*compute.DefaultBaseEnvironment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, compute.UpdateDefaultBaseEnvironmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDefaultBaseEnvironment' +type MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call struct { + *mock.Call +} + +// UpdateDefaultBaseEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request compute.UpdateDefaultBaseEnvironmentRequest +func (_e *MockLibrariesInterface_Expecter) UpdateDefaultBaseEnvironment(ctx interface{}, request interface{}) *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call { + return &MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call{Call: _e.mock.On("UpdateDefaultBaseEnvironment", ctx, request)} +} + +func (_c *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call) Run(run func(ctx context.Context, request compute.UpdateDefaultBaseEnvironmentRequest)) *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.UpdateDefaultBaseEnvironmentRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call) Return(_a0 *compute.DefaultBaseEnvironment, _a1 error) *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call) RunAndReturn(run func(context.Context, compute.UpdateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)) *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDefaultDefaultBaseEnvironment provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) UpdateDefaultDefaultBaseEnvironment(ctx context.Context, request compute.UpdateDefaultDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDefaultDefaultBaseEnvironment") + } + + var r0 *compute.DefaultBaseEnvironment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, compute.UpdateDefaultDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, compute.UpdateDefaultDefaultBaseEnvironmentRequest) *compute.DefaultBaseEnvironment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*compute.DefaultBaseEnvironment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, compute.UpdateDefaultDefaultBaseEnvironmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDefaultDefaultBaseEnvironment' +type MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call struct { + *mock.Call +} + +// UpdateDefaultDefaultBaseEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request compute.UpdateDefaultDefaultBaseEnvironmentRequest +func (_e *MockLibrariesInterface_Expecter) UpdateDefaultDefaultBaseEnvironment(ctx interface{}, request interface{}) *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call { + return &MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call{Call: _e.mock.On("UpdateDefaultDefaultBaseEnvironment", ctx, request)} +} + +func (_c *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call) Run(run func(ctx context.Context, request compute.UpdateDefaultDefaultBaseEnvironmentRequest)) *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.UpdateDefaultDefaultBaseEnvironmentRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call) Return(_a0 *compute.DefaultBaseEnvironment, _a1 error) *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call) RunAndReturn(run func(context.Context, compute.UpdateDefaultDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)) *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call { + _c.Call.Return(run) + return _c +} + // NewMockLibrariesInterface creates a new instance of MockLibrariesInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMockLibrariesInterface(t interface { diff --git a/experimental/mocks/service/dashboards/mock_genie_interface.go b/experimental/mocks/service/dashboards/mock_genie_interface.go index 19af714a6..d38fdacdf 100644 --- a/experimental/mocks/service/dashboards/mock_genie_interface.go +++ b/experimental/mocks/service/dashboards/mock_genie_interface.go @@ -159,6 +159,65 @@ func (_c *MockGenieInterface_CreateMessageAndWait_Call) RunAndReturn(run func(co return _c } +// CreateSpace provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) CreateSpace(ctx context.Context, request dashboards.GenieCreateSpaceRequest) (*dashboards.GenieSpace, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateSpace") + } + + var r0 *dashboards.GenieSpace + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieCreateSpaceRequest) (*dashboards.GenieSpace, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieCreateSpaceRequest) *dashboards.GenieSpace); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieSpace) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GenieCreateSpaceRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_CreateSpace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateSpace' +type MockGenieInterface_CreateSpace_Call struct { + *mock.Call +} + +// CreateSpace is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieCreateSpaceRequest +func (_e *MockGenieInterface_Expecter) CreateSpace(ctx interface{}, request interface{}) *MockGenieInterface_CreateSpace_Call { + return &MockGenieInterface_CreateSpace_Call{Call: _e.mock.On("CreateSpace", ctx, request)} +} + +func (_c *MockGenieInterface_CreateSpace_Call) Run(run func(ctx context.Context, request dashboards.GenieCreateSpaceRequest)) *MockGenieInterface_CreateSpace_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieCreateSpaceRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_CreateSpace_Call) Return(_a0 *dashboards.GenieSpace, _a1 error) *MockGenieInterface_CreateSpace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_CreateSpace_Call) RunAndReturn(run func(context.Context, dashboards.GenieCreateSpaceRequest) (*dashboards.GenieSpace, error)) *MockGenieInterface_CreateSpace_Call { + _c.Call.Return(run) + return _c +} + // DeleteConversation provides a mock function with given fields: ctx, request func (_m *MockGenieInterface) DeleteConversation(ctx context.Context, request dashboards.GenieDeleteConversationRequest) error { ret := _m.Called(ctx, request) @@ -254,6 +313,53 @@ func (_c *MockGenieInterface_DeleteConversationBySpaceIdAndConversationId_Call) return _c } +// DeleteConversationMessage provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) DeleteConversationMessage(ctx context.Context, request dashboards.GenieDeleteConversationMessageRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteConversationMessage") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieDeleteConversationMessageRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockGenieInterface_DeleteConversationMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteConversationMessage' +type MockGenieInterface_DeleteConversationMessage_Call struct { + *mock.Call +} + +// DeleteConversationMessage is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieDeleteConversationMessageRequest +func (_e *MockGenieInterface_Expecter) DeleteConversationMessage(ctx interface{}, request interface{}) *MockGenieInterface_DeleteConversationMessage_Call { + return &MockGenieInterface_DeleteConversationMessage_Call{Call: _e.mock.On("DeleteConversationMessage", ctx, request)} +} + +func (_c *MockGenieInterface_DeleteConversationMessage_Call) Run(run func(ctx context.Context, request dashboards.GenieDeleteConversationMessageRequest)) *MockGenieInterface_DeleteConversationMessage_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieDeleteConversationMessageRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_DeleteConversationMessage_Call) Return(_a0 error) *MockGenieInterface_DeleteConversationMessage_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockGenieInterface_DeleteConversationMessage_Call) RunAndReturn(run func(context.Context, dashboards.GenieDeleteConversationMessageRequest) error) *MockGenieInterface_DeleteConversationMessage_Call { + _c.Call.Return(run) + return _c +} + // ExecuteMessageAttachmentQuery provides a mock function with given fields: ctx, request func (_m *MockGenieInterface) ExecuteMessageAttachmentQuery(ctx context.Context, request dashboards.GenieExecuteMessageAttachmentQueryRequest) (*dashboards.GenieGetMessageQueryResultResponse, error) { ret := _m.Called(ctx, request) @@ -372,6 +478,187 @@ func (_c *MockGenieInterface_ExecuteMessageQuery_Call) RunAndReturn(run func(con return _c } +// GenerateDownloadFullQueryResult provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) GenerateDownloadFullQueryResult(ctx context.Context, request dashboards.GenieGenerateDownloadFullQueryResultRequest) (*dashboards.GenieGenerateDownloadFullQueryResultResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GenerateDownloadFullQueryResult") + } + + var r0 *dashboards.GenieGenerateDownloadFullQueryResultResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieGenerateDownloadFullQueryResultRequest) (*dashboards.GenieGenerateDownloadFullQueryResultResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieGenerateDownloadFullQueryResultRequest) *dashboards.GenieGenerateDownloadFullQueryResultResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieGenerateDownloadFullQueryResultResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GenieGenerateDownloadFullQueryResultRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_GenerateDownloadFullQueryResult_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GenerateDownloadFullQueryResult' +type MockGenieInterface_GenerateDownloadFullQueryResult_Call struct { + *mock.Call +} + +// GenerateDownloadFullQueryResult is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieGenerateDownloadFullQueryResultRequest +func (_e *MockGenieInterface_Expecter) GenerateDownloadFullQueryResult(ctx interface{}, request interface{}) *MockGenieInterface_GenerateDownloadFullQueryResult_Call { + return &MockGenieInterface_GenerateDownloadFullQueryResult_Call{Call: _e.mock.On("GenerateDownloadFullQueryResult", ctx, request)} +} + +func (_c *MockGenieInterface_GenerateDownloadFullQueryResult_Call) Run(run func(ctx context.Context, request dashboards.GenieGenerateDownloadFullQueryResultRequest)) *MockGenieInterface_GenerateDownloadFullQueryResult_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieGenerateDownloadFullQueryResultRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_GenerateDownloadFullQueryResult_Call) Return(_a0 *dashboards.GenieGenerateDownloadFullQueryResultResponse, _a1 error) *MockGenieInterface_GenerateDownloadFullQueryResult_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_GenerateDownloadFullQueryResult_Call) RunAndReturn(run func(context.Context, dashboards.GenieGenerateDownloadFullQueryResultRequest) (*dashboards.GenieGenerateDownloadFullQueryResultResponse, error)) *MockGenieInterface_GenerateDownloadFullQueryResult_Call { + _c.Call.Return(run) + return _c +} + +// GetDownloadFullQueryResult provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) GetDownloadFullQueryResult(ctx context.Context, request dashboards.GenieGetDownloadFullQueryResultRequest) (*dashboards.GenieGetDownloadFullQueryResultResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDownloadFullQueryResult") + } + + var r0 *dashboards.GenieGetDownloadFullQueryResultResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieGetDownloadFullQueryResultRequest) (*dashboards.GenieGetDownloadFullQueryResultResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieGetDownloadFullQueryResultRequest) *dashboards.GenieGetDownloadFullQueryResultResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieGetDownloadFullQueryResultResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GenieGetDownloadFullQueryResultRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_GetDownloadFullQueryResult_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDownloadFullQueryResult' +type MockGenieInterface_GetDownloadFullQueryResult_Call struct { + *mock.Call +} + +// GetDownloadFullQueryResult is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieGetDownloadFullQueryResultRequest +func (_e *MockGenieInterface_Expecter) GetDownloadFullQueryResult(ctx interface{}, request interface{}) *MockGenieInterface_GetDownloadFullQueryResult_Call { + return &MockGenieInterface_GetDownloadFullQueryResult_Call{Call: _e.mock.On("GetDownloadFullQueryResult", ctx, request)} +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResult_Call) Run(run func(ctx context.Context, request dashboards.GenieGetDownloadFullQueryResultRequest)) *MockGenieInterface_GetDownloadFullQueryResult_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieGetDownloadFullQueryResultRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResult_Call) Return(_a0 *dashboards.GenieGetDownloadFullQueryResultResponse, _a1 error) *MockGenieInterface_GetDownloadFullQueryResult_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResult_Call) RunAndReturn(run func(context.Context, dashboards.GenieGetDownloadFullQueryResultRequest) (*dashboards.GenieGetDownloadFullQueryResultResponse, error)) *MockGenieInterface_GetDownloadFullQueryResult_Call { + _c.Call.Return(run) + return _c +} + +// GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId provides a mock function with given fields: ctx, spaceId, conversationId, messageId, attachmentId, downloadId +func (_m *MockGenieInterface) GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string, downloadId string) (*dashboards.GenieGetDownloadFullQueryResultResponse, error) { + ret := _m.Called(ctx, spaceId, conversationId, messageId, attachmentId, downloadId) + + if len(ret) == 0 { + panic("no return value specified for GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId") + } + + var r0 *dashboards.GenieGetDownloadFullQueryResultResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, string) (*dashboards.GenieGetDownloadFullQueryResultResponse, error)); ok { + return rf(ctx, spaceId, conversationId, messageId, attachmentId, downloadId) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, string) *dashboards.GenieGetDownloadFullQueryResultResponse); ok { + r0 = rf(ctx, spaceId, conversationId, messageId, attachmentId, downloadId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieGetDownloadFullQueryResultResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, string) error); ok { + r1 = rf(ctx, spaceId, conversationId, messageId, attachmentId, downloadId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId' +type MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call struct { + *mock.Call +} + +// GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId is a helper method to define mock.On call +// - ctx context.Context +// - spaceId string +// - conversationId string +// - messageId string +// - attachmentId string +// - downloadId string +func (_e *MockGenieInterface_Expecter) GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId(ctx interface{}, spaceId interface{}, conversationId interface{}, messageId interface{}, attachmentId interface{}, downloadId interface{}) *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call { + return &MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call{Call: _e.mock.On("GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId", ctx, spaceId, conversationId, messageId, attachmentId, downloadId)} +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call) Run(run func(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string, downloadId string)) *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(string), args[4].(string), args[5].(string)) + }) + return _c +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call) Return(_a0 *dashboards.GenieGetDownloadFullQueryResultResponse, _a1 error) *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call) RunAndReturn(run func(context.Context, string, string, string, string, string) (*dashboards.GenieGetDownloadFullQueryResultResponse, error)) *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call { + _c.Call.Return(run) + return _c +} + // GetMessage provides a mock function with given fields: ctx, request func (_m *MockGenieInterface) GetMessage(ctx context.Context, request dashboards.GenieGetConversationMessageRequest) (*dashboards.GenieMessage, error) { ret := _m.Called(ctx, request) @@ -972,6 +1259,65 @@ func (_c *MockGenieInterface_GetSpaceBySpaceId_Call) RunAndReturn(run func(conte return _c } +// ListConversationMessages provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) ListConversationMessages(ctx context.Context, request dashboards.GenieListConversationMessagesRequest) (*dashboards.GenieListConversationMessagesResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListConversationMessages") + } + + var r0 *dashboards.GenieListConversationMessagesResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieListConversationMessagesRequest) (*dashboards.GenieListConversationMessagesResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieListConversationMessagesRequest) *dashboards.GenieListConversationMessagesResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieListConversationMessagesResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GenieListConversationMessagesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_ListConversationMessages_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListConversationMessages' +type MockGenieInterface_ListConversationMessages_Call struct { + *mock.Call +} + +// ListConversationMessages is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieListConversationMessagesRequest +func (_e *MockGenieInterface_Expecter) ListConversationMessages(ctx interface{}, request interface{}) *MockGenieInterface_ListConversationMessages_Call { + return &MockGenieInterface_ListConversationMessages_Call{Call: _e.mock.On("ListConversationMessages", ctx, request)} +} + +func (_c *MockGenieInterface_ListConversationMessages_Call) Run(run func(ctx context.Context, request dashboards.GenieListConversationMessagesRequest)) *MockGenieInterface_ListConversationMessages_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieListConversationMessagesRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_ListConversationMessages_Call) Return(_a0 *dashboards.GenieListConversationMessagesResponse, _a1 error) *MockGenieInterface_ListConversationMessages_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_ListConversationMessages_Call) RunAndReturn(run func(context.Context, dashboards.GenieListConversationMessagesRequest) (*dashboards.GenieListConversationMessagesResponse, error)) *MockGenieInterface_ListConversationMessages_Call { + _c.Call.Return(run) + return _c +} + // ListConversations provides a mock function with given fields: ctx, request func (_m *MockGenieInterface) ListConversations(ctx context.Context, request dashboards.GenieListConversationsRequest) (*dashboards.GenieListConversationsResponse, error) { ret := _m.Called(ctx, request) @@ -1149,6 +1495,53 @@ func (_c *MockGenieInterface_ListSpaces_Call) RunAndReturn(run func(context.Cont return _c } +// SendMessageFeedback provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) SendMessageFeedback(ctx context.Context, request dashboards.GenieSendMessageFeedbackRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for SendMessageFeedback") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieSendMessageFeedbackRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockGenieInterface_SendMessageFeedback_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendMessageFeedback' +type MockGenieInterface_SendMessageFeedback_Call struct { + *mock.Call +} + +// SendMessageFeedback is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieSendMessageFeedbackRequest +func (_e *MockGenieInterface_Expecter) SendMessageFeedback(ctx interface{}, request interface{}) *MockGenieInterface_SendMessageFeedback_Call { + return &MockGenieInterface_SendMessageFeedback_Call{Call: _e.mock.On("SendMessageFeedback", ctx, request)} +} + +func (_c *MockGenieInterface_SendMessageFeedback_Call) Run(run func(ctx context.Context, request dashboards.GenieSendMessageFeedbackRequest)) *MockGenieInterface_SendMessageFeedback_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieSendMessageFeedbackRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_SendMessageFeedback_Call) Return(_a0 error) *MockGenieInterface_SendMessageFeedback_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockGenieInterface_SendMessageFeedback_Call) RunAndReturn(run func(context.Context, dashboards.GenieSendMessageFeedbackRequest) error) *MockGenieInterface_SendMessageFeedback_Call { + _c.Call.Return(run) + return _c +} + // StartConversation provides a mock function with given fields: ctx, genieStartConversationMessageRequest func (_m *MockGenieInterface) StartConversation(ctx context.Context, genieStartConversationMessageRequest dashboards.GenieStartConversationMessageRequest) (*dashboards.WaitGetMessageGenieCompleted[dashboards.GenieStartConversationResponse], error) { ret := _m.Called(ctx, genieStartConversationMessageRequest) @@ -1376,6 +1769,65 @@ func (_c *MockGenieInterface_TrashSpaceBySpaceId_Call) RunAndReturn(run func(con return _c } +// UpdateSpace provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) UpdateSpace(ctx context.Context, request dashboards.GenieUpdateSpaceRequest) (*dashboards.GenieSpace, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateSpace") + } + + var r0 *dashboards.GenieSpace + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieUpdateSpaceRequest) (*dashboards.GenieSpace, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieUpdateSpaceRequest) *dashboards.GenieSpace); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieSpace) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GenieUpdateSpaceRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_UpdateSpace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateSpace' +type MockGenieInterface_UpdateSpace_Call struct { + *mock.Call +} + +// UpdateSpace is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieUpdateSpaceRequest +func (_e *MockGenieInterface_Expecter) UpdateSpace(ctx interface{}, request interface{}) *MockGenieInterface_UpdateSpace_Call { + return &MockGenieInterface_UpdateSpace_Call{Call: _e.mock.On("UpdateSpace", ctx, request)} +} + +func (_c *MockGenieInterface_UpdateSpace_Call) Run(run func(ctx context.Context, request dashboards.GenieUpdateSpaceRequest)) *MockGenieInterface_UpdateSpace_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieUpdateSpaceRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_UpdateSpace_Call) Return(_a0 *dashboards.GenieSpace, _a1 error) *MockGenieInterface_UpdateSpace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_UpdateSpace_Call) RunAndReturn(run func(context.Context, dashboards.GenieUpdateSpaceRequest) (*dashboards.GenieSpace, error)) *MockGenieInterface_UpdateSpace_Call { + _c.Call.Return(run) + return _c +} + // WaitGetMessageGenieCompleted provides a mock function with given fields: ctx, conversationId, messageId, spaceId, timeout, callback func (_m *MockGenieInterface) WaitGetMessageGenieCompleted(ctx context.Context, conversationId string, messageId string, spaceId string, timeout time.Duration, callback func(*dashboards.GenieMessage)) (*dashboards.GenieMessage, error) { ret := _m.Called(ctx, conversationId, messageId, spaceId, timeout, callback) diff --git a/experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go b/experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go index eea99e9b6..51479c6ef 100644 --- a/experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go +++ b/experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go @@ -22,6 +22,100 @@ func (_m *MockLakeviewEmbeddedInterface) EXPECT() *MockLakeviewEmbeddedInterface return &MockLakeviewEmbeddedInterface_Expecter{mock: &_m.Mock} } +// GetPublishedDashboardEmbedded provides a mock function with given fields: ctx, request +func (_m *MockLakeviewEmbeddedInterface) GetPublishedDashboardEmbedded(ctx context.Context, request dashboards.GetPublishedDashboardEmbeddedRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetPublishedDashboardEmbedded") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetPublishedDashboardEmbeddedRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublishedDashboardEmbedded' +type MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call struct { + *mock.Call +} + +// GetPublishedDashboardEmbedded is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GetPublishedDashboardEmbeddedRequest +func (_e *MockLakeviewEmbeddedInterface_Expecter) GetPublishedDashboardEmbedded(ctx interface{}, request interface{}) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call { + return &MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call{Call: _e.mock.On("GetPublishedDashboardEmbedded", ctx, request)} +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call) Run(run func(ctx context.Context, request dashboards.GetPublishedDashboardEmbeddedRequest)) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GetPublishedDashboardEmbeddedRequest)) + }) + return _c +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call) Return(_a0 error) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call) RunAndReturn(run func(context.Context, dashboards.GetPublishedDashboardEmbeddedRequest) error) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call { + _c.Call.Return(run) + return _c +} + +// GetPublishedDashboardEmbeddedByDashboardId provides a mock function with given fields: ctx, dashboardId +func (_m *MockLakeviewEmbeddedInterface) GetPublishedDashboardEmbeddedByDashboardId(ctx context.Context, dashboardId string) error { + ret := _m.Called(ctx, dashboardId) + + if len(ret) == 0 { + panic("no return value specified for GetPublishedDashboardEmbeddedByDashboardId") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, dashboardId) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublishedDashboardEmbeddedByDashboardId' +type MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call struct { + *mock.Call +} + +// GetPublishedDashboardEmbeddedByDashboardId is a helper method to define mock.On call +// - ctx context.Context +// - dashboardId string +func (_e *MockLakeviewEmbeddedInterface_Expecter) GetPublishedDashboardEmbeddedByDashboardId(ctx interface{}, dashboardId interface{}) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call { + return &MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call{Call: _e.mock.On("GetPublishedDashboardEmbeddedByDashboardId", ctx, dashboardId)} +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call) Run(run func(ctx context.Context, dashboardId string)) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call) Return(_a0 error) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call) RunAndReturn(run func(context.Context, string) error) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call { + _c.Call.Return(run) + return _c +} + // GetPublishedDashboardTokenInfo provides a mock function with given fields: ctx, request func (_m *MockLakeviewEmbeddedInterface) GetPublishedDashboardTokenInfo(ctx context.Context, request dashboards.GetPublishedDashboardTokenInfoRequest) (*dashboards.GetPublishedDashboardTokenInfoResponse, error) { ret := _m.Called(ctx, request) diff --git a/experimental/mocks/service/dashboards/mock_query_execution_interface.go b/experimental/mocks/service/dashboards/mock_query_execution_interface.go new file mode 100644 index 000000000..ead40a712 --- /dev/null +++ b/experimental/mocks/service/dashboards/mock_query_execution_interface.go @@ -0,0 +1,202 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package dashboards + +import ( + context "context" + + dashboards "github.com/databricks/databricks-sdk-go/service/dashboards" + mock "github.com/stretchr/testify/mock" +) + +// MockQueryExecutionInterface is an autogenerated mock type for the QueryExecutionInterface type +type MockQueryExecutionInterface struct { + mock.Mock +} + +type MockQueryExecutionInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockQueryExecutionInterface) EXPECT() *MockQueryExecutionInterface_Expecter { + return &MockQueryExecutionInterface_Expecter{mock: &_m.Mock} +} + +// CancelPublishedQueryExecution provides a mock function with given fields: ctx, request +func (_m *MockQueryExecutionInterface) CancelPublishedQueryExecution(ctx context.Context, request dashboards.CancelPublishedQueryExecutionRequest) (*dashboards.CancelQueryExecutionResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CancelPublishedQueryExecution") + } + + var r0 *dashboards.CancelQueryExecutionResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.CancelPublishedQueryExecutionRequest) (*dashboards.CancelQueryExecutionResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.CancelPublishedQueryExecutionRequest) *dashboards.CancelQueryExecutionResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.CancelQueryExecutionResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.CancelPublishedQueryExecutionRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQueryExecutionInterface_CancelPublishedQueryExecution_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CancelPublishedQueryExecution' +type MockQueryExecutionInterface_CancelPublishedQueryExecution_Call struct { + *mock.Call +} + +// CancelPublishedQueryExecution is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.CancelPublishedQueryExecutionRequest +func (_e *MockQueryExecutionInterface_Expecter) CancelPublishedQueryExecution(ctx interface{}, request interface{}) *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call { + return &MockQueryExecutionInterface_CancelPublishedQueryExecution_Call{Call: _e.mock.On("CancelPublishedQueryExecution", ctx, request)} +} + +func (_c *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call) Run(run func(ctx context.Context, request dashboards.CancelPublishedQueryExecutionRequest)) *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.CancelPublishedQueryExecutionRequest)) + }) + return _c +} + +func (_c *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call) Return(_a0 *dashboards.CancelQueryExecutionResponse, _a1 error) *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call) RunAndReturn(run func(context.Context, dashboards.CancelPublishedQueryExecutionRequest) (*dashboards.CancelQueryExecutionResponse, error)) *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call { + _c.Call.Return(run) + return _c +} + +// ExecutePublishedDashboardQuery provides a mock function with given fields: ctx, request +func (_m *MockQueryExecutionInterface) ExecutePublishedDashboardQuery(ctx context.Context, request dashboards.ExecutePublishedDashboardQueryRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ExecutePublishedDashboardQuery") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.ExecutePublishedDashboardQueryRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecutePublishedDashboardQuery' +type MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call struct { + *mock.Call +} + +// ExecutePublishedDashboardQuery is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.ExecutePublishedDashboardQueryRequest +func (_e *MockQueryExecutionInterface_Expecter) ExecutePublishedDashboardQuery(ctx interface{}, request interface{}) *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call { + return &MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call{Call: _e.mock.On("ExecutePublishedDashboardQuery", ctx, request)} +} + +func (_c *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call) Run(run func(ctx context.Context, request dashboards.ExecutePublishedDashboardQueryRequest)) *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.ExecutePublishedDashboardQueryRequest)) + }) + return _c +} + +func (_c *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call) Return(_a0 error) *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call) RunAndReturn(run func(context.Context, dashboards.ExecutePublishedDashboardQueryRequest) error) *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call { + _c.Call.Return(run) + return _c +} + +// PollPublishedQueryStatus provides a mock function with given fields: ctx, request +func (_m *MockQueryExecutionInterface) PollPublishedQueryStatus(ctx context.Context, request dashboards.PollPublishedQueryStatusRequest) (*dashboards.PollQueryStatusResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for PollPublishedQueryStatus") + } + + var r0 *dashboards.PollQueryStatusResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.PollPublishedQueryStatusRequest) (*dashboards.PollQueryStatusResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.PollPublishedQueryStatusRequest) *dashboards.PollQueryStatusResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.PollQueryStatusResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.PollPublishedQueryStatusRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQueryExecutionInterface_PollPublishedQueryStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PollPublishedQueryStatus' +type MockQueryExecutionInterface_PollPublishedQueryStatus_Call struct { + *mock.Call +} + +// PollPublishedQueryStatus is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.PollPublishedQueryStatusRequest +func (_e *MockQueryExecutionInterface_Expecter) PollPublishedQueryStatus(ctx interface{}, request interface{}) *MockQueryExecutionInterface_PollPublishedQueryStatus_Call { + return &MockQueryExecutionInterface_PollPublishedQueryStatus_Call{Call: _e.mock.On("PollPublishedQueryStatus", ctx, request)} +} + +func (_c *MockQueryExecutionInterface_PollPublishedQueryStatus_Call) Run(run func(ctx context.Context, request dashboards.PollPublishedQueryStatusRequest)) *MockQueryExecutionInterface_PollPublishedQueryStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.PollPublishedQueryStatusRequest)) + }) + return _c +} + +func (_c *MockQueryExecutionInterface_PollPublishedQueryStatus_Call) Return(_a0 *dashboards.PollQueryStatusResponse, _a1 error) *MockQueryExecutionInterface_PollPublishedQueryStatus_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQueryExecutionInterface_PollPublishedQueryStatus_Call) RunAndReturn(run func(context.Context, dashboards.PollPublishedQueryStatusRequest) (*dashboards.PollQueryStatusResponse, error)) *MockQueryExecutionInterface_PollPublishedQueryStatus_Call { + _c.Call.Return(run) + return _c +} + +// NewMockQueryExecutionInterface creates a new instance of MockQueryExecutionInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockQueryExecutionInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockQueryExecutionInterface { + mock := &MockQueryExecutionInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/database/mock_database_interface.go b/experimental/mocks/service/database/mock_database_interface.go index d9ec59217..89e845e40 100644 --- a/experimental/mocks/service/database/mock_database_interface.go +++ b/experimental/mocks/service/database/mock_database_interface.go @@ -868,6 +868,65 @@ func (_c *MockDatabaseInterface_DeleteSyncedDatabaseTableByName_Call) RunAndRetu return _c } +// FailoverDatabaseInstance provides a mock function with given fields: ctx, request +func (_m *MockDatabaseInterface) FailoverDatabaseInstance(ctx context.Context, request database.FailoverDatabaseInstanceRequest) (*database.DatabaseInstance, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for FailoverDatabaseInstance") + } + + var r0 *database.DatabaseInstance + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.FailoverDatabaseInstanceRequest) (*database.DatabaseInstance, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.FailoverDatabaseInstanceRequest) *database.DatabaseInstance); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseInstance) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.FailoverDatabaseInstanceRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseInterface_FailoverDatabaseInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FailoverDatabaseInstance' +type MockDatabaseInterface_FailoverDatabaseInstance_Call struct { + *mock.Call +} + +// FailoverDatabaseInstance is a helper method to define mock.On call +// - ctx context.Context +// - request database.FailoverDatabaseInstanceRequest +func (_e *MockDatabaseInterface_Expecter) FailoverDatabaseInstance(ctx interface{}, request interface{}) *MockDatabaseInterface_FailoverDatabaseInstance_Call { + return &MockDatabaseInterface_FailoverDatabaseInstance_Call{Call: _e.mock.On("FailoverDatabaseInstance", ctx, request)} +} + +func (_c *MockDatabaseInterface_FailoverDatabaseInstance_Call) Run(run func(ctx context.Context, request database.FailoverDatabaseInstanceRequest)) *MockDatabaseInterface_FailoverDatabaseInstance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.FailoverDatabaseInstanceRequest)) + }) + return _c +} + +func (_c *MockDatabaseInterface_FailoverDatabaseInstance_Call) Return(_a0 *database.DatabaseInstance, _a1 error) *MockDatabaseInterface_FailoverDatabaseInstance_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseInterface_FailoverDatabaseInstance_Call) RunAndReturn(run func(context.Context, database.FailoverDatabaseInstanceRequest) (*database.DatabaseInstance, error)) *MockDatabaseInterface_FailoverDatabaseInstance_Call { + _c.Call.Return(run) + return _c +} + // FindDatabaseInstanceByUid provides a mock function with given fields: ctx, request func (_m *MockDatabaseInterface) FindDatabaseInstanceByUid(ctx context.Context, request database.FindDatabaseInstanceByUidRequest) (*database.DatabaseInstance, error) { ret := _m.Called(ctx, request) @@ -2304,6 +2363,65 @@ func (_c *MockDatabaseInterface_UpdateDatabaseInstance_Call) RunAndReturn(run fu return _c } +// UpdateDatabaseInstanceRole provides a mock function with given fields: ctx, request +func (_m *MockDatabaseInterface) UpdateDatabaseInstanceRole(ctx context.Context, request database.UpdateDatabaseInstanceRoleRequest) (*database.DatabaseInstanceRole, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseInstanceRole") + } + + var r0 *database.DatabaseInstanceRole + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseInstanceRoleRequest) (*database.DatabaseInstanceRole, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseInstanceRoleRequest) *database.DatabaseInstanceRole); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseInstanceRole) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.UpdateDatabaseInstanceRoleRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseInterface_UpdateDatabaseInstanceRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseInstanceRole' +type MockDatabaseInterface_UpdateDatabaseInstanceRole_Call struct { + *mock.Call +} + +// UpdateDatabaseInstanceRole is a helper method to define mock.On call +// - ctx context.Context +// - request database.UpdateDatabaseInstanceRoleRequest +func (_e *MockDatabaseInterface_Expecter) UpdateDatabaseInstanceRole(ctx interface{}, request interface{}) *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call { + return &MockDatabaseInterface_UpdateDatabaseInstanceRole_Call{Call: _e.mock.On("UpdateDatabaseInstanceRole", ctx, request)} +} + +func (_c *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call) Run(run func(ctx context.Context, request database.UpdateDatabaseInstanceRoleRequest)) *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.UpdateDatabaseInstanceRoleRequest)) + }) + return _c +} + +func (_c *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call) Return(_a0 *database.DatabaseInstanceRole, _a1 error) *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call) RunAndReturn(run func(context.Context, database.UpdateDatabaseInstanceRoleRequest) (*database.DatabaseInstanceRole, error)) *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call { + _c.Call.Return(run) + return _c +} + // UpdateSyncedDatabaseTable provides a mock function with given fields: ctx, request func (_m *MockDatabaseInterface) UpdateSyncedDatabaseTable(ctx context.Context, request database.UpdateSyncedDatabaseTableRequest) (*database.SyncedDatabaseTable, error) { ret := _m.Called(ctx, request) diff --git a/experimental/mocks/service/database/mock_database_project_interface.go b/experimental/mocks/service/database/mock_database_project_interface.go new file mode 100644 index 000000000..505951593 --- /dev/null +++ b/experimental/mocks/service/database/mock_database_project_interface.go @@ -0,0 +1,1094 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package database + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + database "github.com/databricks/databricks-sdk-go/service/database" + + mock "github.com/stretchr/testify/mock" +) + +// MockDatabaseProjectInterface is an autogenerated mock type for the DatabaseProjectInterface type +type MockDatabaseProjectInterface struct { + mock.Mock +} + +type MockDatabaseProjectInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockDatabaseProjectInterface) EXPECT() *MockDatabaseProjectInterface_Expecter { + return &MockDatabaseProjectInterface_Expecter{mock: &_m.Mock} +} + +// CreateDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) CreateDatabaseBranch(ctx context.Context, request database.CreateDatabaseBranchRequest) (*database.DatabaseBranch, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDatabaseBranch") + } + + var r0 *database.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseBranchRequest) (*database.DatabaseBranch, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseBranchRequest) *database.DatabaseBranch); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.CreateDatabaseBranchRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_CreateDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDatabaseBranch' +type MockDatabaseProjectInterface_CreateDatabaseBranch_Call struct { + *mock.Call +} + +// CreateDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request database.CreateDatabaseBranchRequest +func (_e *MockDatabaseProjectInterface_Expecter) CreateDatabaseBranch(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_CreateDatabaseBranch_Call { + return &MockDatabaseProjectInterface_CreateDatabaseBranch_Call{Call: _e.mock.On("CreateDatabaseBranch", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseBranch_Call) Run(run func(ctx context.Context, request database.CreateDatabaseBranchRequest)) *MockDatabaseProjectInterface_CreateDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.CreateDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseBranch_Call) Return(_a0 *database.DatabaseBranch, _a1 error) *MockDatabaseProjectInterface_CreateDatabaseBranch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseBranch_Call) RunAndReturn(run func(context.Context, database.CreateDatabaseBranchRequest) (*database.DatabaseBranch, error)) *MockDatabaseProjectInterface_CreateDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// CreateDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) CreateDatabaseEndpoint(ctx context.Context, request database.CreateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDatabaseEndpoint") + } + + var r0 *database.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseEndpointRequest) *database.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.CreateDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDatabaseEndpoint' +type MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call struct { + *mock.Call +} + +// CreateDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request database.CreateDatabaseEndpointRequest +func (_e *MockDatabaseProjectInterface_Expecter) CreateDatabaseEndpoint(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call { + return &MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call{Call: _e.mock.On("CreateDatabaseEndpoint", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call) Run(run func(ctx context.Context, request database.CreateDatabaseEndpointRequest)) *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.CreateDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call) Return(_a0 *database.DatabaseEndpoint, _a1 error) *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, database.CreateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)) *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// CreateDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) CreateDatabaseProject(ctx context.Context, request database.CreateDatabaseProjectRequest) (*database.DatabaseProject, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDatabaseProject") + } + + var r0 *database.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseProjectRequest) (*database.DatabaseProject, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseProjectRequest) *database.DatabaseProject); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.CreateDatabaseProjectRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_CreateDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDatabaseProject' +type MockDatabaseProjectInterface_CreateDatabaseProject_Call struct { + *mock.Call +} + +// CreateDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request database.CreateDatabaseProjectRequest +func (_e *MockDatabaseProjectInterface_Expecter) CreateDatabaseProject(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_CreateDatabaseProject_Call { + return &MockDatabaseProjectInterface_CreateDatabaseProject_Call{Call: _e.mock.On("CreateDatabaseProject", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseProject_Call) Run(run func(ctx context.Context, request database.CreateDatabaseProjectRequest)) *MockDatabaseProjectInterface_CreateDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.CreateDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseProject_Call) Return(_a0 *database.DatabaseProject, _a1 error) *MockDatabaseProjectInterface_CreateDatabaseProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseProject_Call) RunAndReturn(run func(context.Context, database.CreateDatabaseProjectRequest) (*database.DatabaseProject, error)) *MockDatabaseProjectInterface_CreateDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) DeleteDatabaseBranch(ctx context.Context, request database.DeleteDatabaseBranchRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteDatabaseBranch") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, database.DeleteDatabaseBranchRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockDatabaseProjectInterface_DeleteDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDatabaseBranch' +type MockDatabaseProjectInterface_DeleteDatabaseBranch_Call struct { + *mock.Call +} + +// DeleteDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request database.DeleteDatabaseBranchRequest +func (_e *MockDatabaseProjectInterface_Expecter) DeleteDatabaseBranch(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call { + return &MockDatabaseProjectInterface_DeleteDatabaseBranch_Call{Call: _e.mock.On("DeleteDatabaseBranch", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call) Run(run func(ctx context.Context, request database.DeleteDatabaseBranchRequest)) *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.DeleteDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call) Return(_a0 error) *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call) RunAndReturn(run func(context.Context, database.DeleteDatabaseBranchRequest) error) *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) DeleteDatabaseEndpoint(ctx context.Context, request database.DeleteDatabaseEndpointRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteDatabaseEndpoint") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, database.DeleteDatabaseEndpointRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDatabaseEndpoint' +type MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call struct { + *mock.Call +} + +// DeleteDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request database.DeleteDatabaseEndpointRequest +func (_e *MockDatabaseProjectInterface_Expecter) DeleteDatabaseEndpoint(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call { + return &MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call{Call: _e.mock.On("DeleteDatabaseEndpoint", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call) Run(run func(ctx context.Context, request database.DeleteDatabaseEndpointRequest)) *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.DeleteDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call) Return(_a0 error) *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, database.DeleteDatabaseEndpointRequest) error) *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) DeleteDatabaseProject(ctx context.Context, request database.DeleteDatabaseProjectRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteDatabaseProject") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, database.DeleteDatabaseProjectRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockDatabaseProjectInterface_DeleteDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDatabaseProject' +type MockDatabaseProjectInterface_DeleteDatabaseProject_Call struct { + *mock.Call +} + +// DeleteDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request database.DeleteDatabaseProjectRequest +func (_e *MockDatabaseProjectInterface_Expecter) DeleteDatabaseProject(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_DeleteDatabaseProject_Call { + return &MockDatabaseProjectInterface_DeleteDatabaseProject_Call{Call: _e.mock.On("DeleteDatabaseProject", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseProject_Call) Run(run func(ctx context.Context, request database.DeleteDatabaseProjectRequest)) *MockDatabaseProjectInterface_DeleteDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.DeleteDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseProject_Call) Return(_a0 error) *MockDatabaseProjectInterface_DeleteDatabaseProject_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseProject_Call) RunAndReturn(run func(context.Context, database.DeleteDatabaseProjectRequest) error) *MockDatabaseProjectInterface_DeleteDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) GetDatabaseBranch(ctx context.Context, request database.GetDatabaseBranchRequest) (*database.DatabaseBranch, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDatabaseBranch") + } + + var r0 *database.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseBranchRequest) (*database.DatabaseBranch, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseBranchRequest) *database.DatabaseBranch); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.GetDatabaseBranchRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_GetDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseBranch' +type MockDatabaseProjectInterface_GetDatabaseBranch_Call struct { + *mock.Call +} + +// GetDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request database.GetDatabaseBranchRequest +func (_e *MockDatabaseProjectInterface_Expecter) GetDatabaseBranch(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_GetDatabaseBranch_Call { + return &MockDatabaseProjectInterface_GetDatabaseBranch_Call{Call: _e.mock.On("GetDatabaseBranch", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseBranch_Call) Run(run func(ctx context.Context, request database.GetDatabaseBranchRequest)) *MockDatabaseProjectInterface_GetDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.GetDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseBranch_Call) Return(_a0 *database.DatabaseBranch, _a1 error) *MockDatabaseProjectInterface_GetDatabaseBranch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseBranch_Call) RunAndReturn(run func(context.Context, database.GetDatabaseBranchRequest) (*database.DatabaseBranch, error)) *MockDatabaseProjectInterface_GetDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) GetDatabaseEndpoint(ctx context.Context, request database.GetDatabaseEndpointRequest) (*database.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDatabaseEndpoint") + } + + var r0 *database.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseEndpointRequest) *database.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.GetDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_GetDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseEndpoint' +type MockDatabaseProjectInterface_GetDatabaseEndpoint_Call struct { + *mock.Call +} + +// GetDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request database.GetDatabaseEndpointRequest +func (_e *MockDatabaseProjectInterface_Expecter) GetDatabaseEndpoint(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call { + return &MockDatabaseProjectInterface_GetDatabaseEndpoint_Call{Call: _e.mock.On("GetDatabaseEndpoint", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call) Run(run func(ctx context.Context, request database.GetDatabaseEndpointRequest)) *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.GetDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call) Return(_a0 *database.DatabaseEndpoint, _a1 error) *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, database.GetDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)) *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) GetDatabaseProject(ctx context.Context, request database.GetDatabaseProjectRequest) (*database.DatabaseProject, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDatabaseProject") + } + + var r0 *database.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseProjectRequest) (*database.DatabaseProject, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseProjectRequest) *database.DatabaseProject); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.GetDatabaseProjectRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_GetDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseProject' +type MockDatabaseProjectInterface_GetDatabaseProject_Call struct { + *mock.Call +} + +// GetDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request database.GetDatabaseProjectRequest +func (_e *MockDatabaseProjectInterface_Expecter) GetDatabaseProject(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_GetDatabaseProject_Call { + return &MockDatabaseProjectInterface_GetDatabaseProject_Call{Call: _e.mock.On("GetDatabaseProject", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseProject_Call) Run(run func(ctx context.Context, request database.GetDatabaseProjectRequest)) *MockDatabaseProjectInterface_GetDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.GetDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseProject_Call) Return(_a0 *database.DatabaseProject, _a1 error) *MockDatabaseProjectInterface_GetDatabaseProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseProject_Call) RunAndReturn(run func(context.Context, database.GetDatabaseProjectRequest) (*database.DatabaseProject, error)) *MockDatabaseProjectInterface_GetDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseBranches provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseBranches(ctx context.Context, request database.ListDatabaseBranchesRequest) listing.Iterator[database.DatabaseBranch] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseBranches") + } + + var r0 listing.Iterator[database.DatabaseBranch] + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseBranchesRequest) listing.Iterator[database.DatabaseBranch]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[database.DatabaseBranch]) + } + } + + return r0 +} + +// MockDatabaseProjectInterface_ListDatabaseBranches_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseBranches' +type MockDatabaseProjectInterface_ListDatabaseBranches_Call struct { + *mock.Call +} + +// ListDatabaseBranches is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseBranchesRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseBranches(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseBranches_Call { + return &MockDatabaseProjectInterface_ListDatabaseBranches_Call{Call: _e.mock.On("ListDatabaseBranches", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranches_Call) Run(run func(ctx context.Context, request database.ListDatabaseBranchesRequest)) *MockDatabaseProjectInterface_ListDatabaseBranches_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseBranchesRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranches_Call) Return(_a0 listing.Iterator[database.DatabaseBranch]) *MockDatabaseProjectInterface_ListDatabaseBranches_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranches_Call) RunAndReturn(run func(context.Context, database.ListDatabaseBranchesRequest) listing.Iterator[database.DatabaseBranch]) *MockDatabaseProjectInterface_ListDatabaseBranches_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseBranchesAll provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseBranchesAll(ctx context.Context, request database.ListDatabaseBranchesRequest) ([]database.DatabaseBranch, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseBranchesAll") + } + + var r0 []database.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseBranchesRequest) ([]database.DatabaseBranch, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseBranchesRequest) []database.DatabaseBranch); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]database.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.ListDatabaseBranchesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseBranchesAll' +type MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call struct { + *mock.Call +} + +// ListDatabaseBranchesAll is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseBranchesRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseBranchesAll(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call { + return &MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call{Call: _e.mock.On("ListDatabaseBranchesAll", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call) Run(run func(ctx context.Context, request database.ListDatabaseBranchesRequest)) *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseBranchesRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call) Return(_a0 []database.DatabaseBranch, _a1 error) *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call) RunAndReturn(run func(context.Context, database.ListDatabaseBranchesRequest) ([]database.DatabaseBranch, error)) *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseEndpoints provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseEndpoints(ctx context.Context, request database.ListDatabaseEndpointsRequest) listing.Iterator[database.DatabaseEndpoint] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseEndpoints") + } + + var r0 listing.Iterator[database.DatabaseEndpoint] + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseEndpointsRequest) listing.Iterator[database.DatabaseEndpoint]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[database.DatabaseEndpoint]) + } + } + + return r0 +} + +// MockDatabaseProjectInterface_ListDatabaseEndpoints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseEndpoints' +type MockDatabaseProjectInterface_ListDatabaseEndpoints_Call struct { + *mock.Call +} + +// ListDatabaseEndpoints is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseEndpointsRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseEndpoints(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call { + return &MockDatabaseProjectInterface_ListDatabaseEndpoints_Call{Call: _e.mock.On("ListDatabaseEndpoints", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call) Run(run func(ctx context.Context, request database.ListDatabaseEndpointsRequest)) *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseEndpointsRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call) Return(_a0 listing.Iterator[database.DatabaseEndpoint]) *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call) RunAndReturn(run func(context.Context, database.ListDatabaseEndpointsRequest) listing.Iterator[database.DatabaseEndpoint]) *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseEndpointsAll provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseEndpointsAll(ctx context.Context, request database.ListDatabaseEndpointsRequest) ([]database.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseEndpointsAll") + } + + var r0 []database.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseEndpointsRequest) ([]database.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseEndpointsRequest) []database.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]database.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.ListDatabaseEndpointsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseEndpointsAll' +type MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call struct { + *mock.Call +} + +// ListDatabaseEndpointsAll is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseEndpointsRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseEndpointsAll(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call { + return &MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call{Call: _e.mock.On("ListDatabaseEndpointsAll", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call) Run(run func(ctx context.Context, request database.ListDatabaseEndpointsRequest)) *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseEndpointsRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call) Return(_a0 []database.DatabaseEndpoint, _a1 error) *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call) RunAndReturn(run func(context.Context, database.ListDatabaseEndpointsRequest) ([]database.DatabaseEndpoint, error)) *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseProjects provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseProjects(ctx context.Context, request database.ListDatabaseProjectsRequest) listing.Iterator[database.DatabaseProject] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseProjects") + } + + var r0 listing.Iterator[database.DatabaseProject] + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseProjectsRequest) listing.Iterator[database.DatabaseProject]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[database.DatabaseProject]) + } + } + + return r0 +} + +// MockDatabaseProjectInterface_ListDatabaseProjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseProjects' +type MockDatabaseProjectInterface_ListDatabaseProjects_Call struct { + *mock.Call +} + +// ListDatabaseProjects is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseProjectsRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseProjects(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseProjects_Call { + return &MockDatabaseProjectInterface_ListDatabaseProjects_Call{Call: _e.mock.On("ListDatabaseProjects", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjects_Call) Run(run func(ctx context.Context, request database.ListDatabaseProjectsRequest)) *MockDatabaseProjectInterface_ListDatabaseProjects_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseProjectsRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjects_Call) Return(_a0 listing.Iterator[database.DatabaseProject]) *MockDatabaseProjectInterface_ListDatabaseProjects_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjects_Call) RunAndReturn(run func(context.Context, database.ListDatabaseProjectsRequest) listing.Iterator[database.DatabaseProject]) *MockDatabaseProjectInterface_ListDatabaseProjects_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseProjectsAll provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseProjectsAll(ctx context.Context, request database.ListDatabaseProjectsRequest) ([]database.DatabaseProject, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseProjectsAll") + } + + var r0 []database.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseProjectsRequest) ([]database.DatabaseProject, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseProjectsRequest) []database.DatabaseProject); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]database.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.ListDatabaseProjectsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseProjectsAll' +type MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call struct { + *mock.Call +} + +// ListDatabaseProjectsAll is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseProjectsRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseProjectsAll(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call { + return &MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call{Call: _e.mock.On("ListDatabaseProjectsAll", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call) Run(run func(ctx context.Context, request database.ListDatabaseProjectsRequest)) *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseProjectsRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call) Return(_a0 []database.DatabaseProject, _a1 error) *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call) RunAndReturn(run func(context.Context, database.ListDatabaseProjectsRequest) ([]database.DatabaseProject, error)) *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call { + _c.Call.Return(run) + return _c +} + +// RestartDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) RestartDatabaseEndpoint(ctx context.Context, request database.RestartDatabaseEndpointRequest) (*database.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for RestartDatabaseEndpoint") + } + + var r0 *database.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.RestartDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.RestartDatabaseEndpointRequest) *database.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.RestartDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RestartDatabaseEndpoint' +type MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call struct { + *mock.Call +} + +// RestartDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request database.RestartDatabaseEndpointRequest +func (_e *MockDatabaseProjectInterface_Expecter) RestartDatabaseEndpoint(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call { + return &MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call{Call: _e.mock.On("RestartDatabaseEndpoint", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call) Run(run func(ctx context.Context, request database.RestartDatabaseEndpointRequest)) *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.RestartDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call) Return(_a0 *database.DatabaseEndpoint, _a1 error) *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, database.RestartDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)) *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) UpdateDatabaseBranch(ctx context.Context, request database.UpdateDatabaseBranchRequest) (*database.DatabaseBranch, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseBranch") + } + + var r0 *database.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseBranchRequest) (*database.DatabaseBranch, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseBranchRequest) *database.DatabaseBranch); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.UpdateDatabaseBranchRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_UpdateDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseBranch' +type MockDatabaseProjectInterface_UpdateDatabaseBranch_Call struct { + *mock.Call +} + +// UpdateDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request database.UpdateDatabaseBranchRequest +func (_e *MockDatabaseProjectInterface_Expecter) UpdateDatabaseBranch(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call { + return &MockDatabaseProjectInterface_UpdateDatabaseBranch_Call{Call: _e.mock.On("UpdateDatabaseBranch", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call) Run(run func(ctx context.Context, request database.UpdateDatabaseBranchRequest)) *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.UpdateDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call) Return(_a0 *database.DatabaseBranch, _a1 error) *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call) RunAndReturn(run func(context.Context, database.UpdateDatabaseBranchRequest) (*database.DatabaseBranch, error)) *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) UpdateDatabaseEndpoint(ctx context.Context, request database.UpdateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseEndpoint") + } + + var r0 *database.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseEndpointRequest) *database.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.UpdateDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseEndpoint' +type MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call struct { + *mock.Call +} + +// UpdateDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request database.UpdateDatabaseEndpointRequest +func (_e *MockDatabaseProjectInterface_Expecter) UpdateDatabaseEndpoint(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call { + return &MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call{Call: _e.mock.On("UpdateDatabaseEndpoint", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call) Run(run func(ctx context.Context, request database.UpdateDatabaseEndpointRequest)) *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.UpdateDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call) Return(_a0 *database.DatabaseEndpoint, _a1 error) *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, database.UpdateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)) *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) UpdateDatabaseProject(ctx context.Context, request database.UpdateDatabaseProjectRequest) (*database.DatabaseProject, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseProject") + } + + var r0 *database.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseProjectRequest) (*database.DatabaseProject, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseProjectRequest) *database.DatabaseProject); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.UpdateDatabaseProjectRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_UpdateDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseProject' +type MockDatabaseProjectInterface_UpdateDatabaseProject_Call struct { + *mock.Call +} + +// UpdateDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request database.UpdateDatabaseProjectRequest +func (_e *MockDatabaseProjectInterface_Expecter) UpdateDatabaseProject(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_UpdateDatabaseProject_Call { + return &MockDatabaseProjectInterface_UpdateDatabaseProject_Call{Call: _e.mock.On("UpdateDatabaseProject", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseProject_Call) Run(run func(ctx context.Context, request database.UpdateDatabaseProjectRequest)) *MockDatabaseProjectInterface_UpdateDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.UpdateDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseProject_Call) Return(_a0 *database.DatabaseProject, _a1 error) *MockDatabaseProjectInterface_UpdateDatabaseProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseProject_Call) RunAndReturn(run func(context.Context, database.UpdateDatabaseProjectRequest) (*database.DatabaseProject, error)) *MockDatabaseProjectInterface_UpdateDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// NewMockDatabaseProjectInterface creates a new instance of MockDatabaseProjectInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockDatabaseProjectInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockDatabaseProjectInterface { + mock := &MockDatabaseProjectInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/iam/mock_account_groups_v2_interface.go b/experimental/mocks/service/iam/mock_account_groups_v2_interface.go new file mode 100644 index 000000000..5eca90f84 --- /dev/null +++ b/experimental/mocks/service/iam/mock_account_groups_v2_interface.go @@ -0,0 +1,406 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package iam + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + iam "github.com/databricks/databricks-sdk-go/service/iam" + + mock "github.com/stretchr/testify/mock" +) + +// MockAccountGroupsV2Interface is an autogenerated mock type for the AccountGroupsV2Interface type +type MockAccountGroupsV2Interface struct { + mock.Mock +} + +type MockAccountGroupsV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockAccountGroupsV2Interface) EXPECT() *MockAccountGroupsV2Interface_Expecter { + return &MockAccountGroupsV2Interface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockAccountGroupsV2Interface) Create(ctx context.Context, request iam.CreateAccountGroupRequest) (*iam.AccountGroup, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *iam.AccountGroup + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateAccountGroupRequest) (*iam.AccountGroup, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateAccountGroupRequest) *iam.AccountGroup); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.AccountGroup) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.CreateAccountGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountGroupsV2Interface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockAccountGroupsV2Interface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request iam.CreateAccountGroupRequest +func (_e *MockAccountGroupsV2Interface_Expecter) Create(ctx interface{}, request interface{}) *MockAccountGroupsV2Interface_Create_Call { + return &MockAccountGroupsV2Interface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockAccountGroupsV2Interface_Create_Call) Run(run func(ctx context.Context, request iam.CreateAccountGroupRequest)) *MockAccountGroupsV2Interface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.CreateAccountGroupRequest)) + }) + return _c +} + +func (_c *MockAccountGroupsV2Interface_Create_Call) Return(_a0 *iam.AccountGroup, _a1 error) *MockAccountGroupsV2Interface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountGroupsV2Interface_Create_Call) RunAndReturn(run func(context.Context, iam.CreateAccountGroupRequest) (*iam.AccountGroup, error)) *MockAccountGroupsV2Interface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockAccountGroupsV2Interface) Delete(ctx context.Context, request iam.DeleteAccountGroupRequest) 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, iam.DeleteAccountGroupRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountGroupsV2Interface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockAccountGroupsV2Interface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request iam.DeleteAccountGroupRequest +func (_e *MockAccountGroupsV2Interface_Expecter) Delete(ctx interface{}, request interface{}) *MockAccountGroupsV2Interface_Delete_Call { + return &MockAccountGroupsV2Interface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockAccountGroupsV2Interface_Delete_Call) Run(run func(ctx context.Context, request iam.DeleteAccountGroupRequest)) *MockAccountGroupsV2Interface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.DeleteAccountGroupRequest)) + }) + return _c +} + +func (_c *MockAccountGroupsV2Interface_Delete_Call) Return(_a0 error) *MockAccountGroupsV2Interface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountGroupsV2Interface_Delete_Call) RunAndReturn(run func(context.Context, iam.DeleteAccountGroupRequest) error) *MockAccountGroupsV2Interface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockAccountGroupsV2Interface) Get(ctx context.Context, request iam.GetAccountGroupRequest) (*iam.AccountGroup, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *iam.AccountGroup + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.GetAccountGroupRequest) (*iam.AccountGroup, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.GetAccountGroupRequest) *iam.AccountGroup); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.AccountGroup) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.GetAccountGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountGroupsV2Interface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockAccountGroupsV2Interface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request iam.GetAccountGroupRequest +func (_e *MockAccountGroupsV2Interface_Expecter) Get(ctx interface{}, request interface{}) *MockAccountGroupsV2Interface_Get_Call { + return &MockAccountGroupsV2Interface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockAccountGroupsV2Interface_Get_Call) Run(run func(ctx context.Context, request iam.GetAccountGroupRequest)) *MockAccountGroupsV2Interface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.GetAccountGroupRequest)) + }) + return _c +} + +func (_c *MockAccountGroupsV2Interface_Get_Call) Return(_a0 *iam.AccountGroup, _a1 error) *MockAccountGroupsV2Interface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountGroupsV2Interface_Get_Call) RunAndReturn(run func(context.Context, iam.GetAccountGroupRequest) (*iam.AccountGroup, error)) *MockAccountGroupsV2Interface_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, request +func (_m *MockAccountGroupsV2Interface) List(ctx context.Context, request iam.ListAccountGroupsRequest) listing.Iterator[iam.AccountGroup] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[iam.AccountGroup] + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountGroupsRequest) listing.Iterator[iam.AccountGroup]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[iam.AccountGroup]) + } + } + + return r0 +} + +// MockAccountGroupsV2Interface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockAccountGroupsV2Interface_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListAccountGroupsRequest +func (_e *MockAccountGroupsV2Interface_Expecter) List(ctx interface{}, request interface{}) *MockAccountGroupsV2Interface_List_Call { + return &MockAccountGroupsV2Interface_List_Call{Call: _e.mock.On("List", ctx, request)} +} + +func (_c *MockAccountGroupsV2Interface_List_Call) Run(run func(ctx context.Context, request iam.ListAccountGroupsRequest)) *MockAccountGroupsV2Interface_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListAccountGroupsRequest)) + }) + return _c +} + +func (_c *MockAccountGroupsV2Interface_List_Call) Return(_a0 listing.Iterator[iam.AccountGroup]) *MockAccountGroupsV2Interface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountGroupsV2Interface_List_Call) RunAndReturn(run func(context.Context, iam.ListAccountGroupsRequest) listing.Iterator[iam.AccountGroup]) *MockAccountGroupsV2Interface_List_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockAccountGroupsV2Interface) ListAll(ctx context.Context, request iam.ListAccountGroupsRequest) ([]iam.AccountGroup, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []iam.AccountGroup + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountGroupsRequest) ([]iam.AccountGroup, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountGroupsRequest) []iam.AccountGroup); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]iam.AccountGroup) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.ListAccountGroupsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountGroupsV2Interface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockAccountGroupsV2Interface_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListAccountGroupsRequest +func (_e *MockAccountGroupsV2Interface_Expecter) ListAll(ctx interface{}, request interface{}) *MockAccountGroupsV2Interface_ListAll_Call { + return &MockAccountGroupsV2Interface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} +} + +func (_c *MockAccountGroupsV2Interface_ListAll_Call) Run(run func(ctx context.Context, request iam.ListAccountGroupsRequest)) *MockAccountGroupsV2Interface_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListAccountGroupsRequest)) + }) + return _c +} + +func (_c *MockAccountGroupsV2Interface_ListAll_Call) Return(_a0 []iam.AccountGroup, _a1 error) *MockAccountGroupsV2Interface_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountGroupsV2Interface_ListAll_Call) RunAndReturn(run func(context.Context, iam.ListAccountGroupsRequest) ([]iam.AccountGroup, error)) *MockAccountGroupsV2Interface_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// Patch provides a mock function with given fields: ctx, request +func (_m *MockAccountGroupsV2Interface) Patch(ctx context.Context, request iam.PatchAccountGroupRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Patch") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.PatchAccountGroupRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountGroupsV2Interface_Patch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Patch' +type MockAccountGroupsV2Interface_Patch_Call struct { + *mock.Call +} + +// Patch is a helper method to define mock.On call +// - ctx context.Context +// - request iam.PatchAccountGroupRequest +func (_e *MockAccountGroupsV2Interface_Expecter) Patch(ctx interface{}, request interface{}) *MockAccountGroupsV2Interface_Patch_Call { + return &MockAccountGroupsV2Interface_Patch_Call{Call: _e.mock.On("Patch", ctx, request)} +} + +func (_c *MockAccountGroupsV2Interface_Patch_Call) Run(run func(ctx context.Context, request iam.PatchAccountGroupRequest)) *MockAccountGroupsV2Interface_Patch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.PatchAccountGroupRequest)) + }) + return _c +} + +func (_c *MockAccountGroupsV2Interface_Patch_Call) Return(_a0 error) *MockAccountGroupsV2Interface_Patch_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountGroupsV2Interface_Patch_Call) RunAndReturn(run func(context.Context, iam.PatchAccountGroupRequest) error) *MockAccountGroupsV2Interface_Patch_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockAccountGroupsV2Interface) Update(ctx context.Context, request iam.UpdateAccountGroupRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.UpdateAccountGroupRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountGroupsV2Interface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockAccountGroupsV2Interface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request iam.UpdateAccountGroupRequest +func (_e *MockAccountGroupsV2Interface_Expecter) Update(ctx interface{}, request interface{}) *MockAccountGroupsV2Interface_Update_Call { + return &MockAccountGroupsV2Interface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockAccountGroupsV2Interface_Update_Call) Run(run func(ctx context.Context, request iam.UpdateAccountGroupRequest)) *MockAccountGroupsV2Interface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.UpdateAccountGroupRequest)) + }) + return _c +} + +func (_c *MockAccountGroupsV2Interface_Update_Call) Return(_a0 error) *MockAccountGroupsV2Interface_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountGroupsV2Interface_Update_Call) RunAndReturn(run func(context.Context, iam.UpdateAccountGroupRequest) error) *MockAccountGroupsV2Interface_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockAccountGroupsV2Interface creates a new instance of MockAccountGroupsV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockAccountGroupsV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockAccountGroupsV2Interface { + mock := &MockAccountGroupsV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/iam/mock_account_service_principals_v2_interface.go b/experimental/mocks/service/iam/mock_account_service_principals_v2_interface.go new file mode 100644 index 000000000..1da6ff212 --- /dev/null +++ b/experimental/mocks/service/iam/mock_account_service_principals_v2_interface.go @@ -0,0 +1,406 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package iam + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + iam "github.com/databricks/databricks-sdk-go/service/iam" + + mock "github.com/stretchr/testify/mock" +) + +// MockAccountServicePrincipalsV2Interface is an autogenerated mock type for the AccountServicePrincipalsV2Interface type +type MockAccountServicePrincipalsV2Interface struct { + mock.Mock +} + +type MockAccountServicePrincipalsV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockAccountServicePrincipalsV2Interface) EXPECT() *MockAccountServicePrincipalsV2Interface_Expecter { + return &MockAccountServicePrincipalsV2Interface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockAccountServicePrincipalsV2Interface) Create(ctx context.Context, request iam.CreateAccountServicePrincipalRequest) (*iam.AccountServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *iam.AccountServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateAccountServicePrincipalRequest) (*iam.AccountServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateAccountServicePrincipalRequest) *iam.AccountServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.AccountServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.CreateAccountServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountServicePrincipalsV2Interface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockAccountServicePrincipalsV2Interface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request iam.CreateAccountServicePrincipalRequest +func (_e *MockAccountServicePrincipalsV2Interface_Expecter) Create(ctx interface{}, request interface{}) *MockAccountServicePrincipalsV2Interface_Create_Call { + return &MockAccountServicePrincipalsV2Interface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockAccountServicePrincipalsV2Interface_Create_Call) Run(run func(ctx context.Context, request iam.CreateAccountServicePrincipalRequest)) *MockAccountServicePrincipalsV2Interface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.CreateAccountServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_Create_Call) Return(_a0 *iam.AccountServicePrincipal, _a1 error) *MockAccountServicePrincipalsV2Interface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_Create_Call) RunAndReturn(run func(context.Context, iam.CreateAccountServicePrincipalRequest) (*iam.AccountServicePrincipal, error)) *MockAccountServicePrincipalsV2Interface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockAccountServicePrincipalsV2Interface) Delete(ctx context.Context, request iam.DeleteAccountServicePrincipalRequest) 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, iam.DeleteAccountServicePrincipalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountServicePrincipalsV2Interface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockAccountServicePrincipalsV2Interface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request iam.DeleteAccountServicePrincipalRequest +func (_e *MockAccountServicePrincipalsV2Interface_Expecter) Delete(ctx interface{}, request interface{}) *MockAccountServicePrincipalsV2Interface_Delete_Call { + return &MockAccountServicePrincipalsV2Interface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockAccountServicePrincipalsV2Interface_Delete_Call) Run(run func(ctx context.Context, request iam.DeleteAccountServicePrincipalRequest)) *MockAccountServicePrincipalsV2Interface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.DeleteAccountServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_Delete_Call) Return(_a0 error) *MockAccountServicePrincipalsV2Interface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_Delete_Call) RunAndReturn(run func(context.Context, iam.DeleteAccountServicePrincipalRequest) error) *MockAccountServicePrincipalsV2Interface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockAccountServicePrincipalsV2Interface) Get(ctx context.Context, request iam.GetAccountServicePrincipalRequest) (*iam.AccountServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *iam.AccountServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.GetAccountServicePrincipalRequest) (*iam.AccountServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.GetAccountServicePrincipalRequest) *iam.AccountServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.AccountServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.GetAccountServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountServicePrincipalsV2Interface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockAccountServicePrincipalsV2Interface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request iam.GetAccountServicePrincipalRequest +func (_e *MockAccountServicePrincipalsV2Interface_Expecter) Get(ctx interface{}, request interface{}) *MockAccountServicePrincipalsV2Interface_Get_Call { + return &MockAccountServicePrincipalsV2Interface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockAccountServicePrincipalsV2Interface_Get_Call) Run(run func(ctx context.Context, request iam.GetAccountServicePrincipalRequest)) *MockAccountServicePrincipalsV2Interface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.GetAccountServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_Get_Call) Return(_a0 *iam.AccountServicePrincipal, _a1 error) *MockAccountServicePrincipalsV2Interface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_Get_Call) RunAndReturn(run func(context.Context, iam.GetAccountServicePrincipalRequest) (*iam.AccountServicePrincipal, error)) *MockAccountServicePrincipalsV2Interface_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, request +func (_m *MockAccountServicePrincipalsV2Interface) List(ctx context.Context, request iam.ListAccountServicePrincipalsRequest) listing.Iterator[iam.AccountServicePrincipal] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[iam.AccountServicePrincipal] + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountServicePrincipalsRequest) listing.Iterator[iam.AccountServicePrincipal]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[iam.AccountServicePrincipal]) + } + } + + return r0 +} + +// MockAccountServicePrincipalsV2Interface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockAccountServicePrincipalsV2Interface_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListAccountServicePrincipalsRequest +func (_e *MockAccountServicePrincipalsV2Interface_Expecter) List(ctx interface{}, request interface{}) *MockAccountServicePrincipalsV2Interface_List_Call { + return &MockAccountServicePrincipalsV2Interface_List_Call{Call: _e.mock.On("List", ctx, request)} +} + +func (_c *MockAccountServicePrincipalsV2Interface_List_Call) Run(run func(ctx context.Context, request iam.ListAccountServicePrincipalsRequest)) *MockAccountServicePrincipalsV2Interface_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListAccountServicePrincipalsRequest)) + }) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_List_Call) Return(_a0 listing.Iterator[iam.AccountServicePrincipal]) *MockAccountServicePrincipalsV2Interface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_List_Call) RunAndReturn(run func(context.Context, iam.ListAccountServicePrincipalsRequest) listing.Iterator[iam.AccountServicePrincipal]) *MockAccountServicePrincipalsV2Interface_List_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockAccountServicePrincipalsV2Interface) ListAll(ctx context.Context, request iam.ListAccountServicePrincipalsRequest) ([]iam.AccountServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []iam.AccountServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountServicePrincipalsRequest) ([]iam.AccountServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountServicePrincipalsRequest) []iam.AccountServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]iam.AccountServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.ListAccountServicePrincipalsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountServicePrincipalsV2Interface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockAccountServicePrincipalsV2Interface_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListAccountServicePrincipalsRequest +func (_e *MockAccountServicePrincipalsV2Interface_Expecter) ListAll(ctx interface{}, request interface{}) *MockAccountServicePrincipalsV2Interface_ListAll_Call { + return &MockAccountServicePrincipalsV2Interface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} +} + +func (_c *MockAccountServicePrincipalsV2Interface_ListAll_Call) Run(run func(ctx context.Context, request iam.ListAccountServicePrincipalsRequest)) *MockAccountServicePrincipalsV2Interface_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListAccountServicePrincipalsRequest)) + }) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_ListAll_Call) Return(_a0 []iam.AccountServicePrincipal, _a1 error) *MockAccountServicePrincipalsV2Interface_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_ListAll_Call) RunAndReturn(run func(context.Context, iam.ListAccountServicePrincipalsRequest) ([]iam.AccountServicePrincipal, error)) *MockAccountServicePrincipalsV2Interface_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// Patch provides a mock function with given fields: ctx, request +func (_m *MockAccountServicePrincipalsV2Interface) Patch(ctx context.Context, request iam.PatchAccountServicePrincipalRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Patch") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.PatchAccountServicePrincipalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountServicePrincipalsV2Interface_Patch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Patch' +type MockAccountServicePrincipalsV2Interface_Patch_Call struct { + *mock.Call +} + +// Patch is a helper method to define mock.On call +// - ctx context.Context +// - request iam.PatchAccountServicePrincipalRequest +func (_e *MockAccountServicePrincipalsV2Interface_Expecter) Patch(ctx interface{}, request interface{}) *MockAccountServicePrincipalsV2Interface_Patch_Call { + return &MockAccountServicePrincipalsV2Interface_Patch_Call{Call: _e.mock.On("Patch", ctx, request)} +} + +func (_c *MockAccountServicePrincipalsV2Interface_Patch_Call) Run(run func(ctx context.Context, request iam.PatchAccountServicePrincipalRequest)) *MockAccountServicePrincipalsV2Interface_Patch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.PatchAccountServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_Patch_Call) Return(_a0 error) *MockAccountServicePrincipalsV2Interface_Patch_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_Patch_Call) RunAndReturn(run func(context.Context, iam.PatchAccountServicePrincipalRequest) error) *MockAccountServicePrincipalsV2Interface_Patch_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockAccountServicePrincipalsV2Interface) Update(ctx context.Context, request iam.UpdateAccountServicePrincipalRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.UpdateAccountServicePrincipalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountServicePrincipalsV2Interface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockAccountServicePrincipalsV2Interface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request iam.UpdateAccountServicePrincipalRequest +func (_e *MockAccountServicePrincipalsV2Interface_Expecter) Update(ctx interface{}, request interface{}) *MockAccountServicePrincipalsV2Interface_Update_Call { + return &MockAccountServicePrincipalsV2Interface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockAccountServicePrincipalsV2Interface_Update_Call) Run(run func(ctx context.Context, request iam.UpdateAccountServicePrincipalRequest)) *MockAccountServicePrincipalsV2Interface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.UpdateAccountServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_Update_Call) Return(_a0 error) *MockAccountServicePrincipalsV2Interface_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountServicePrincipalsV2Interface_Update_Call) RunAndReturn(run func(context.Context, iam.UpdateAccountServicePrincipalRequest) error) *MockAccountServicePrincipalsV2Interface_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockAccountServicePrincipalsV2Interface creates a new instance of MockAccountServicePrincipalsV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockAccountServicePrincipalsV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockAccountServicePrincipalsV2Interface { + mock := &MockAccountServicePrincipalsV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/iam/mock_account_users_v2_interface.go b/experimental/mocks/service/iam/mock_account_users_v2_interface.go new file mode 100644 index 000000000..5ba850c6b --- /dev/null +++ b/experimental/mocks/service/iam/mock_account_users_v2_interface.go @@ -0,0 +1,406 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package iam + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + iam "github.com/databricks/databricks-sdk-go/service/iam" + + mock "github.com/stretchr/testify/mock" +) + +// MockAccountUsersV2Interface is an autogenerated mock type for the AccountUsersV2Interface type +type MockAccountUsersV2Interface struct { + mock.Mock +} + +type MockAccountUsersV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockAccountUsersV2Interface) EXPECT() *MockAccountUsersV2Interface_Expecter { + return &MockAccountUsersV2Interface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockAccountUsersV2Interface) Create(ctx context.Context, request iam.CreateAccountUserRequest) (*iam.AccountUser, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *iam.AccountUser + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateAccountUserRequest) (*iam.AccountUser, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateAccountUserRequest) *iam.AccountUser); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.AccountUser) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.CreateAccountUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountUsersV2Interface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockAccountUsersV2Interface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request iam.CreateAccountUserRequest +func (_e *MockAccountUsersV2Interface_Expecter) Create(ctx interface{}, request interface{}) *MockAccountUsersV2Interface_Create_Call { + return &MockAccountUsersV2Interface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockAccountUsersV2Interface_Create_Call) Run(run func(ctx context.Context, request iam.CreateAccountUserRequest)) *MockAccountUsersV2Interface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.CreateAccountUserRequest)) + }) + return _c +} + +func (_c *MockAccountUsersV2Interface_Create_Call) Return(_a0 *iam.AccountUser, _a1 error) *MockAccountUsersV2Interface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountUsersV2Interface_Create_Call) RunAndReturn(run func(context.Context, iam.CreateAccountUserRequest) (*iam.AccountUser, error)) *MockAccountUsersV2Interface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockAccountUsersV2Interface) Delete(ctx context.Context, request iam.DeleteAccountUserRequest) 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, iam.DeleteAccountUserRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountUsersV2Interface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockAccountUsersV2Interface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request iam.DeleteAccountUserRequest +func (_e *MockAccountUsersV2Interface_Expecter) Delete(ctx interface{}, request interface{}) *MockAccountUsersV2Interface_Delete_Call { + return &MockAccountUsersV2Interface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockAccountUsersV2Interface_Delete_Call) Run(run func(ctx context.Context, request iam.DeleteAccountUserRequest)) *MockAccountUsersV2Interface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.DeleteAccountUserRequest)) + }) + return _c +} + +func (_c *MockAccountUsersV2Interface_Delete_Call) Return(_a0 error) *MockAccountUsersV2Interface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountUsersV2Interface_Delete_Call) RunAndReturn(run func(context.Context, iam.DeleteAccountUserRequest) error) *MockAccountUsersV2Interface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockAccountUsersV2Interface) Get(ctx context.Context, request iam.GetAccountUserRequest) (*iam.AccountUser, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *iam.AccountUser + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.GetAccountUserRequest) (*iam.AccountUser, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.GetAccountUserRequest) *iam.AccountUser); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.AccountUser) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.GetAccountUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountUsersV2Interface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockAccountUsersV2Interface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request iam.GetAccountUserRequest +func (_e *MockAccountUsersV2Interface_Expecter) Get(ctx interface{}, request interface{}) *MockAccountUsersV2Interface_Get_Call { + return &MockAccountUsersV2Interface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockAccountUsersV2Interface_Get_Call) Run(run func(ctx context.Context, request iam.GetAccountUserRequest)) *MockAccountUsersV2Interface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.GetAccountUserRequest)) + }) + return _c +} + +func (_c *MockAccountUsersV2Interface_Get_Call) Return(_a0 *iam.AccountUser, _a1 error) *MockAccountUsersV2Interface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountUsersV2Interface_Get_Call) RunAndReturn(run func(context.Context, iam.GetAccountUserRequest) (*iam.AccountUser, error)) *MockAccountUsersV2Interface_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, request +func (_m *MockAccountUsersV2Interface) List(ctx context.Context, request iam.ListAccountUsersRequest) listing.Iterator[iam.AccountGroup] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[iam.AccountGroup] + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountUsersRequest) listing.Iterator[iam.AccountGroup]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[iam.AccountGroup]) + } + } + + return r0 +} + +// MockAccountUsersV2Interface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockAccountUsersV2Interface_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListAccountUsersRequest +func (_e *MockAccountUsersV2Interface_Expecter) List(ctx interface{}, request interface{}) *MockAccountUsersV2Interface_List_Call { + return &MockAccountUsersV2Interface_List_Call{Call: _e.mock.On("List", ctx, request)} +} + +func (_c *MockAccountUsersV2Interface_List_Call) Run(run func(ctx context.Context, request iam.ListAccountUsersRequest)) *MockAccountUsersV2Interface_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListAccountUsersRequest)) + }) + return _c +} + +func (_c *MockAccountUsersV2Interface_List_Call) Return(_a0 listing.Iterator[iam.AccountGroup]) *MockAccountUsersV2Interface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountUsersV2Interface_List_Call) RunAndReturn(run func(context.Context, iam.ListAccountUsersRequest) listing.Iterator[iam.AccountGroup]) *MockAccountUsersV2Interface_List_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockAccountUsersV2Interface) ListAll(ctx context.Context, request iam.ListAccountUsersRequest) ([]iam.AccountGroup, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []iam.AccountGroup + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountUsersRequest) ([]iam.AccountGroup, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountUsersRequest) []iam.AccountGroup); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]iam.AccountGroup) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.ListAccountUsersRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountUsersV2Interface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockAccountUsersV2Interface_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListAccountUsersRequest +func (_e *MockAccountUsersV2Interface_Expecter) ListAll(ctx interface{}, request interface{}) *MockAccountUsersV2Interface_ListAll_Call { + return &MockAccountUsersV2Interface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} +} + +func (_c *MockAccountUsersV2Interface_ListAll_Call) Run(run func(ctx context.Context, request iam.ListAccountUsersRequest)) *MockAccountUsersV2Interface_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListAccountUsersRequest)) + }) + return _c +} + +func (_c *MockAccountUsersV2Interface_ListAll_Call) Return(_a0 []iam.AccountGroup, _a1 error) *MockAccountUsersV2Interface_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountUsersV2Interface_ListAll_Call) RunAndReturn(run func(context.Context, iam.ListAccountUsersRequest) ([]iam.AccountGroup, error)) *MockAccountUsersV2Interface_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// Patch provides a mock function with given fields: ctx, request +func (_m *MockAccountUsersV2Interface) Patch(ctx context.Context, request iam.PatchAccountUserRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Patch") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.PatchAccountUserRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountUsersV2Interface_Patch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Patch' +type MockAccountUsersV2Interface_Patch_Call struct { + *mock.Call +} + +// Patch is a helper method to define mock.On call +// - ctx context.Context +// - request iam.PatchAccountUserRequest +func (_e *MockAccountUsersV2Interface_Expecter) Patch(ctx interface{}, request interface{}) *MockAccountUsersV2Interface_Patch_Call { + return &MockAccountUsersV2Interface_Patch_Call{Call: _e.mock.On("Patch", ctx, request)} +} + +func (_c *MockAccountUsersV2Interface_Patch_Call) Run(run func(ctx context.Context, request iam.PatchAccountUserRequest)) *MockAccountUsersV2Interface_Patch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.PatchAccountUserRequest)) + }) + return _c +} + +func (_c *MockAccountUsersV2Interface_Patch_Call) Return(_a0 error) *MockAccountUsersV2Interface_Patch_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountUsersV2Interface_Patch_Call) RunAndReturn(run func(context.Context, iam.PatchAccountUserRequest) error) *MockAccountUsersV2Interface_Patch_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockAccountUsersV2Interface) Update(ctx context.Context, request iam.UpdateAccountUserRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.UpdateAccountUserRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountUsersV2Interface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockAccountUsersV2Interface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request iam.UpdateAccountUserRequest +func (_e *MockAccountUsersV2Interface_Expecter) Update(ctx interface{}, request interface{}) *MockAccountUsersV2Interface_Update_Call { + return &MockAccountUsersV2Interface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockAccountUsersV2Interface_Update_Call) Run(run func(ctx context.Context, request iam.UpdateAccountUserRequest)) *MockAccountUsersV2Interface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.UpdateAccountUserRequest)) + }) + return _c +} + +func (_c *MockAccountUsersV2Interface_Update_Call) Return(_a0 error) *MockAccountUsersV2Interface_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountUsersV2Interface_Update_Call) RunAndReturn(run func(context.Context, iam.UpdateAccountUserRequest) error) *MockAccountUsersV2Interface_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockAccountUsersV2Interface creates a new instance of MockAccountUsersV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockAccountUsersV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockAccountUsersV2Interface { + mock := &MockAccountUsersV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/iam/mock_groups_v2_interface.go b/experimental/mocks/service/iam/mock_groups_v2_interface.go new file mode 100644 index 000000000..f72d4c9d9 --- /dev/null +++ b/experimental/mocks/service/iam/mock_groups_v2_interface.go @@ -0,0 +1,406 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package iam + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + iam "github.com/databricks/databricks-sdk-go/service/iam" + + mock "github.com/stretchr/testify/mock" +) + +// MockGroupsV2Interface is an autogenerated mock type for the GroupsV2Interface type +type MockGroupsV2Interface struct { + mock.Mock +} + +type MockGroupsV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockGroupsV2Interface) EXPECT() *MockGroupsV2Interface_Expecter { + return &MockGroupsV2Interface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockGroupsV2Interface) Create(ctx context.Context, request iam.CreateGroupRequest) (*iam.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *iam.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateGroupRequest) (*iam.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateGroupRequest) *iam.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.CreateGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGroupsV2Interface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockGroupsV2Interface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request iam.CreateGroupRequest +func (_e *MockGroupsV2Interface_Expecter) Create(ctx interface{}, request interface{}) *MockGroupsV2Interface_Create_Call { + return &MockGroupsV2Interface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockGroupsV2Interface_Create_Call) Run(run func(ctx context.Context, request iam.CreateGroupRequest)) *MockGroupsV2Interface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.CreateGroupRequest)) + }) + return _c +} + +func (_c *MockGroupsV2Interface_Create_Call) Return(_a0 *iam.Group, _a1 error) *MockGroupsV2Interface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGroupsV2Interface_Create_Call) RunAndReturn(run func(context.Context, iam.CreateGroupRequest) (*iam.Group, error)) *MockGroupsV2Interface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockGroupsV2Interface) Delete(ctx context.Context, request iam.DeleteGroupRequest) 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, iam.DeleteGroupRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockGroupsV2Interface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockGroupsV2Interface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request iam.DeleteGroupRequest +func (_e *MockGroupsV2Interface_Expecter) Delete(ctx interface{}, request interface{}) *MockGroupsV2Interface_Delete_Call { + return &MockGroupsV2Interface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockGroupsV2Interface_Delete_Call) Run(run func(ctx context.Context, request iam.DeleteGroupRequest)) *MockGroupsV2Interface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.DeleteGroupRequest)) + }) + return _c +} + +func (_c *MockGroupsV2Interface_Delete_Call) Return(_a0 error) *MockGroupsV2Interface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockGroupsV2Interface_Delete_Call) RunAndReturn(run func(context.Context, iam.DeleteGroupRequest) error) *MockGroupsV2Interface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockGroupsV2Interface) Get(ctx context.Context, request iam.GetGroupRequest) (*iam.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *iam.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.GetGroupRequest) (*iam.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.GetGroupRequest) *iam.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.GetGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGroupsV2Interface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockGroupsV2Interface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request iam.GetGroupRequest +func (_e *MockGroupsV2Interface_Expecter) Get(ctx interface{}, request interface{}) *MockGroupsV2Interface_Get_Call { + return &MockGroupsV2Interface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockGroupsV2Interface_Get_Call) Run(run func(ctx context.Context, request iam.GetGroupRequest)) *MockGroupsV2Interface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.GetGroupRequest)) + }) + return _c +} + +func (_c *MockGroupsV2Interface_Get_Call) Return(_a0 *iam.Group, _a1 error) *MockGroupsV2Interface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGroupsV2Interface_Get_Call) RunAndReturn(run func(context.Context, iam.GetGroupRequest) (*iam.Group, error)) *MockGroupsV2Interface_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, request +func (_m *MockGroupsV2Interface) List(ctx context.Context, request iam.ListGroupsRequest) listing.Iterator[iam.Group] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[iam.Group] + if rf, ok := ret.Get(0).(func(context.Context, iam.ListGroupsRequest) listing.Iterator[iam.Group]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[iam.Group]) + } + } + + return r0 +} + +// MockGroupsV2Interface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockGroupsV2Interface_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListGroupsRequest +func (_e *MockGroupsV2Interface_Expecter) List(ctx interface{}, request interface{}) *MockGroupsV2Interface_List_Call { + return &MockGroupsV2Interface_List_Call{Call: _e.mock.On("List", ctx, request)} +} + +func (_c *MockGroupsV2Interface_List_Call) Run(run func(ctx context.Context, request iam.ListGroupsRequest)) *MockGroupsV2Interface_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListGroupsRequest)) + }) + return _c +} + +func (_c *MockGroupsV2Interface_List_Call) Return(_a0 listing.Iterator[iam.Group]) *MockGroupsV2Interface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockGroupsV2Interface_List_Call) RunAndReturn(run func(context.Context, iam.ListGroupsRequest) listing.Iterator[iam.Group]) *MockGroupsV2Interface_List_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockGroupsV2Interface) ListAll(ctx context.Context, request iam.ListGroupsRequest) ([]iam.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []iam.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.ListGroupsRequest) ([]iam.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.ListGroupsRequest) []iam.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]iam.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.ListGroupsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGroupsV2Interface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockGroupsV2Interface_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListGroupsRequest +func (_e *MockGroupsV2Interface_Expecter) ListAll(ctx interface{}, request interface{}) *MockGroupsV2Interface_ListAll_Call { + return &MockGroupsV2Interface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} +} + +func (_c *MockGroupsV2Interface_ListAll_Call) Run(run func(ctx context.Context, request iam.ListGroupsRequest)) *MockGroupsV2Interface_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListGroupsRequest)) + }) + return _c +} + +func (_c *MockGroupsV2Interface_ListAll_Call) Return(_a0 []iam.Group, _a1 error) *MockGroupsV2Interface_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGroupsV2Interface_ListAll_Call) RunAndReturn(run func(context.Context, iam.ListGroupsRequest) ([]iam.Group, error)) *MockGroupsV2Interface_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// Patch provides a mock function with given fields: ctx, request +func (_m *MockGroupsV2Interface) Patch(ctx context.Context, request iam.PatchGroupRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Patch") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.PatchGroupRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockGroupsV2Interface_Patch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Patch' +type MockGroupsV2Interface_Patch_Call struct { + *mock.Call +} + +// Patch is a helper method to define mock.On call +// - ctx context.Context +// - request iam.PatchGroupRequest +func (_e *MockGroupsV2Interface_Expecter) Patch(ctx interface{}, request interface{}) *MockGroupsV2Interface_Patch_Call { + return &MockGroupsV2Interface_Patch_Call{Call: _e.mock.On("Patch", ctx, request)} +} + +func (_c *MockGroupsV2Interface_Patch_Call) Run(run func(ctx context.Context, request iam.PatchGroupRequest)) *MockGroupsV2Interface_Patch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.PatchGroupRequest)) + }) + return _c +} + +func (_c *MockGroupsV2Interface_Patch_Call) Return(_a0 error) *MockGroupsV2Interface_Patch_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockGroupsV2Interface_Patch_Call) RunAndReturn(run func(context.Context, iam.PatchGroupRequest) error) *MockGroupsV2Interface_Patch_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockGroupsV2Interface) Update(ctx context.Context, request iam.UpdateGroupRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.UpdateGroupRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockGroupsV2Interface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockGroupsV2Interface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request iam.UpdateGroupRequest +func (_e *MockGroupsV2Interface_Expecter) Update(ctx interface{}, request interface{}) *MockGroupsV2Interface_Update_Call { + return &MockGroupsV2Interface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockGroupsV2Interface_Update_Call) Run(run func(ctx context.Context, request iam.UpdateGroupRequest)) *MockGroupsV2Interface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.UpdateGroupRequest)) + }) + return _c +} + +func (_c *MockGroupsV2Interface_Update_Call) Return(_a0 error) *MockGroupsV2Interface_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockGroupsV2Interface_Update_Call) RunAndReturn(run func(context.Context, iam.UpdateGroupRequest) error) *MockGroupsV2Interface_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockGroupsV2Interface creates a new instance of MockGroupsV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockGroupsV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockGroupsV2Interface { + mock := &MockGroupsV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/iam/mock_service_principals_v2_interface.go b/experimental/mocks/service/iam/mock_service_principals_v2_interface.go new file mode 100644 index 000000000..f24dd351e --- /dev/null +++ b/experimental/mocks/service/iam/mock_service_principals_v2_interface.go @@ -0,0 +1,406 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package iam + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + iam "github.com/databricks/databricks-sdk-go/service/iam" + + mock "github.com/stretchr/testify/mock" +) + +// MockServicePrincipalsV2Interface is an autogenerated mock type for the ServicePrincipalsV2Interface type +type MockServicePrincipalsV2Interface struct { + mock.Mock +} + +type MockServicePrincipalsV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockServicePrincipalsV2Interface) EXPECT() *MockServicePrincipalsV2Interface_Expecter { + return &MockServicePrincipalsV2Interface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockServicePrincipalsV2Interface) Create(ctx context.Context, request iam.CreateServicePrincipalRequest) (*iam.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *iam.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateServicePrincipalRequest) (*iam.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateServicePrincipalRequest) *iam.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.CreateServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockServicePrincipalsV2Interface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockServicePrincipalsV2Interface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request iam.CreateServicePrincipalRequest +func (_e *MockServicePrincipalsV2Interface_Expecter) Create(ctx interface{}, request interface{}) *MockServicePrincipalsV2Interface_Create_Call { + return &MockServicePrincipalsV2Interface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockServicePrincipalsV2Interface_Create_Call) Run(run func(ctx context.Context, request iam.CreateServicePrincipalRequest)) *MockServicePrincipalsV2Interface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.CreateServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_Create_Call) Return(_a0 *iam.ServicePrincipal, _a1 error) *MockServicePrincipalsV2Interface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_Create_Call) RunAndReturn(run func(context.Context, iam.CreateServicePrincipalRequest) (*iam.ServicePrincipal, error)) *MockServicePrincipalsV2Interface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockServicePrincipalsV2Interface) Delete(ctx context.Context, request iam.DeleteServicePrincipalRequest) 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, iam.DeleteServicePrincipalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockServicePrincipalsV2Interface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockServicePrincipalsV2Interface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request iam.DeleteServicePrincipalRequest +func (_e *MockServicePrincipalsV2Interface_Expecter) Delete(ctx interface{}, request interface{}) *MockServicePrincipalsV2Interface_Delete_Call { + return &MockServicePrincipalsV2Interface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockServicePrincipalsV2Interface_Delete_Call) Run(run func(ctx context.Context, request iam.DeleteServicePrincipalRequest)) *MockServicePrincipalsV2Interface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.DeleteServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_Delete_Call) Return(_a0 error) *MockServicePrincipalsV2Interface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_Delete_Call) RunAndReturn(run func(context.Context, iam.DeleteServicePrincipalRequest) error) *MockServicePrincipalsV2Interface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockServicePrincipalsV2Interface) Get(ctx context.Context, request iam.GetServicePrincipalRequest) (*iam.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *iam.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.GetServicePrincipalRequest) (*iam.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.GetServicePrincipalRequest) *iam.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.GetServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockServicePrincipalsV2Interface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockServicePrincipalsV2Interface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request iam.GetServicePrincipalRequest +func (_e *MockServicePrincipalsV2Interface_Expecter) Get(ctx interface{}, request interface{}) *MockServicePrincipalsV2Interface_Get_Call { + return &MockServicePrincipalsV2Interface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockServicePrincipalsV2Interface_Get_Call) Run(run func(ctx context.Context, request iam.GetServicePrincipalRequest)) *MockServicePrincipalsV2Interface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.GetServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_Get_Call) Return(_a0 *iam.ServicePrincipal, _a1 error) *MockServicePrincipalsV2Interface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_Get_Call) RunAndReturn(run func(context.Context, iam.GetServicePrincipalRequest) (*iam.ServicePrincipal, error)) *MockServicePrincipalsV2Interface_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, request +func (_m *MockServicePrincipalsV2Interface) List(ctx context.Context, request iam.ListServicePrincipalsRequest) listing.Iterator[iam.ServicePrincipal] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[iam.ServicePrincipal] + if rf, ok := ret.Get(0).(func(context.Context, iam.ListServicePrincipalsRequest) listing.Iterator[iam.ServicePrincipal]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[iam.ServicePrincipal]) + } + } + + return r0 +} + +// MockServicePrincipalsV2Interface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockServicePrincipalsV2Interface_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListServicePrincipalsRequest +func (_e *MockServicePrincipalsV2Interface_Expecter) List(ctx interface{}, request interface{}) *MockServicePrincipalsV2Interface_List_Call { + return &MockServicePrincipalsV2Interface_List_Call{Call: _e.mock.On("List", ctx, request)} +} + +func (_c *MockServicePrincipalsV2Interface_List_Call) Run(run func(ctx context.Context, request iam.ListServicePrincipalsRequest)) *MockServicePrincipalsV2Interface_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListServicePrincipalsRequest)) + }) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_List_Call) Return(_a0 listing.Iterator[iam.ServicePrincipal]) *MockServicePrincipalsV2Interface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_List_Call) RunAndReturn(run func(context.Context, iam.ListServicePrincipalsRequest) listing.Iterator[iam.ServicePrincipal]) *MockServicePrincipalsV2Interface_List_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockServicePrincipalsV2Interface) ListAll(ctx context.Context, request iam.ListServicePrincipalsRequest) ([]iam.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []iam.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.ListServicePrincipalsRequest) ([]iam.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.ListServicePrincipalsRequest) []iam.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]iam.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.ListServicePrincipalsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockServicePrincipalsV2Interface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockServicePrincipalsV2Interface_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListServicePrincipalsRequest +func (_e *MockServicePrincipalsV2Interface_Expecter) ListAll(ctx interface{}, request interface{}) *MockServicePrincipalsV2Interface_ListAll_Call { + return &MockServicePrincipalsV2Interface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} +} + +func (_c *MockServicePrincipalsV2Interface_ListAll_Call) Run(run func(ctx context.Context, request iam.ListServicePrincipalsRequest)) *MockServicePrincipalsV2Interface_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListServicePrincipalsRequest)) + }) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_ListAll_Call) Return(_a0 []iam.ServicePrincipal, _a1 error) *MockServicePrincipalsV2Interface_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_ListAll_Call) RunAndReturn(run func(context.Context, iam.ListServicePrincipalsRequest) ([]iam.ServicePrincipal, error)) *MockServicePrincipalsV2Interface_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// Patch provides a mock function with given fields: ctx, request +func (_m *MockServicePrincipalsV2Interface) Patch(ctx context.Context, request iam.PatchServicePrincipalRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Patch") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.PatchServicePrincipalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockServicePrincipalsV2Interface_Patch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Patch' +type MockServicePrincipalsV2Interface_Patch_Call struct { + *mock.Call +} + +// Patch is a helper method to define mock.On call +// - ctx context.Context +// - request iam.PatchServicePrincipalRequest +func (_e *MockServicePrincipalsV2Interface_Expecter) Patch(ctx interface{}, request interface{}) *MockServicePrincipalsV2Interface_Patch_Call { + return &MockServicePrincipalsV2Interface_Patch_Call{Call: _e.mock.On("Patch", ctx, request)} +} + +func (_c *MockServicePrincipalsV2Interface_Patch_Call) Run(run func(ctx context.Context, request iam.PatchServicePrincipalRequest)) *MockServicePrincipalsV2Interface_Patch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.PatchServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_Patch_Call) Return(_a0 error) *MockServicePrincipalsV2Interface_Patch_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_Patch_Call) RunAndReturn(run func(context.Context, iam.PatchServicePrincipalRequest) error) *MockServicePrincipalsV2Interface_Patch_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockServicePrincipalsV2Interface) Update(ctx context.Context, request iam.UpdateServicePrincipalRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.UpdateServicePrincipalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockServicePrincipalsV2Interface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockServicePrincipalsV2Interface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request iam.UpdateServicePrincipalRequest +func (_e *MockServicePrincipalsV2Interface_Expecter) Update(ctx interface{}, request interface{}) *MockServicePrincipalsV2Interface_Update_Call { + return &MockServicePrincipalsV2Interface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockServicePrincipalsV2Interface_Update_Call) Run(run func(ctx context.Context, request iam.UpdateServicePrincipalRequest)) *MockServicePrincipalsV2Interface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.UpdateServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_Update_Call) Return(_a0 error) *MockServicePrincipalsV2Interface_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockServicePrincipalsV2Interface_Update_Call) RunAndReturn(run func(context.Context, iam.UpdateServicePrincipalRequest) error) *MockServicePrincipalsV2Interface_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockServicePrincipalsV2Interface creates a new instance of MockServicePrincipalsV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockServicePrincipalsV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockServicePrincipalsV2Interface { + mock := &MockServicePrincipalsV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/iam/mock_users_v2_interface.go b/experimental/mocks/service/iam/mock_users_v2_interface.go new file mode 100644 index 000000000..bf8606af5 --- /dev/null +++ b/experimental/mocks/service/iam/mock_users_v2_interface.go @@ -0,0 +1,642 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package iam + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + iam "github.com/databricks/databricks-sdk-go/service/iam" + + mock "github.com/stretchr/testify/mock" +) + +// MockUsersV2Interface is an autogenerated mock type for the UsersV2Interface type +type MockUsersV2Interface struct { + mock.Mock +} + +type MockUsersV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockUsersV2Interface) EXPECT() *MockUsersV2Interface_Expecter { + return &MockUsersV2Interface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockUsersV2Interface) Create(ctx context.Context, request iam.CreateUserRequest) (*iam.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *iam.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateUserRequest) (*iam.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.CreateUserRequest) *iam.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.CreateUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsersV2Interface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockUsersV2Interface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request iam.CreateUserRequest +func (_e *MockUsersV2Interface_Expecter) Create(ctx interface{}, request interface{}) *MockUsersV2Interface_Create_Call { + return &MockUsersV2Interface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockUsersV2Interface_Create_Call) Run(run func(ctx context.Context, request iam.CreateUserRequest)) *MockUsersV2Interface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.CreateUserRequest)) + }) + return _c +} + +func (_c *MockUsersV2Interface_Create_Call) Return(_a0 *iam.User, _a1 error) *MockUsersV2Interface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsersV2Interface_Create_Call) RunAndReturn(run func(context.Context, iam.CreateUserRequest) (*iam.User, error)) *MockUsersV2Interface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockUsersV2Interface) Delete(ctx context.Context, request iam.DeleteUserRequest) 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, iam.DeleteUserRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockUsersV2Interface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockUsersV2Interface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request iam.DeleteUserRequest +func (_e *MockUsersV2Interface_Expecter) Delete(ctx interface{}, request interface{}) *MockUsersV2Interface_Delete_Call { + return &MockUsersV2Interface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockUsersV2Interface_Delete_Call) Run(run func(ctx context.Context, request iam.DeleteUserRequest)) *MockUsersV2Interface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.DeleteUserRequest)) + }) + return _c +} + +func (_c *MockUsersV2Interface_Delete_Call) Return(_a0 error) *MockUsersV2Interface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockUsersV2Interface_Delete_Call) RunAndReturn(run func(context.Context, iam.DeleteUserRequest) error) *MockUsersV2Interface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockUsersV2Interface) Get(ctx context.Context, request iam.GetUserRequest) (*iam.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *iam.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.GetUserRequest) (*iam.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.GetUserRequest) *iam.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.GetUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsersV2Interface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockUsersV2Interface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request iam.GetUserRequest +func (_e *MockUsersV2Interface_Expecter) Get(ctx interface{}, request interface{}) *MockUsersV2Interface_Get_Call { + return &MockUsersV2Interface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockUsersV2Interface_Get_Call) Run(run func(ctx context.Context, request iam.GetUserRequest)) *MockUsersV2Interface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.GetUserRequest)) + }) + return _c +} + +func (_c *MockUsersV2Interface_Get_Call) Return(_a0 *iam.User, _a1 error) *MockUsersV2Interface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsersV2Interface_Get_Call) RunAndReturn(run func(context.Context, iam.GetUserRequest) (*iam.User, error)) *MockUsersV2Interface_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetPermissionLevels provides a mock function with given fields: ctx, request +func (_m *MockUsersV2Interface) GetPermissionLevels(ctx context.Context, request iam.GetPasswordPermissionLevelsRequest) (*iam.GetPasswordPermissionLevelsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetPermissionLevels") + } + + var r0 *iam.GetPasswordPermissionLevelsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.GetPasswordPermissionLevelsRequest) (*iam.GetPasswordPermissionLevelsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.GetPasswordPermissionLevelsRequest) *iam.GetPasswordPermissionLevelsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.GetPasswordPermissionLevelsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.GetPasswordPermissionLevelsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsersV2Interface_GetPermissionLevels_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPermissionLevels' +type MockUsersV2Interface_GetPermissionLevels_Call struct { + *mock.Call +} + +// GetPermissionLevels is a helper method to define mock.On call +// - ctx context.Context +// - request iam.GetPasswordPermissionLevelsRequest +func (_e *MockUsersV2Interface_Expecter) GetPermissionLevels(ctx interface{}, request interface{}) *MockUsersV2Interface_GetPermissionLevels_Call { + return &MockUsersV2Interface_GetPermissionLevels_Call{Call: _e.mock.On("GetPermissionLevels", ctx, request)} +} + +func (_c *MockUsersV2Interface_GetPermissionLevels_Call) Run(run func(ctx context.Context, request iam.GetPasswordPermissionLevelsRequest)) *MockUsersV2Interface_GetPermissionLevels_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.GetPasswordPermissionLevelsRequest)) + }) + return _c +} + +func (_c *MockUsersV2Interface_GetPermissionLevels_Call) Return(_a0 *iam.GetPasswordPermissionLevelsResponse, _a1 error) *MockUsersV2Interface_GetPermissionLevels_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsersV2Interface_GetPermissionLevels_Call) RunAndReturn(run func(context.Context, iam.GetPasswordPermissionLevelsRequest) (*iam.GetPasswordPermissionLevelsResponse, error)) *MockUsersV2Interface_GetPermissionLevels_Call { + _c.Call.Return(run) + return _c +} + +// GetPermissions provides a mock function with given fields: ctx, request +func (_m *MockUsersV2Interface) GetPermissions(ctx context.Context, request iam.GetPasswordPermissionsRequest) (*iam.PasswordPermissions, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetPermissions") + } + + var r0 *iam.PasswordPermissions + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.GetPasswordPermissionsRequest) (*iam.PasswordPermissions, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.GetPasswordPermissionsRequest) *iam.PasswordPermissions); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.PasswordPermissions) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.GetPasswordPermissionsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsersV2Interface_GetPermissions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPermissions' +type MockUsersV2Interface_GetPermissions_Call struct { + *mock.Call +} + +// GetPermissions is a helper method to define mock.On call +// - ctx context.Context +// - request iam.GetPasswordPermissionsRequest +func (_e *MockUsersV2Interface_Expecter) GetPermissions(ctx interface{}, request interface{}) *MockUsersV2Interface_GetPermissions_Call { + return &MockUsersV2Interface_GetPermissions_Call{Call: _e.mock.On("GetPermissions", ctx, request)} +} + +func (_c *MockUsersV2Interface_GetPermissions_Call) Run(run func(ctx context.Context, request iam.GetPasswordPermissionsRequest)) *MockUsersV2Interface_GetPermissions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.GetPasswordPermissionsRequest)) + }) + return _c +} + +func (_c *MockUsersV2Interface_GetPermissions_Call) Return(_a0 *iam.PasswordPermissions, _a1 error) *MockUsersV2Interface_GetPermissions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsersV2Interface_GetPermissions_Call) RunAndReturn(run func(context.Context, iam.GetPasswordPermissionsRequest) (*iam.PasswordPermissions, error)) *MockUsersV2Interface_GetPermissions_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, request +func (_m *MockUsersV2Interface) List(ctx context.Context, request iam.ListUsersRequest) listing.Iterator[iam.User] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[iam.User] + if rf, ok := ret.Get(0).(func(context.Context, iam.ListUsersRequest) listing.Iterator[iam.User]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[iam.User]) + } + } + + return r0 +} + +// MockUsersV2Interface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockUsersV2Interface_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListUsersRequest +func (_e *MockUsersV2Interface_Expecter) List(ctx interface{}, request interface{}) *MockUsersV2Interface_List_Call { + return &MockUsersV2Interface_List_Call{Call: _e.mock.On("List", ctx, request)} +} + +func (_c *MockUsersV2Interface_List_Call) Run(run func(ctx context.Context, request iam.ListUsersRequest)) *MockUsersV2Interface_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListUsersRequest)) + }) + return _c +} + +func (_c *MockUsersV2Interface_List_Call) Return(_a0 listing.Iterator[iam.User]) *MockUsersV2Interface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockUsersV2Interface_List_Call) RunAndReturn(run func(context.Context, iam.ListUsersRequest) listing.Iterator[iam.User]) *MockUsersV2Interface_List_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockUsersV2Interface) ListAll(ctx context.Context, request iam.ListUsersRequest) ([]iam.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []iam.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.ListUsersRequest) ([]iam.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.ListUsersRequest) []iam.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]iam.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.ListUsersRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsersV2Interface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockUsersV2Interface_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +// - ctx context.Context +// - request iam.ListUsersRequest +func (_e *MockUsersV2Interface_Expecter) ListAll(ctx interface{}, request interface{}) *MockUsersV2Interface_ListAll_Call { + return &MockUsersV2Interface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} +} + +func (_c *MockUsersV2Interface_ListAll_Call) Run(run func(ctx context.Context, request iam.ListUsersRequest)) *MockUsersV2Interface_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.ListUsersRequest)) + }) + return _c +} + +func (_c *MockUsersV2Interface_ListAll_Call) Return(_a0 []iam.User, _a1 error) *MockUsersV2Interface_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsersV2Interface_ListAll_Call) RunAndReturn(run func(context.Context, iam.ListUsersRequest) ([]iam.User, error)) *MockUsersV2Interface_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// Patch provides a mock function with given fields: ctx, request +func (_m *MockUsersV2Interface) Patch(ctx context.Context, request iam.PatchUserRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Patch") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.PatchUserRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockUsersV2Interface_Patch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Patch' +type MockUsersV2Interface_Patch_Call struct { + *mock.Call +} + +// Patch is a helper method to define mock.On call +// - ctx context.Context +// - request iam.PatchUserRequest +func (_e *MockUsersV2Interface_Expecter) Patch(ctx interface{}, request interface{}) *MockUsersV2Interface_Patch_Call { + return &MockUsersV2Interface_Patch_Call{Call: _e.mock.On("Patch", ctx, request)} +} + +func (_c *MockUsersV2Interface_Patch_Call) Run(run func(ctx context.Context, request iam.PatchUserRequest)) *MockUsersV2Interface_Patch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.PatchUserRequest)) + }) + return _c +} + +func (_c *MockUsersV2Interface_Patch_Call) Return(_a0 error) *MockUsersV2Interface_Patch_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockUsersV2Interface_Patch_Call) RunAndReturn(run func(context.Context, iam.PatchUserRequest) error) *MockUsersV2Interface_Patch_Call { + _c.Call.Return(run) + return _c +} + +// SetPermissions provides a mock function with given fields: ctx, request +func (_m *MockUsersV2Interface) SetPermissions(ctx context.Context, request iam.PasswordPermissionsRequest) (*iam.PasswordPermissions, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for SetPermissions") + } + + var r0 *iam.PasswordPermissions + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.PasswordPermissionsRequest) (*iam.PasswordPermissions, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.PasswordPermissionsRequest) *iam.PasswordPermissions); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.PasswordPermissions) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.PasswordPermissionsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsersV2Interface_SetPermissions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetPermissions' +type MockUsersV2Interface_SetPermissions_Call struct { + *mock.Call +} + +// SetPermissions is a helper method to define mock.On call +// - ctx context.Context +// - request iam.PasswordPermissionsRequest +func (_e *MockUsersV2Interface_Expecter) SetPermissions(ctx interface{}, request interface{}) *MockUsersV2Interface_SetPermissions_Call { + return &MockUsersV2Interface_SetPermissions_Call{Call: _e.mock.On("SetPermissions", ctx, request)} +} + +func (_c *MockUsersV2Interface_SetPermissions_Call) Run(run func(ctx context.Context, request iam.PasswordPermissionsRequest)) *MockUsersV2Interface_SetPermissions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.PasswordPermissionsRequest)) + }) + return _c +} + +func (_c *MockUsersV2Interface_SetPermissions_Call) Return(_a0 *iam.PasswordPermissions, _a1 error) *MockUsersV2Interface_SetPermissions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsersV2Interface_SetPermissions_Call) RunAndReturn(run func(context.Context, iam.PasswordPermissionsRequest) (*iam.PasswordPermissions, error)) *MockUsersV2Interface_SetPermissions_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockUsersV2Interface) Update(ctx context.Context, request iam.UpdateUserRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iam.UpdateUserRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockUsersV2Interface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockUsersV2Interface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request iam.UpdateUserRequest +func (_e *MockUsersV2Interface_Expecter) Update(ctx interface{}, request interface{}) *MockUsersV2Interface_Update_Call { + return &MockUsersV2Interface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockUsersV2Interface_Update_Call) Run(run func(ctx context.Context, request iam.UpdateUserRequest)) *MockUsersV2Interface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.UpdateUserRequest)) + }) + return _c +} + +func (_c *MockUsersV2Interface_Update_Call) Return(_a0 error) *MockUsersV2Interface_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockUsersV2Interface_Update_Call) RunAndReturn(run func(context.Context, iam.UpdateUserRequest) error) *MockUsersV2Interface_Update_Call { + _c.Call.Return(run) + return _c +} + +// UpdatePermissions provides a mock function with given fields: ctx, request +func (_m *MockUsersV2Interface) UpdatePermissions(ctx context.Context, request iam.PasswordPermissionsRequest) (*iam.PasswordPermissions, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdatePermissions") + } + + var r0 *iam.PasswordPermissions + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.PasswordPermissionsRequest) (*iam.PasswordPermissions, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.PasswordPermissionsRequest) *iam.PasswordPermissions); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.PasswordPermissions) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.PasswordPermissionsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsersV2Interface_UpdatePermissions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePermissions' +type MockUsersV2Interface_UpdatePermissions_Call struct { + *mock.Call +} + +// UpdatePermissions is a helper method to define mock.On call +// - ctx context.Context +// - request iam.PasswordPermissionsRequest +func (_e *MockUsersV2Interface_Expecter) UpdatePermissions(ctx interface{}, request interface{}) *MockUsersV2Interface_UpdatePermissions_Call { + return &MockUsersV2Interface_UpdatePermissions_Call{Call: _e.mock.On("UpdatePermissions", ctx, request)} +} + +func (_c *MockUsersV2Interface_UpdatePermissions_Call) Run(run func(ctx context.Context, request iam.PasswordPermissionsRequest)) *MockUsersV2Interface_UpdatePermissions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.PasswordPermissionsRequest)) + }) + return _c +} + +func (_c *MockUsersV2Interface_UpdatePermissions_Call) Return(_a0 *iam.PasswordPermissions, _a1 error) *MockUsersV2Interface_UpdatePermissions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsersV2Interface_UpdatePermissions_Call) RunAndReturn(run func(context.Context, iam.PasswordPermissionsRequest) (*iam.PasswordPermissions, error)) *MockUsersV2Interface_UpdatePermissions_Call { + _c.Call.Return(run) + return _c +} + +// NewMockUsersV2Interface creates a new instance of MockUsersV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockUsersV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockUsersV2Interface { + mock := &MockUsersV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/iamv2/mock_account_iam_v2_interface.go b/experimental/mocks/service/iamv2/mock_account_iam_v2_interface.go new file mode 100644 index 000000000..7f850afd0 --- /dev/null +++ b/experimental/mocks/service/iamv2/mock_account_iam_v2_interface.go @@ -0,0 +1,1346 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package iamv2 + +import ( + context "context" + + iamv2 "github.com/databricks/databricks-sdk-go/service/iamv2" + mock "github.com/stretchr/testify/mock" +) + +// MockAccountIamV2Interface is an autogenerated mock type for the AccountIamV2Interface type +type MockAccountIamV2Interface struct { + mock.Mock +} + +type MockAccountIamV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockAccountIamV2Interface) EXPECT() *MockAccountIamV2Interface_Expecter { + return &MockAccountIamV2Interface_Expecter{mock: &_m.Mock} +} + +// CreateGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateGroup(ctx context.Context, request iamv2.CreateGroupRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateGroup") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGroup' +type MockAccountIamV2Interface_CreateGroup_Call struct { + *mock.Call +} + +// CreateGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateGroup_Call { + return &MockAccountIamV2Interface_CreateGroup_Call{Call: _e.mock.On("CreateGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateGroup_Call) Run(run func(ctx context.Context, request iamv2.CreateGroupRequest)) *MockAccountIamV2Interface_CreateGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateGroup_Call) Return(_a0 *iamv2.Group, _a1 error) *MockAccountIamV2Interface_CreateGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateGroup_Call) RunAndReturn(run func(context.Context, iamv2.CreateGroupRequest) (*iamv2.Group, error)) *MockAccountIamV2Interface_CreateGroup_Call { + _c.Call.Return(run) + return _c +} + +// CreateServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateServicePrincipal(ctx context.Context, request iamv2.CreateServicePrincipalRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateServicePrincipal") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateServicePrincipal' +type MockAccountIamV2Interface_CreateServicePrincipal_Call struct { + *mock.Call +} + +// CreateServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + return &MockAccountIamV2Interface_CreateServicePrincipal_Call{Call: _e.mock.On("CreateServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.CreateServicePrincipalRequest)) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateServicePrincipal_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.CreateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// CreateUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateUser(ctx context.Context, request iamv2.CreateUserRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateUser") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUser' +type MockAccountIamV2Interface_CreateUser_Call struct { + *mock.Call +} + +// CreateUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateUserRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateUser_Call { + return &MockAccountIamV2Interface_CreateUser_Call{Call: _e.mock.On("CreateUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateUser_Call) Run(run func(ctx context.Context, request iamv2.CreateUserRequest)) *MockAccountIamV2Interface_CreateUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateUser_Call) Return(_a0 *iamv2.User, _a1 error) *MockAccountIamV2Interface_CreateUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateUser_Call) RunAndReturn(run func(context.Context, iamv2.CreateUserRequest) (*iamv2.User, error)) *MockAccountIamV2Interface_CreateUser_Call { + _c.Call.Return(run) + return _c +} + +// CreateWorkspaceAccessDetail provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateWorkspaceAccessDetail(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateWorkspaceAccessDetail") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateWorkspaceAccessDetail' +type MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// CreateWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call{Call: _e.mock.On("CreateWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + +// DeleteGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteGroup(ctx context.Context, request iamv2.DeleteGroupRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteGroup") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteGroupRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGroup' +type MockAccountIamV2Interface_DeleteGroup_Call struct { + *mock.Call +} + +// DeleteGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteGroup_Call { + return &MockAccountIamV2Interface_DeleteGroup_Call{Call: _e.mock.On("DeleteGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteGroup_Call) Run(run func(ctx context.Context, request iamv2.DeleteGroupRequest)) *MockAccountIamV2Interface_DeleteGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteGroup_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteGroup_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteGroup_Call) RunAndReturn(run func(context.Context, iamv2.DeleteGroupRequest) error) *MockAccountIamV2Interface_DeleteGroup_Call { + _c.Call.Return(run) + return _c +} + +// DeleteServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteServicePrincipal(ctx context.Context, request iamv2.DeleteServicePrincipalRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteServicePrincipal") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteServicePrincipalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteServicePrincipal' +type MockAccountIamV2Interface_DeleteServicePrincipal_Call struct { + *mock.Call +} + +// DeleteServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + return &MockAccountIamV2Interface_DeleteServicePrincipal_Call{Call: _e.mock.On("DeleteServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.DeleteServicePrincipalRequest)) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteServicePrincipal_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.DeleteServicePrincipalRequest) error) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// DeleteUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteUser(ctx context.Context, request iamv2.DeleteUserRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteUser") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteUserRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUser' +type MockAccountIamV2Interface_DeleteUser_Call struct { + *mock.Call +} + +// DeleteUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteUserRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteUser_Call { + return &MockAccountIamV2Interface_DeleteUser_Call{Call: _e.mock.On("DeleteUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteUser_Call) Run(run func(ctx context.Context, request iamv2.DeleteUserRequest)) *MockAccountIamV2Interface_DeleteUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteUser_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteUser_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteUser_Call) RunAndReturn(run func(context.Context, iamv2.DeleteUserRequest) error) *MockAccountIamV2Interface_DeleteUser_Call { + _c.Call.Return(run) + return _c +} + +// DeleteWorkspaceAccessDetail provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteWorkspaceAccessDetail(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteWorkspaceAccessDetail") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteWorkspaceAccessDetailRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteWorkspaceAccessDetail' +type MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// DeleteWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call{Call: _e.mock.On("DeleteWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.DeleteWorkspaceAccessDetailRequest) error) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + +// GetGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) GetGroup(ctx context.Context, request iamv2.GetGroupRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetGroup") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroup' +type MockAccountIamV2Interface_GetGroup_Call struct { + *mock.Call +} + +// GetGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) GetGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetGroup_Call { + return &MockAccountIamV2Interface_GetGroup_Call{Call: _e.mock.On("GetGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetGroup_Call) Run(run func(ctx context.Context, request iamv2.GetGroupRequest)) *MockAccountIamV2Interface_GetGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetGroup_Call) Return(_a0 *iamv2.Group, _a1 error) *MockAccountIamV2Interface_GetGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetGroup_Call) RunAndReturn(run func(context.Context, iamv2.GetGroupRequest) (*iamv2.Group, error)) *MockAccountIamV2Interface_GetGroup_Call { + _c.Call.Return(run) + return _c +} + +// GetServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) GetServicePrincipal(ctx context.Context, request iamv2.GetServicePrincipalRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetServicePrincipal") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetServicePrincipal' +type MockAccountIamV2Interface_GetServicePrincipal_Call struct { + *mock.Call +} + +// GetServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) GetServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetServicePrincipal_Call { + return &MockAccountIamV2Interface_GetServicePrincipal_Call{Call: _e.mock.On("GetServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.GetServicePrincipalRequest)) *MockAccountIamV2Interface_GetServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetServicePrincipal_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockAccountIamV2Interface_GetServicePrincipal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.GetServicePrincipalRequest) (*iamv2.ServicePrincipal, error)) *MockAccountIamV2Interface_GetServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// GetUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) GetUser(ctx context.Context, request iamv2.GetUserRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetUser") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUser' +type MockAccountIamV2Interface_GetUser_Call struct { + *mock.Call +} + +// GetUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetUserRequest +func (_e *MockAccountIamV2Interface_Expecter) GetUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetUser_Call { + return &MockAccountIamV2Interface_GetUser_Call{Call: _e.mock.On("GetUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetUser_Call) Run(run func(ctx context.Context, request iamv2.GetUserRequest)) *MockAccountIamV2Interface_GetUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetUser_Call) Return(_a0 *iamv2.User, _a1 error) *MockAccountIamV2Interface_GetUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetUser_Call) RunAndReturn(run func(context.Context, iamv2.GetUserRequest) (*iamv2.User, error)) *MockAccountIamV2Interface_GetUser_Call { + _c.Call.Return(run) + return _c +} + +// GetWorkspaceAccessDetail provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) GetWorkspaceAccessDetail(ctx context.Context, request iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetWorkspaceAccessDetail") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceAccessDetail' +type MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// GetWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) GetWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call{Call: _e.mock.On("GetWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.GetWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + +// ListGroups provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListGroups(ctx context.Context, request iamv2.ListGroupsRequest) (*iamv2.ListGroupsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListGroups") + } + + var r0 *iamv2.ListGroupsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsRequest) (*iamv2.ListGroupsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsRequest) *iamv2.ListGroupsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListGroupsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListGroupsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ListGroups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGroups' +type MockAccountIamV2Interface_ListGroups_Call struct { + *mock.Call +} + +// ListGroups is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListGroupsRequest +func (_e *MockAccountIamV2Interface_Expecter) ListGroups(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListGroups_Call { + return &MockAccountIamV2Interface_ListGroups_Call{Call: _e.mock.On("ListGroups", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ListGroups_Call) Run(run func(ctx context.Context, request iamv2.ListGroupsRequest)) *MockAccountIamV2Interface_ListGroups_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListGroupsRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ListGroups_Call) Return(_a0 *iamv2.ListGroupsResponse, _a1 error) *MockAccountIamV2Interface_ListGroups_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ListGroups_Call) RunAndReturn(run func(context.Context, iamv2.ListGroupsRequest) (*iamv2.ListGroupsResponse, error)) *MockAccountIamV2Interface_ListGroups_Call { + _c.Call.Return(run) + return _c +} + +// ListServicePrincipals provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListServicePrincipals(ctx context.Context, request iamv2.ListServicePrincipalsRequest) (*iamv2.ListServicePrincipalsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListServicePrincipals") + } + + var r0 *iamv2.ListServicePrincipalsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsRequest) (*iamv2.ListServicePrincipalsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsRequest) *iamv2.ListServicePrincipalsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListServicePrincipalsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListServicePrincipalsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ListServicePrincipals_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListServicePrincipals' +type MockAccountIamV2Interface_ListServicePrincipals_Call struct { + *mock.Call +} + +// ListServicePrincipals is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListServicePrincipalsRequest +func (_e *MockAccountIamV2Interface_Expecter) ListServicePrincipals(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListServicePrincipals_Call { + return &MockAccountIamV2Interface_ListServicePrincipals_Call{Call: _e.mock.On("ListServicePrincipals", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ListServicePrincipals_Call) Run(run func(ctx context.Context, request iamv2.ListServicePrincipalsRequest)) *MockAccountIamV2Interface_ListServicePrincipals_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListServicePrincipalsRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ListServicePrincipals_Call) Return(_a0 *iamv2.ListServicePrincipalsResponse, _a1 error) *MockAccountIamV2Interface_ListServicePrincipals_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ListServicePrincipals_Call) RunAndReturn(run func(context.Context, iamv2.ListServicePrincipalsRequest) (*iamv2.ListServicePrincipalsResponse, error)) *MockAccountIamV2Interface_ListServicePrincipals_Call { + _c.Call.Return(run) + return _c +} + +// ListUsers provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListUsers(ctx context.Context, request iamv2.ListUsersRequest) (*iamv2.ListUsersResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListUsers") + } + + var r0 *iamv2.ListUsersResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersRequest) (*iamv2.ListUsersResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersRequest) *iamv2.ListUsersResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListUsersResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListUsersRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ListUsers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListUsers' +type MockAccountIamV2Interface_ListUsers_Call struct { + *mock.Call +} + +// ListUsers is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListUsersRequest +func (_e *MockAccountIamV2Interface_Expecter) ListUsers(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListUsers_Call { + return &MockAccountIamV2Interface_ListUsers_Call{Call: _e.mock.On("ListUsers", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ListUsers_Call) Run(run func(ctx context.Context, request iamv2.ListUsersRequest)) *MockAccountIamV2Interface_ListUsers_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListUsersRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ListUsers_Call) Return(_a0 *iamv2.ListUsersResponse, _a1 error) *MockAccountIamV2Interface_ListUsers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ListUsers_Call) RunAndReturn(run func(context.Context, iamv2.ListUsersRequest) (*iamv2.ListUsersResponse, error)) *MockAccountIamV2Interface_ListUsers_Call { + _c.Call.Return(run) + return _c +} + +// ListWorkspaceAccessDetails provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListWorkspaceAccessDetails(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListWorkspaceAccessDetails") + } + + var r0 *iamv2.ListWorkspaceAccessDetailsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) *iamv2.ListWorkspaceAccessDetailsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListWorkspaceAccessDetailsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWorkspaceAccessDetails' +type MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call struct { + *mock.Call +} + +// ListWorkspaceAccessDetails is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListWorkspaceAccessDetailsRequest +func (_e *MockAccountIamV2Interface_Expecter) ListWorkspaceAccessDetails(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { + return &MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call{Call: _e.mock.On("ListWorkspaceAccessDetails", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call) Run(run func(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsRequest)) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListWorkspaceAccessDetailsRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call) Return(_a0 *iamv2.ListWorkspaceAccessDetailsResponse, _a1 error) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call) RunAndReturn(run func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { + _c.Call.Return(run) + return _c +} + +// ResolveGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ResolveGroup(ctx context.Context, request iamv2.ResolveGroupRequest) (*iamv2.ResolveGroupResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ResolveGroup") + } + + var r0 *iamv2.ResolveGroupResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveGroupRequest) (*iamv2.ResolveGroupResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveGroupRequest) *iamv2.ResolveGroupResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ResolveGroupResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ResolveGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ResolveGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResolveGroup' +type MockAccountIamV2Interface_ResolveGroup_Call struct { + *mock.Call +} + +// ResolveGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ResolveGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) ResolveGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ResolveGroup_Call { + return &MockAccountIamV2Interface_ResolveGroup_Call{Call: _e.mock.On("ResolveGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ResolveGroup_Call) Run(run func(ctx context.Context, request iamv2.ResolveGroupRequest)) *MockAccountIamV2Interface_ResolveGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ResolveGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ResolveGroup_Call) Return(_a0 *iamv2.ResolveGroupResponse, _a1 error) *MockAccountIamV2Interface_ResolveGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ResolveGroup_Call) RunAndReturn(run func(context.Context, iamv2.ResolveGroupRequest) (*iamv2.ResolveGroupResponse, error)) *MockAccountIamV2Interface_ResolveGroup_Call { + _c.Call.Return(run) + return _c +} + +// ResolveServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ResolveServicePrincipal(ctx context.Context, request iamv2.ResolveServicePrincipalRequest) (*iamv2.ResolveServicePrincipalResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ResolveServicePrincipal") + } + + var r0 *iamv2.ResolveServicePrincipalResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveServicePrincipalRequest) (*iamv2.ResolveServicePrincipalResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveServicePrincipalRequest) *iamv2.ResolveServicePrincipalResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ResolveServicePrincipalResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ResolveServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ResolveServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResolveServicePrincipal' +type MockAccountIamV2Interface_ResolveServicePrincipal_Call struct { + *mock.Call +} + +// ResolveServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ResolveServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) ResolveServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ResolveServicePrincipal_Call { + return &MockAccountIamV2Interface_ResolveServicePrincipal_Call{Call: _e.mock.On("ResolveServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ResolveServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.ResolveServicePrincipalRequest)) *MockAccountIamV2Interface_ResolveServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ResolveServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ResolveServicePrincipal_Call) Return(_a0 *iamv2.ResolveServicePrincipalResponse, _a1 error) *MockAccountIamV2Interface_ResolveServicePrincipal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ResolveServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.ResolveServicePrincipalRequest) (*iamv2.ResolveServicePrincipalResponse, error)) *MockAccountIamV2Interface_ResolveServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// ResolveUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ResolveUser(ctx context.Context, request iamv2.ResolveUserRequest) (*iamv2.ResolveUserResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ResolveUser") + } + + var r0 *iamv2.ResolveUserResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveUserRequest) (*iamv2.ResolveUserResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveUserRequest) *iamv2.ResolveUserResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ResolveUserResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ResolveUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ResolveUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResolveUser' +type MockAccountIamV2Interface_ResolveUser_Call struct { + *mock.Call +} + +// ResolveUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ResolveUserRequest +func (_e *MockAccountIamV2Interface_Expecter) ResolveUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ResolveUser_Call { + return &MockAccountIamV2Interface_ResolveUser_Call{Call: _e.mock.On("ResolveUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ResolveUser_Call) Run(run func(ctx context.Context, request iamv2.ResolveUserRequest)) *MockAccountIamV2Interface_ResolveUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ResolveUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ResolveUser_Call) Return(_a0 *iamv2.ResolveUserResponse, _a1 error) *MockAccountIamV2Interface_ResolveUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ResolveUser_Call) RunAndReturn(run func(context.Context, iamv2.ResolveUserRequest) (*iamv2.ResolveUserResponse, error)) *MockAccountIamV2Interface_ResolveUser_Call { + _c.Call.Return(run) + return _c +} + +// UpdateGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateGroup(ctx context.Context, request iamv2.UpdateGroupRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateGroup") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGroup' +type MockAccountIamV2Interface_UpdateGroup_Call struct { + *mock.Call +} + +// UpdateGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateGroup_Call { + return &MockAccountIamV2Interface_UpdateGroup_Call{Call: _e.mock.On("UpdateGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateGroup_Call) Run(run func(ctx context.Context, request iamv2.UpdateGroupRequest)) *MockAccountIamV2Interface_UpdateGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateGroup_Call) Return(_a0 *iamv2.Group, _a1 error) *MockAccountIamV2Interface_UpdateGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateGroup_Call) RunAndReturn(run func(context.Context, iamv2.UpdateGroupRequest) (*iamv2.Group, error)) *MockAccountIamV2Interface_UpdateGroup_Call { + _c.Call.Return(run) + return _c +} + +// UpdateServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateServicePrincipal(ctx context.Context, request iamv2.UpdateServicePrincipalRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateServicePrincipal") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateServicePrincipal' +type MockAccountIamV2Interface_UpdateServicePrincipal_Call struct { + *mock.Call +} + +// UpdateServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + return &MockAccountIamV2Interface_UpdateServicePrincipal_Call{Call: _e.mock.On("UpdateServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.UpdateServicePrincipalRequest)) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateServicePrincipal_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.UpdateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// UpdateUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateUser(ctx context.Context, request iamv2.UpdateUserRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateUser") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUser' +type MockAccountIamV2Interface_UpdateUser_Call struct { + *mock.Call +} + +// UpdateUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateUserRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateUser_Call { + return &MockAccountIamV2Interface_UpdateUser_Call{Call: _e.mock.On("UpdateUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateUser_Call) Run(run func(ctx context.Context, request iamv2.UpdateUserRequest)) *MockAccountIamV2Interface_UpdateUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateUser_Call) Return(_a0 *iamv2.User, _a1 error) *MockAccountIamV2Interface_UpdateUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateUser_Call) RunAndReturn(run func(context.Context, iamv2.UpdateUserRequest) (*iamv2.User, error)) *MockAccountIamV2Interface_UpdateUser_Call { + _c.Call.Return(run) + return _c +} + +// UpdateWorkspaceAccessDetail provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateWorkspaceAccessDetail(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateWorkspaceAccessDetail") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateWorkspaceAccessDetail' +type MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// UpdateWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call{Call: _e.mock.On("UpdateWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + +// NewMockAccountIamV2Interface creates a new instance of MockAccountIamV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockAccountIamV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockAccountIamV2Interface { + mock := &MockAccountIamV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go b/experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go new file mode 100644 index 000000000..a696d842a --- /dev/null +++ b/experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go @@ -0,0 +1,1346 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package iamv2 + +import ( + context "context" + + iamv2 "github.com/databricks/databricks-sdk-go/service/iamv2" + mock "github.com/stretchr/testify/mock" +) + +// MockWorkspaceIamV2Interface is an autogenerated mock type for the WorkspaceIamV2Interface type +type MockWorkspaceIamV2Interface struct { + mock.Mock +} + +type MockWorkspaceIamV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockWorkspaceIamV2Interface) EXPECT() *MockWorkspaceIamV2Interface_Expecter { + return &MockWorkspaceIamV2Interface_Expecter{mock: &_m.Mock} +} + +// CreateGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateGroupProxy(ctx context.Context, request iamv2.CreateGroupProxyRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateGroupProxy") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupProxyRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupProxyRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateGroupProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGroupProxy' +type MockWorkspaceIamV2Interface_CreateGroupProxy_Call struct { + *mock.Call +} + +// CreateGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + return &MockWorkspaceIamV2Interface_CreateGroupProxy_Call{Call: _e.mock.On("CreateGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.CreateGroupProxyRequest)) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateGroupProxy_Call) Return(_a0 *iamv2.Group, _a1 error) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.CreateGroupProxyRequest) (*iamv2.Group, error)) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// CreateServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateServicePrincipalProxy(ctx context.Context, request iamv2.CreateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateServicePrincipalProxy") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalProxyRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateServicePrincipalProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateServicePrincipalProxy' +type MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call struct { + *mock.Call +} + +// CreateServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call{Call: _e.mock.On("CreateServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.CreateServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.CreateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// CreateUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateUserProxy(ctx context.Context, request iamv2.CreateUserProxyRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateUserProxy") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserProxyRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserProxyRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateUserProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUserProxy' +type MockWorkspaceIamV2Interface_CreateUserProxy_Call struct { + *mock.Call +} + +// CreateUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + return &MockWorkspaceIamV2Interface_CreateUserProxy_Call{Call: _e.mock.On("CreateUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateUserProxy_Call) Run(run func(ctx context.Context, request iamv2.CreateUserProxyRequest)) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateUserProxy_Call) Return(_a0 *iamv2.User, _a1 error) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.CreateUserProxyRequest) (*iamv2.User, error)) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + _c.Call.Return(run) + return _c +} + +// CreateWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateWorkspaceAccessDetailLocal") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// CreateWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("CreateWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + +// DeleteGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteGroupProxy(ctx context.Context, request iamv2.DeleteGroupProxyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteGroupProxy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteGroupProxyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGroupProxy' +type MockWorkspaceIamV2Interface_DeleteGroupProxy_Call struct { + *mock.Call +} + +// DeleteGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + return &MockWorkspaceIamV2Interface_DeleteGroupProxy_Call{Call: _e.mock.On("DeleteGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.DeleteGroupProxyRequest)) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.DeleteGroupProxyRequest) error) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// DeleteServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteServicePrincipalProxy(ctx context.Context, request iamv2.DeleteServicePrincipalProxyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteServicePrincipalProxy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteServicePrincipalProxyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteServicePrincipalProxy' +type MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call struct { + *mock.Call +} + +// DeleteServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call{Call: _e.mock.On("DeleteServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.DeleteServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.DeleteServicePrincipalProxyRequest) error) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// DeleteUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteUserProxy(ctx context.Context, request iamv2.DeleteUserProxyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteUserProxy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteUserProxyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUserProxy' +type MockWorkspaceIamV2Interface_DeleteUserProxy_Call struct { + *mock.Call +} + +// DeleteUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + return &MockWorkspaceIamV2Interface_DeleteUserProxy_Call{Call: _e.mock.On("DeleteUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteUserProxy_Call) Run(run func(ctx context.Context, request iamv2.DeleteUserProxyRequest)) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteUserProxy_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.DeleteUserProxyRequest) error) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + _c.Call.Return(run) + return _c +} + +// DeleteWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailLocalRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteWorkspaceAccessDetailLocal") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteWorkspaceAccessDetailLocalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// DeleteWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("DeleteWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.DeleteWorkspaceAccessDetailLocalRequest) error) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + +// GetGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) GetGroupProxy(ctx context.Context, request iamv2.GetGroupProxyRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetGroupProxy") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupProxyRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupProxyRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetGroupProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroupProxy' +type MockWorkspaceIamV2Interface_GetGroupProxy_Call struct { + *mock.Call +} + +// GetGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + return &MockWorkspaceIamV2Interface_GetGroupProxy_Call{Call: _e.mock.On("GetGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.GetGroupProxyRequest)) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetGroupProxy_Call) Return(_a0 *iamv2.Group, _a1 error) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.GetGroupProxyRequest) (*iamv2.Group, error)) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// GetServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) GetServicePrincipalProxy(ctx context.Context, request iamv2.GetServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetServicePrincipalProxy") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalProxyRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetServicePrincipalProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetServicePrincipalProxy' +type MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call struct { + *mock.Call +} + +// GetServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call{Call: _e.mock.On("GetServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.GetServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.GetServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// GetUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) GetUserProxy(ctx context.Context, request iamv2.GetUserProxyRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetUserProxy") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserProxyRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserProxyRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetUserProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUserProxy' +type MockWorkspaceIamV2Interface_GetUserProxy_Call struct { + *mock.Call +} + +// GetUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + return &MockWorkspaceIamV2Interface_GetUserProxy_Call{Call: _e.mock.On("GetUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetUserProxy_Call) Run(run func(ctx context.Context, request iamv2.GetUserProxyRequest)) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetUserProxy_Call) Return(_a0 *iamv2.User, _a1 error) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.GetUserProxyRequest) (*iamv2.User, error)) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + _c.Call.Return(run) + return _c +} + +// GetWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) GetWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetWorkspaceAccessDetailLocal") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// GetWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("GetWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.GetWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + +// ListGroupsProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListGroupsProxy(ctx context.Context, request iamv2.ListGroupsProxyRequest) (*iamv2.ListGroupsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListGroupsProxy") + } + + var r0 *iamv2.ListGroupsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsProxyRequest) (*iamv2.ListGroupsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsProxyRequest) *iamv2.ListGroupsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListGroupsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListGroupsProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ListGroupsProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGroupsProxy' +type MockWorkspaceIamV2Interface_ListGroupsProxy_Call struct { + *mock.Call +} + +// ListGroupsProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListGroupsProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListGroupsProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + return &MockWorkspaceIamV2Interface_ListGroupsProxy_Call{Call: _e.mock.On("ListGroupsProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ListGroupsProxy_Call) Run(run func(ctx context.Context, request iamv2.ListGroupsProxyRequest)) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListGroupsProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListGroupsProxy_Call) Return(_a0 *iamv2.ListGroupsResponse, _a1 error) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListGroupsProxy_Call) RunAndReturn(run func(context.Context, iamv2.ListGroupsProxyRequest) (*iamv2.ListGroupsResponse, error)) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + _c.Call.Return(run) + return _c +} + +// ListServicePrincipalsProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListServicePrincipalsProxy(ctx context.Context, request iamv2.ListServicePrincipalsProxyRequest) (*iamv2.ListServicePrincipalsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListServicePrincipalsProxy") + } + + var r0 *iamv2.ListServicePrincipalsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsProxyRequest) (*iamv2.ListServicePrincipalsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsProxyRequest) *iamv2.ListServicePrincipalsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListServicePrincipalsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListServicePrincipalsProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListServicePrincipalsProxy' +type MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call struct { + *mock.Call +} + +// ListServicePrincipalsProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListServicePrincipalsProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListServicePrincipalsProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + return &MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call{Call: _e.mock.On("ListServicePrincipalsProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call) Run(run func(ctx context.Context, request iamv2.ListServicePrincipalsProxyRequest)) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListServicePrincipalsProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call) Return(_a0 *iamv2.ListServicePrincipalsResponse, _a1 error) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call) RunAndReturn(run func(context.Context, iamv2.ListServicePrincipalsProxyRequest) (*iamv2.ListServicePrincipalsResponse, error)) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + _c.Call.Return(run) + return _c +} + +// ListUsersProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListUsersProxy(ctx context.Context, request iamv2.ListUsersProxyRequest) (*iamv2.ListUsersResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListUsersProxy") + } + + var r0 *iamv2.ListUsersResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersProxyRequest) (*iamv2.ListUsersResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersProxyRequest) *iamv2.ListUsersResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListUsersResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListUsersProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ListUsersProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListUsersProxy' +type MockWorkspaceIamV2Interface_ListUsersProxy_Call struct { + *mock.Call +} + +// ListUsersProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListUsersProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListUsersProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { + return &MockWorkspaceIamV2Interface_ListUsersProxy_Call{Call: _e.mock.On("ListUsersProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ListUsersProxy_Call) Run(run func(ctx context.Context, request iamv2.ListUsersProxyRequest)) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListUsersProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListUsersProxy_Call) Return(_a0 *iamv2.ListUsersResponse, _a1 error) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListUsersProxy_Call) RunAndReturn(run func(context.Context, iamv2.ListUsersProxyRequest) (*iamv2.ListUsersResponse, error)) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { + _c.Call.Return(run) + return _c +} + +// ListWorkspaceAccessDetailsLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListWorkspaceAccessDetailsLocal(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsLocalRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListWorkspaceAccessDetailsLocal") + } + + var r0 *iamv2.ListWorkspaceAccessDetailsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) *iamv2.ListWorkspaceAccessDetailsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListWorkspaceAccessDetailsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWorkspaceAccessDetailsLocal' +type MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call struct { + *mock.Call +} + +// ListWorkspaceAccessDetailsLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListWorkspaceAccessDetailsLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListWorkspaceAccessDetailsLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { + return &MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call{Call: _e.mock.On("ListWorkspaceAccessDetailsLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call) Run(run func(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsLocalRequest)) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListWorkspaceAccessDetailsLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call) Return(_a0 *iamv2.ListWorkspaceAccessDetailsResponse, _a1 error) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call) RunAndReturn(run func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { + _c.Call.Return(run) + return _c +} + +// ResolveGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ResolveGroupProxy(ctx context.Context, request iamv2.ResolveGroupProxyRequest) (*iamv2.ResolveGroupResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ResolveGroupProxy") + } + + var r0 *iamv2.ResolveGroupResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveGroupProxyRequest) (*iamv2.ResolveGroupResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveGroupProxyRequest) *iamv2.ResolveGroupResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ResolveGroupResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ResolveGroupProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ResolveGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResolveGroupProxy' +type MockWorkspaceIamV2Interface_ResolveGroupProxy_Call struct { + *mock.Call +} + +// ResolveGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ResolveGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ResolveGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ResolveGroupProxy_Call { + return &MockWorkspaceIamV2Interface_ResolveGroupProxy_Call{Call: _e.mock.On("ResolveGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ResolveGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.ResolveGroupProxyRequest)) *MockWorkspaceIamV2Interface_ResolveGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ResolveGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ResolveGroupProxy_Call) Return(_a0 *iamv2.ResolveGroupResponse, _a1 error) *MockWorkspaceIamV2Interface_ResolveGroupProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ResolveGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.ResolveGroupProxyRequest) (*iamv2.ResolveGroupResponse, error)) *MockWorkspaceIamV2Interface_ResolveGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// ResolveServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ResolveServicePrincipalProxy(ctx context.Context, request iamv2.ResolveServicePrincipalProxyRequest) (*iamv2.ResolveServicePrincipalResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ResolveServicePrincipalProxy") + } + + var r0 *iamv2.ResolveServicePrincipalResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveServicePrincipalProxyRequest) (*iamv2.ResolveServicePrincipalResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveServicePrincipalProxyRequest) *iamv2.ResolveServicePrincipalResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ResolveServicePrincipalResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ResolveServicePrincipalProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ResolveServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResolveServicePrincipalProxy' +type MockWorkspaceIamV2Interface_ResolveServicePrincipalProxy_Call struct { + *mock.Call +} + +// ResolveServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ResolveServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ResolveServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ResolveServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_ResolveServicePrincipalProxy_Call{Call: _e.mock.On("ResolveServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ResolveServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.ResolveServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_ResolveServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ResolveServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ResolveServicePrincipalProxy_Call) Return(_a0 *iamv2.ResolveServicePrincipalResponse, _a1 error) *MockWorkspaceIamV2Interface_ResolveServicePrincipalProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ResolveServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.ResolveServicePrincipalProxyRequest) (*iamv2.ResolveServicePrincipalResponse, error)) *MockWorkspaceIamV2Interface_ResolveServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// ResolveUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ResolveUserProxy(ctx context.Context, request iamv2.ResolveUserProxyRequest) (*iamv2.ResolveUserResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ResolveUserProxy") + } + + var r0 *iamv2.ResolveUserResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveUserProxyRequest) (*iamv2.ResolveUserResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ResolveUserProxyRequest) *iamv2.ResolveUserResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ResolveUserResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ResolveUserProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ResolveUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResolveUserProxy' +type MockWorkspaceIamV2Interface_ResolveUserProxy_Call struct { + *mock.Call +} + +// ResolveUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ResolveUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ResolveUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ResolveUserProxy_Call { + return &MockWorkspaceIamV2Interface_ResolveUserProxy_Call{Call: _e.mock.On("ResolveUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ResolveUserProxy_Call) Run(run func(ctx context.Context, request iamv2.ResolveUserProxyRequest)) *MockWorkspaceIamV2Interface_ResolveUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ResolveUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ResolveUserProxy_Call) Return(_a0 *iamv2.ResolveUserResponse, _a1 error) *MockWorkspaceIamV2Interface_ResolveUserProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ResolveUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.ResolveUserProxyRequest) (*iamv2.ResolveUserResponse, error)) *MockWorkspaceIamV2Interface_ResolveUserProxy_Call { + _c.Call.Return(run) + return _c +} + +// UpdateGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateGroupProxy(ctx context.Context, request iamv2.UpdateGroupProxyRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateGroupProxy") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupProxyRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupProxyRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateGroupProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGroupProxy' +type MockWorkspaceIamV2Interface_UpdateGroupProxy_Call struct { + *mock.Call +} + +// UpdateGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + return &MockWorkspaceIamV2Interface_UpdateGroupProxy_Call{Call: _e.mock.On("UpdateGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.UpdateGroupProxyRequest)) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call) Return(_a0 *iamv2.Group, _a1 error) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.UpdateGroupProxyRequest) (*iamv2.Group, error)) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// UpdateServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateServicePrincipalProxy(ctx context.Context, request iamv2.UpdateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateServicePrincipalProxy") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateServicePrincipalProxy' +type MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call struct { + *mock.Call +} + +// UpdateServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call{Call: _e.mock.On("UpdateServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.UpdateServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// UpdateUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateUserProxy(ctx context.Context, request iamv2.UpdateUserProxyRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateUserProxy") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserProxyRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserProxyRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateUserProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUserProxy' +type MockWorkspaceIamV2Interface_UpdateUserProxy_Call struct { + *mock.Call +} + +// UpdateUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + return &MockWorkspaceIamV2Interface_UpdateUserProxy_Call{Call: _e.mock.On("UpdateUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateUserProxy_Call) Run(run func(ctx context.Context, request iamv2.UpdateUserProxyRequest)) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateUserProxy_Call) Return(_a0 *iamv2.User, _a1 error) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.UpdateUserProxyRequest) (*iamv2.User, error)) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + _c.Call.Return(run) + return _c +} + +// UpdateWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateWorkspaceAccessDetailLocal") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// UpdateWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("UpdateWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + +// NewMockWorkspaceIamV2Interface creates a new instance of MockWorkspaceIamV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockWorkspaceIamV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockWorkspaceIamV2Interface { + mock := &MockWorkspaceIamV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/ml/mock_experiments_interface.go b/experimental/mocks/service/ml/mock_experiments_interface.go index 20e4fce27..89a70eefa 100644 --- a/experimental/mocks/service/ml/mock_experiments_interface.go +++ b/experimental/mocks/service/ml/mock_experiments_interface.go @@ -993,6 +993,65 @@ func (_c *MockExperimentsInterface_GetLoggedModelByModelId_Call) RunAndReturn(ru return _c } +// GetLoggedModels provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) GetLoggedModels(ctx context.Context, request ml.GetLoggedModelsRequest) (*ml.GetLoggedModelsRequestResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetLoggedModels") + } + + var r0 *ml.GetLoggedModelsRequestResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.GetLoggedModelsRequest) (*ml.GetLoggedModelsRequestResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.GetLoggedModelsRequest) *ml.GetLoggedModelsRequestResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.GetLoggedModelsRequestResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.GetLoggedModelsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockExperimentsInterface_GetLoggedModels_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLoggedModels' +type MockExperimentsInterface_GetLoggedModels_Call struct { + *mock.Call +} + +// GetLoggedModels is a helper method to define mock.On call +// - ctx context.Context +// - request ml.GetLoggedModelsRequest +func (_e *MockExperimentsInterface_Expecter) GetLoggedModels(ctx interface{}, request interface{}) *MockExperimentsInterface_GetLoggedModels_Call { + return &MockExperimentsInterface_GetLoggedModels_Call{Call: _e.mock.On("GetLoggedModels", ctx, request)} +} + +func (_c *MockExperimentsInterface_GetLoggedModels_Call) Run(run func(ctx context.Context, request ml.GetLoggedModelsRequest)) *MockExperimentsInterface_GetLoggedModels_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.GetLoggedModelsRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_GetLoggedModels_Call) Return(_a0 *ml.GetLoggedModelsRequestResponse, _a1 error) *MockExperimentsInterface_GetLoggedModels_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockExperimentsInterface_GetLoggedModels_Call) RunAndReturn(run func(context.Context, ml.GetLoggedModelsRequest) (*ml.GetLoggedModelsRequestResponse, error)) *MockExperimentsInterface_GetLoggedModels_Call { + _c.Call.Return(run) + return _c +} + // GetPermissionLevels provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) GetPermissionLevels(ctx context.Context, request ml.GetExperimentPermissionLevelsRequest) (*ml.GetExperimentPermissionLevelsResponse, error) { ret := _m.Called(ctx, request) diff --git a/experimental/mocks/service/ml/mock_feature_engineering_interface.go b/experimental/mocks/service/ml/mock_feature_engineering_interface.go new file mode 100644 index 000000000..aa2cc7bc1 --- /dev/null +++ b/experimental/mocks/service/ml/mock_feature_engineering_interface.go @@ -0,0 +1,371 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package ml + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + ml "github.com/databricks/databricks-sdk-go/service/ml" + + mock "github.com/stretchr/testify/mock" +) + +// MockFeatureEngineeringInterface is an autogenerated mock type for the FeatureEngineeringInterface type +type MockFeatureEngineeringInterface struct { + mock.Mock +} + +type MockFeatureEngineeringInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockFeatureEngineeringInterface) EXPECT() *MockFeatureEngineeringInterface_Expecter { + return &MockFeatureEngineeringInterface_Expecter{mock: &_m.Mock} +} + +// CreateFeature provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) CreateFeature(ctx context.Context, request ml.CreateFeatureRequest) (*ml.Feature, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateFeature") + } + + var r0 *ml.Feature + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.CreateFeatureRequest) (*ml.Feature, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.CreateFeatureRequest) *ml.Feature); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.Feature) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.CreateFeatureRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockFeatureEngineeringInterface_CreateFeature_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFeature' +type MockFeatureEngineeringInterface_CreateFeature_Call struct { + *mock.Call +} + +// CreateFeature is a helper method to define mock.On call +// - ctx context.Context +// - request ml.CreateFeatureRequest +func (_e *MockFeatureEngineeringInterface_Expecter) CreateFeature(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_CreateFeature_Call { + return &MockFeatureEngineeringInterface_CreateFeature_Call{Call: _e.mock.On("CreateFeature", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_CreateFeature_Call) Run(run func(ctx context.Context, request ml.CreateFeatureRequest)) *MockFeatureEngineeringInterface_CreateFeature_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.CreateFeatureRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_CreateFeature_Call) Return(_a0 *ml.Feature, _a1 error) *MockFeatureEngineeringInterface_CreateFeature_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockFeatureEngineeringInterface_CreateFeature_Call) RunAndReturn(run func(context.Context, ml.CreateFeatureRequest) (*ml.Feature, error)) *MockFeatureEngineeringInterface_CreateFeature_Call { + _c.Call.Return(run) + return _c +} + +// DeleteFeature provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) DeleteFeature(ctx context.Context, request ml.DeleteFeatureRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteFeature") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, ml.DeleteFeatureRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockFeatureEngineeringInterface_DeleteFeature_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteFeature' +type MockFeatureEngineeringInterface_DeleteFeature_Call struct { + *mock.Call +} + +// DeleteFeature is a helper method to define mock.On call +// - ctx context.Context +// - request ml.DeleteFeatureRequest +func (_e *MockFeatureEngineeringInterface_Expecter) DeleteFeature(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_DeleteFeature_Call { + return &MockFeatureEngineeringInterface_DeleteFeature_Call{Call: _e.mock.On("DeleteFeature", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_DeleteFeature_Call) Run(run func(ctx context.Context, request ml.DeleteFeatureRequest)) *MockFeatureEngineeringInterface_DeleteFeature_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.DeleteFeatureRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_DeleteFeature_Call) Return(_a0 error) *MockFeatureEngineeringInterface_DeleteFeature_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockFeatureEngineeringInterface_DeleteFeature_Call) RunAndReturn(run func(context.Context, ml.DeleteFeatureRequest) error) *MockFeatureEngineeringInterface_DeleteFeature_Call { + _c.Call.Return(run) + return _c +} + +// GetFeature provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) GetFeature(ctx context.Context, request ml.GetFeatureRequest) (*ml.Feature, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetFeature") + } + + var r0 *ml.Feature + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.GetFeatureRequest) (*ml.Feature, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.GetFeatureRequest) *ml.Feature); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.Feature) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.GetFeatureRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockFeatureEngineeringInterface_GetFeature_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFeature' +type MockFeatureEngineeringInterface_GetFeature_Call struct { + *mock.Call +} + +// GetFeature is a helper method to define mock.On call +// - ctx context.Context +// - request ml.GetFeatureRequest +func (_e *MockFeatureEngineeringInterface_Expecter) GetFeature(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_GetFeature_Call { + return &MockFeatureEngineeringInterface_GetFeature_Call{Call: _e.mock.On("GetFeature", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_GetFeature_Call) Run(run func(ctx context.Context, request ml.GetFeatureRequest)) *MockFeatureEngineeringInterface_GetFeature_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.GetFeatureRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_GetFeature_Call) Return(_a0 *ml.Feature, _a1 error) *MockFeatureEngineeringInterface_GetFeature_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockFeatureEngineeringInterface_GetFeature_Call) RunAndReturn(run func(context.Context, ml.GetFeatureRequest) (*ml.Feature, error)) *MockFeatureEngineeringInterface_GetFeature_Call { + _c.Call.Return(run) + return _c +} + +// ListFeatures provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) ListFeatures(ctx context.Context, request ml.ListFeaturesRequest) listing.Iterator[ml.Feature] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListFeatures") + } + + var r0 listing.Iterator[ml.Feature] + if rf, ok := ret.Get(0).(func(context.Context, ml.ListFeaturesRequest) listing.Iterator[ml.Feature]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[ml.Feature]) + } + } + + return r0 +} + +// MockFeatureEngineeringInterface_ListFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListFeatures' +type MockFeatureEngineeringInterface_ListFeatures_Call struct { + *mock.Call +} + +// ListFeatures is a helper method to define mock.On call +// - ctx context.Context +// - request ml.ListFeaturesRequest +func (_e *MockFeatureEngineeringInterface_Expecter) ListFeatures(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_ListFeatures_Call { + return &MockFeatureEngineeringInterface_ListFeatures_Call{Call: _e.mock.On("ListFeatures", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_ListFeatures_Call) Run(run func(ctx context.Context, request ml.ListFeaturesRequest)) *MockFeatureEngineeringInterface_ListFeatures_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.ListFeaturesRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_ListFeatures_Call) Return(_a0 listing.Iterator[ml.Feature]) *MockFeatureEngineeringInterface_ListFeatures_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockFeatureEngineeringInterface_ListFeatures_Call) RunAndReturn(run func(context.Context, ml.ListFeaturesRequest) listing.Iterator[ml.Feature]) *MockFeatureEngineeringInterface_ListFeatures_Call { + _c.Call.Return(run) + return _c +} + +// ListFeaturesAll provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) ListFeaturesAll(ctx context.Context, request ml.ListFeaturesRequest) ([]ml.Feature, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListFeaturesAll") + } + + var r0 []ml.Feature + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.ListFeaturesRequest) ([]ml.Feature, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.ListFeaturesRequest) []ml.Feature); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]ml.Feature) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.ListFeaturesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockFeatureEngineeringInterface_ListFeaturesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListFeaturesAll' +type MockFeatureEngineeringInterface_ListFeaturesAll_Call struct { + *mock.Call +} + +// ListFeaturesAll is a helper method to define mock.On call +// - ctx context.Context +// - request ml.ListFeaturesRequest +func (_e *MockFeatureEngineeringInterface_Expecter) ListFeaturesAll(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_ListFeaturesAll_Call { + return &MockFeatureEngineeringInterface_ListFeaturesAll_Call{Call: _e.mock.On("ListFeaturesAll", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_ListFeaturesAll_Call) Run(run func(ctx context.Context, request ml.ListFeaturesRequest)) *MockFeatureEngineeringInterface_ListFeaturesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.ListFeaturesRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_ListFeaturesAll_Call) Return(_a0 []ml.Feature, _a1 error) *MockFeatureEngineeringInterface_ListFeaturesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockFeatureEngineeringInterface_ListFeaturesAll_Call) RunAndReturn(run func(context.Context, ml.ListFeaturesRequest) ([]ml.Feature, error)) *MockFeatureEngineeringInterface_ListFeaturesAll_Call { + _c.Call.Return(run) + return _c +} + +// UpdateFeature provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) UpdateFeature(ctx context.Context, request ml.UpdateFeatureRequest) (*ml.Feature, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateFeature") + } + + var r0 *ml.Feature + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.UpdateFeatureRequest) (*ml.Feature, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.UpdateFeatureRequest) *ml.Feature); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.Feature) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.UpdateFeatureRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockFeatureEngineeringInterface_UpdateFeature_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateFeature' +type MockFeatureEngineeringInterface_UpdateFeature_Call struct { + *mock.Call +} + +// UpdateFeature is a helper method to define mock.On call +// - ctx context.Context +// - request ml.UpdateFeatureRequest +func (_e *MockFeatureEngineeringInterface_Expecter) UpdateFeature(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_UpdateFeature_Call { + return &MockFeatureEngineeringInterface_UpdateFeature_Call{Call: _e.mock.On("UpdateFeature", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_UpdateFeature_Call) Run(run func(ctx context.Context, request ml.UpdateFeatureRequest)) *MockFeatureEngineeringInterface_UpdateFeature_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.UpdateFeatureRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_UpdateFeature_Call) Return(_a0 *ml.Feature, _a1 error) *MockFeatureEngineeringInterface_UpdateFeature_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockFeatureEngineeringInterface_UpdateFeature_Call) RunAndReturn(run func(context.Context, ml.UpdateFeatureRequest) (*ml.Feature, error)) *MockFeatureEngineeringInterface_UpdateFeature_Call { + _c.Call.Return(run) + return _c +} + +// NewMockFeatureEngineeringInterface creates a new instance of MockFeatureEngineeringInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockFeatureEngineeringInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockFeatureEngineeringInterface { + mock := &MockFeatureEngineeringInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/pipelines/mock_pipelines_interface.go b/experimental/mocks/service/pipelines/mock_pipelines_interface.go index 0ac64dd7a..c8abba99e 100644 --- a/experimental/mocks/service/pipelines/mock_pipelines_interface.go +++ b/experimental/mocks/service/pipelines/mock_pipelines_interface.go @@ -28,6 +28,65 @@ func (_m *MockPipelinesInterface) EXPECT() *MockPipelinesInterface_Expecter { return &MockPipelinesInterface_Expecter{mock: &_m.Mock} } +// ApplyEnvironment provides a mock function with given fields: ctx, request +func (_m *MockPipelinesInterface) ApplyEnvironment(ctx context.Context, request pipelines.ApplyEnvironmentRequest) (*pipelines.ApplyEnvironmentRequestResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ApplyEnvironment") + } + + var r0 *pipelines.ApplyEnvironmentRequestResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, pipelines.ApplyEnvironmentRequest) (*pipelines.ApplyEnvironmentRequestResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, pipelines.ApplyEnvironmentRequest) *pipelines.ApplyEnvironmentRequestResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*pipelines.ApplyEnvironmentRequestResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, pipelines.ApplyEnvironmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPipelinesInterface_ApplyEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyEnvironment' +type MockPipelinesInterface_ApplyEnvironment_Call struct { + *mock.Call +} + +// ApplyEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request pipelines.ApplyEnvironmentRequest +func (_e *MockPipelinesInterface_Expecter) ApplyEnvironment(ctx interface{}, request interface{}) *MockPipelinesInterface_ApplyEnvironment_Call { + return &MockPipelinesInterface_ApplyEnvironment_Call{Call: _e.mock.On("ApplyEnvironment", ctx, request)} +} + +func (_c *MockPipelinesInterface_ApplyEnvironment_Call) Run(run func(ctx context.Context, request pipelines.ApplyEnvironmentRequest)) *MockPipelinesInterface_ApplyEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(pipelines.ApplyEnvironmentRequest)) + }) + return _c +} + +func (_c *MockPipelinesInterface_ApplyEnvironment_Call) Return(_a0 *pipelines.ApplyEnvironmentRequestResponse, _a1 error) *MockPipelinesInterface_ApplyEnvironment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPipelinesInterface_ApplyEnvironment_Call) RunAndReturn(run func(context.Context, pipelines.ApplyEnvironmentRequest) (*pipelines.ApplyEnvironmentRequestResponse, error)) *MockPipelinesInterface_ApplyEnvironment_Call { + _c.Call.Return(run) + return _c +} + // Create provides a mock function with given fields: ctx, request func (_m *MockPipelinesInterface) Create(ctx context.Context, request pipelines.CreatePipeline) (*pipelines.CreatePipelineResponse, error) { ret := _m.Called(ctx, request) @@ -1165,6 +1224,65 @@ func (_c *MockPipelinesInterface_PipelineStateInfoNameToPipelineIdMap_Call) RunA return _c } +// RestorePipeline provides a mock function with given fields: ctx, request +func (_m *MockPipelinesInterface) RestorePipeline(ctx context.Context, request pipelines.RestorePipelineRequest) (*pipelines.RestorePipelineRequestResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for RestorePipeline") + } + + var r0 *pipelines.RestorePipelineRequestResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, pipelines.RestorePipelineRequest) (*pipelines.RestorePipelineRequestResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, pipelines.RestorePipelineRequest) *pipelines.RestorePipelineRequestResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*pipelines.RestorePipelineRequestResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, pipelines.RestorePipelineRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPipelinesInterface_RestorePipeline_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RestorePipeline' +type MockPipelinesInterface_RestorePipeline_Call struct { + *mock.Call +} + +// RestorePipeline is a helper method to define mock.On call +// - ctx context.Context +// - request pipelines.RestorePipelineRequest +func (_e *MockPipelinesInterface_Expecter) RestorePipeline(ctx interface{}, request interface{}) *MockPipelinesInterface_RestorePipeline_Call { + return &MockPipelinesInterface_RestorePipeline_Call{Call: _e.mock.On("RestorePipeline", ctx, request)} +} + +func (_c *MockPipelinesInterface_RestorePipeline_Call) Run(run func(ctx context.Context, request pipelines.RestorePipelineRequest)) *MockPipelinesInterface_RestorePipeline_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(pipelines.RestorePipelineRequest)) + }) + return _c +} + +func (_c *MockPipelinesInterface_RestorePipeline_Call) Return(_a0 *pipelines.RestorePipelineRequestResponse, _a1 error) *MockPipelinesInterface_RestorePipeline_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPipelinesInterface_RestorePipeline_Call) RunAndReturn(run func(context.Context, pipelines.RestorePipelineRequest) (*pipelines.RestorePipelineRequestResponse, error)) *MockPipelinesInterface_RestorePipeline_Call { + _c.Call.Return(run) + return _c +} + // SetPermissions provides a mock function with given fields: ctx, request func (_m *MockPipelinesInterface) SetPermissions(ctx context.Context, request pipelines.PipelinePermissionsRequest) (*pipelines.PipelinePermissions, error) { ret := _m.Called(ctx, request) diff --git a/experimental/mocks/service/settingsv2/mock_account_settings_v2_interface.go b/experimental/mocks/service/settingsv2/mock_account_settings_v2_interface.go new file mode 100644 index 000000000..1ad1f0238 --- /dev/null +++ b/experimental/mocks/service/settingsv2/mock_account_settings_v2_interface.go @@ -0,0 +1,265 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package settingsv2 + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" + + settingsv2 "github.com/databricks/databricks-sdk-go/service/settingsv2" +) + +// MockAccountSettingsV2Interface is an autogenerated mock type for the AccountSettingsV2Interface type +type MockAccountSettingsV2Interface struct { + mock.Mock +} + +type MockAccountSettingsV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockAccountSettingsV2Interface) EXPECT() *MockAccountSettingsV2Interface_Expecter { + return &MockAccountSettingsV2Interface_Expecter{mock: &_m.Mock} +} + +// GetPublicAccountSetting provides a mock function with given fields: ctx, request +func (_m *MockAccountSettingsV2Interface) GetPublicAccountSetting(ctx context.Context, request settingsv2.GetPublicAccountSettingRequest) (*settingsv2.Setting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetPublicAccountSetting") + } + + var r0 *settingsv2.Setting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.GetPublicAccountSettingRequest) (*settingsv2.Setting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.GetPublicAccountSettingRequest) *settingsv2.Setting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settingsv2.Setting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.GetPublicAccountSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountSettingsV2Interface_GetPublicAccountSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublicAccountSetting' +type MockAccountSettingsV2Interface_GetPublicAccountSetting_Call struct { + *mock.Call +} + +// GetPublicAccountSetting is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.GetPublicAccountSettingRequest +func (_e *MockAccountSettingsV2Interface_Expecter) GetPublicAccountSetting(ctx interface{}, request interface{}) *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call { + return &MockAccountSettingsV2Interface_GetPublicAccountSetting_Call{Call: _e.mock.On("GetPublicAccountSetting", ctx, request)} +} + +func (_c *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call) Run(run func(ctx context.Context, request settingsv2.GetPublicAccountSettingRequest)) *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.GetPublicAccountSettingRequest)) + }) + return _c +} + +func (_c *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call) Return(_a0 *settingsv2.Setting, _a1 error) *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call) RunAndReturn(run func(context.Context, settingsv2.GetPublicAccountSettingRequest) (*settingsv2.Setting, error)) *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call { + _c.Call.Return(run) + return _c +} + +// ListAccountSettingsMetadata provides a mock function with given fields: ctx, request +func (_m *MockAccountSettingsV2Interface) ListAccountSettingsMetadata(ctx context.Context, request settingsv2.ListAccountSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAccountSettingsMetadata") + } + + var r0 listing.Iterator[settingsv2.SettingsMetadata] + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[settingsv2.SettingsMetadata]) + } + } + + return r0 +} + +// MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAccountSettingsMetadata' +type MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call struct { + *mock.Call +} + +// ListAccountSettingsMetadata is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.ListAccountSettingsMetadataRequest +func (_e *MockAccountSettingsV2Interface_Expecter) ListAccountSettingsMetadata(ctx interface{}, request interface{}) *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call { + return &MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call{Call: _e.mock.On("ListAccountSettingsMetadata", ctx, request)} +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call) Run(run func(ctx context.Context, request settingsv2.ListAccountSettingsMetadataRequest)) *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.ListAccountSettingsMetadataRequest)) + }) + return _c +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call) Return(_a0 listing.Iterator[settingsv2.SettingsMetadata]) *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call) RunAndReturn(run func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata]) *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call { + _c.Call.Return(run) + return _c +} + +// ListAccountSettingsMetadataAll provides a mock function with given fields: ctx, request +func (_m *MockAccountSettingsV2Interface) ListAccountSettingsMetadataAll(ctx context.Context, request settingsv2.ListAccountSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAccountSettingsMetadataAll") + } + + var r0 []settingsv2.SettingsMetadata + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) []settingsv2.SettingsMetadata); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]settingsv2.SettingsMetadata) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAccountSettingsMetadataAll' +type MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call struct { + *mock.Call +} + +// ListAccountSettingsMetadataAll is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.ListAccountSettingsMetadataRequest +func (_e *MockAccountSettingsV2Interface_Expecter) ListAccountSettingsMetadataAll(ctx interface{}, request interface{}) *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call { + return &MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call{Call: _e.mock.On("ListAccountSettingsMetadataAll", ctx, request)} +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call) Run(run func(ctx context.Context, request settingsv2.ListAccountSettingsMetadataRequest)) *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.ListAccountSettingsMetadataRequest)) + }) + return _c +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call) Return(_a0 []settingsv2.SettingsMetadata, _a1 error) *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call) RunAndReturn(run func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error)) *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call { + _c.Call.Return(run) + return _c +} + +// PatchPublicAccountSetting provides a mock function with given fields: ctx, request +func (_m *MockAccountSettingsV2Interface) PatchPublicAccountSetting(ctx context.Context, request settingsv2.PatchPublicAccountSettingRequest) (*settingsv2.Setting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for PatchPublicAccountSetting") + } + + var r0 *settingsv2.Setting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.PatchPublicAccountSettingRequest) (*settingsv2.Setting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.PatchPublicAccountSettingRequest) *settingsv2.Setting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settingsv2.Setting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.PatchPublicAccountSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PatchPublicAccountSetting' +type MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call struct { + *mock.Call +} + +// PatchPublicAccountSetting is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.PatchPublicAccountSettingRequest +func (_e *MockAccountSettingsV2Interface_Expecter) PatchPublicAccountSetting(ctx interface{}, request interface{}) *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call { + return &MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call{Call: _e.mock.On("PatchPublicAccountSetting", ctx, request)} +} + +func (_c *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call) Run(run func(ctx context.Context, request settingsv2.PatchPublicAccountSettingRequest)) *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.PatchPublicAccountSettingRequest)) + }) + return _c +} + +func (_c *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call) Return(_a0 *settingsv2.Setting, _a1 error) *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call) RunAndReturn(run func(context.Context, settingsv2.PatchPublicAccountSettingRequest) (*settingsv2.Setting, error)) *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call { + _c.Call.Return(run) + return _c +} + +// NewMockAccountSettingsV2Interface creates a new instance of MockAccountSettingsV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockAccountSettingsV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockAccountSettingsV2Interface { + mock := &MockAccountSettingsV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settingsv2/mock_workspace_settings_v2_interface.go b/experimental/mocks/service/settingsv2/mock_workspace_settings_v2_interface.go new file mode 100644 index 000000000..f9bce80ec --- /dev/null +++ b/experimental/mocks/service/settingsv2/mock_workspace_settings_v2_interface.go @@ -0,0 +1,265 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package settingsv2 + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" + + settingsv2 "github.com/databricks/databricks-sdk-go/service/settingsv2" +) + +// MockWorkspaceSettingsV2Interface is an autogenerated mock type for the WorkspaceSettingsV2Interface type +type MockWorkspaceSettingsV2Interface struct { + mock.Mock +} + +type MockWorkspaceSettingsV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockWorkspaceSettingsV2Interface) EXPECT() *MockWorkspaceSettingsV2Interface_Expecter { + return &MockWorkspaceSettingsV2Interface_Expecter{mock: &_m.Mock} +} + +// GetPublicWorkspaceSetting provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceSettingsV2Interface) GetPublicWorkspaceSetting(ctx context.Context, request settingsv2.GetPublicWorkspaceSettingRequest) (*settingsv2.Setting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetPublicWorkspaceSetting") + } + + var r0 *settingsv2.Setting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.GetPublicWorkspaceSettingRequest) (*settingsv2.Setting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.GetPublicWorkspaceSettingRequest) *settingsv2.Setting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settingsv2.Setting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.GetPublicWorkspaceSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublicWorkspaceSetting' +type MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call struct { + *mock.Call +} + +// GetPublicWorkspaceSetting is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.GetPublicWorkspaceSettingRequest +func (_e *MockWorkspaceSettingsV2Interface_Expecter) GetPublicWorkspaceSetting(ctx interface{}, request interface{}) *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call { + return &MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call{Call: _e.mock.On("GetPublicWorkspaceSetting", ctx, request)} +} + +func (_c *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call) Run(run func(ctx context.Context, request settingsv2.GetPublicWorkspaceSettingRequest)) *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.GetPublicWorkspaceSettingRequest)) + }) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call) Return(_a0 *settingsv2.Setting, _a1 error) *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call) RunAndReturn(run func(context.Context, settingsv2.GetPublicWorkspaceSettingRequest) (*settingsv2.Setting, error)) *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call { + _c.Call.Return(run) + return _c +} + +// ListWorkspaceSettingsMetadata provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceSettingsV2Interface) ListWorkspaceSettingsMetadata(ctx context.Context, request settingsv2.ListWorkspaceSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListWorkspaceSettingsMetadata") + } + + var r0 listing.Iterator[settingsv2.SettingsMetadata] + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[settingsv2.SettingsMetadata]) + } + } + + return r0 +} + +// MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWorkspaceSettingsMetadata' +type MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call struct { + *mock.Call +} + +// ListWorkspaceSettingsMetadata is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.ListWorkspaceSettingsMetadataRequest +func (_e *MockWorkspaceSettingsV2Interface_Expecter) ListWorkspaceSettingsMetadata(ctx interface{}, request interface{}) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call { + return &MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call{Call: _e.mock.On("ListWorkspaceSettingsMetadata", ctx, request)} +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call) Run(run func(ctx context.Context, request settingsv2.ListWorkspaceSettingsMetadataRequest)) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.ListWorkspaceSettingsMetadataRequest)) + }) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call) Return(_a0 listing.Iterator[settingsv2.SettingsMetadata]) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call) RunAndReturn(run func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata]) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call { + _c.Call.Return(run) + return _c +} + +// ListWorkspaceSettingsMetadataAll provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceSettingsV2Interface) ListWorkspaceSettingsMetadataAll(ctx context.Context, request settingsv2.ListWorkspaceSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListWorkspaceSettingsMetadataAll") + } + + var r0 []settingsv2.SettingsMetadata + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) []settingsv2.SettingsMetadata); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]settingsv2.SettingsMetadata) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWorkspaceSettingsMetadataAll' +type MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call struct { + *mock.Call +} + +// ListWorkspaceSettingsMetadataAll is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.ListWorkspaceSettingsMetadataRequest +func (_e *MockWorkspaceSettingsV2Interface_Expecter) ListWorkspaceSettingsMetadataAll(ctx interface{}, request interface{}) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call { + return &MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call{Call: _e.mock.On("ListWorkspaceSettingsMetadataAll", ctx, request)} +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call) Run(run func(ctx context.Context, request settingsv2.ListWorkspaceSettingsMetadataRequest)) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.ListWorkspaceSettingsMetadataRequest)) + }) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call) Return(_a0 []settingsv2.SettingsMetadata, _a1 error) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call) RunAndReturn(run func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error)) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call { + _c.Call.Return(run) + return _c +} + +// PatchPublicWorkspaceSetting provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceSettingsV2Interface) PatchPublicWorkspaceSetting(ctx context.Context, request settingsv2.PatchPublicWorkspaceSettingRequest) (*settingsv2.Setting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for PatchPublicWorkspaceSetting") + } + + var r0 *settingsv2.Setting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.PatchPublicWorkspaceSettingRequest) (*settingsv2.Setting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.PatchPublicWorkspaceSettingRequest) *settingsv2.Setting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settingsv2.Setting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.PatchPublicWorkspaceSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PatchPublicWorkspaceSetting' +type MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call struct { + *mock.Call +} + +// PatchPublicWorkspaceSetting is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.PatchPublicWorkspaceSettingRequest +func (_e *MockWorkspaceSettingsV2Interface_Expecter) PatchPublicWorkspaceSetting(ctx interface{}, request interface{}) *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call { + return &MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call{Call: _e.mock.On("PatchPublicWorkspaceSetting", ctx, request)} +} + +func (_c *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call) Run(run func(ctx context.Context, request settingsv2.PatchPublicWorkspaceSettingRequest)) *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.PatchPublicWorkspaceSettingRequest)) + }) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call) Return(_a0 *settingsv2.Setting, _a1 error) *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call) RunAndReturn(run func(context.Context, settingsv2.PatchPublicWorkspaceSettingRequest) (*settingsv2.Setting, error)) *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call { + _c.Call.Return(run) + return _c +} + +// NewMockWorkspaceSettingsV2Interface creates a new instance of MockWorkspaceSettingsV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockWorkspaceSettingsV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockWorkspaceSettingsV2Interface { + mock := &MockWorkspaceSettingsV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/tags/mock_tag_assignments_interface.go b/experimental/mocks/service/tags/mock_tag_assignments_interface.go new file mode 100644 index 000000000..089d8e50c --- /dev/null +++ b/experimental/mocks/service/tags/mock_tag_assignments_interface.go @@ -0,0 +1,371 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package tags + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" + + tags "github.com/databricks/databricks-sdk-go/service/tags" +) + +// MockTagAssignmentsInterface is an autogenerated mock type for the TagAssignmentsInterface type +type MockTagAssignmentsInterface struct { + mock.Mock +} + +type MockTagAssignmentsInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockTagAssignmentsInterface) EXPECT() *MockTagAssignmentsInterface_Expecter { + return &MockTagAssignmentsInterface_Expecter{mock: &_m.Mock} +} + +// CreateTagAssignment provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) CreateTagAssignment(ctx context.Context, request tags.CreateTagAssignmentRequest) (*tags.TagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateTagAssignment") + } + + var r0 *tags.TagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.CreateTagAssignmentRequest) (*tags.TagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.CreateTagAssignmentRequest) *tags.TagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.CreateTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagAssignmentsInterface_CreateTagAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateTagAssignment' +type MockTagAssignmentsInterface_CreateTagAssignment_Call struct { + *mock.Call +} + +// CreateTagAssignment is a helper method to define mock.On call +// - ctx context.Context +// - request tags.CreateTagAssignmentRequest +func (_e *MockTagAssignmentsInterface_Expecter) CreateTagAssignment(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_CreateTagAssignment_Call { + return &MockTagAssignmentsInterface_CreateTagAssignment_Call{Call: _e.mock.On("CreateTagAssignment", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_CreateTagAssignment_Call) Run(run func(ctx context.Context, request tags.CreateTagAssignmentRequest)) *MockTagAssignmentsInterface_CreateTagAssignment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.CreateTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_CreateTagAssignment_Call) Return(_a0 *tags.TagAssignment, _a1 error) *MockTagAssignmentsInterface_CreateTagAssignment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagAssignmentsInterface_CreateTagAssignment_Call) RunAndReturn(run func(context.Context, tags.CreateTagAssignmentRequest) (*tags.TagAssignment, error)) *MockTagAssignmentsInterface_CreateTagAssignment_Call { + _c.Call.Return(run) + return _c +} + +// DeleteTagAssignment provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) DeleteTagAssignment(ctx context.Context, request tags.DeleteTagAssignmentRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteTagAssignment") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, tags.DeleteTagAssignmentRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockTagAssignmentsInterface_DeleteTagAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteTagAssignment' +type MockTagAssignmentsInterface_DeleteTagAssignment_Call struct { + *mock.Call +} + +// DeleteTagAssignment is a helper method to define mock.On call +// - ctx context.Context +// - request tags.DeleteTagAssignmentRequest +func (_e *MockTagAssignmentsInterface_Expecter) DeleteTagAssignment(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_DeleteTagAssignment_Call { + return &MockTagAssignmentsInterface_DeleteTagAssignment_Call{Call: _e.mock.On("DeleteTagAssignment", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_DeleteTagAssignment_Call) Run(run func(ctx context.Context, request tags.DeleteTagAssignmentRequest)) *MockTagAssignmentsInterface_DeleteTagAssignment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.DeleteTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_DeleteTagAssignment_Call) Return(_a0 error) *MockTagAssignmentsInterface_DeleteTagAssignment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockTagAssignmentsInterface_DeleteTagAssignment_Call) RunAndReturn(run func(context.Context, tags.DeleteTagAssignmentRequest) error) *MockTagAssignmentsInterface_DeleteTagAssignment_Call { + _c.Call.Return(run) + return _c +} + +// GetTagAssignment provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) GetTagAssignment(ctx context.Context, request tags.GetTagAssignmentRequest) (*tags.TagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetTagAssignment") + } + + var r0 *tags.TagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.GetTagAssignmentRequest) (*tags.TagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.GetTagAssignmentRequest) *tags.TagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.GetTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagAssignmentsInterface_GetTagAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTagAssignment' +type MockTagAssignmentsInterface_GetTagAssignment_Call struct { + *mock.Call +} + +// GetTagAssignment is a helper method to define mock.On call +// - ctx context.Context +// - request tags.GetTagAssignmentRequest +func (_e *MockTagAssignmentsInterface_Expecter) GetTagAssignment(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_GetTagAssignment_Call { + return &MockTagAssignmentsInterface_GetTagAssignment_Call{Call: _e.mock.On("GetTagAssignment", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_GetTagAssignment_Call) Run(run func(ctx context.Context, request tags.GetTagAssignmentRequest)) *MockTagAssignmentsInterface_GetTagAssignment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.GetTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_GetTagAssignment_Call) Return(_a0 *tags.TagAssignment, _a1 error) *MockTagAssignmentsInterface_GetTagAssignment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagAssignmentsInterface_GetTagAssignment_Call) RunAndReturn(run func(context.Context, tags.GetTagAssignmentRequest) (*tags.TagAssignment, error)) *MockTagAssignmentsInterface_GetTagAssignment_Call { + _c.Call.Return(run) + return _c +} + +// ListTagAssignments provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) ListTagAssignments(ctx context.Context, request tags.ListTagAssignmentsRequest) listing.Iterator[tags.TagAssignment] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListTagAssignments") + } + + var r0 listing.Iterator[tags.TagAssignment] + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagAssignmentsRequest) listing.Iterator[tags.TagAssignment]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[tags.TagAssignment]) + } + } + + return r0 +} + +// MockTagAssignmentsInterface_ListTagAssignments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTagAssignments' +type MockTagAssignmentsInterface_ListTagAssignments_Call struct { + *mock.Call +} + +// ListTagAssignments is a helper method to define mock.On call +// - ctx context.Context +// - request tags.ListTagAssignmentsRequest +func (_e *MockTagAssignmentsInterface_Expecter) ListTagAssignments(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_ListTagAssignments_Call { + return &MockTagAssignmentsInterface_ListTagAssignments_Call{Call: _e.mock.On("ListTagAssignments", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignments_Call) Run(run func(ctx context.Context, request tags.ListTagAssignmentsRequest)) *MockTagAssignmentsInterface_ListTagAssignments_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.ListTagAssignmentsRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignments_Call) Return(_a0 listing.Iterator[tags.TagAssignment]) *MockTagAssignmentsInterface_ListTagAssignments_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignments_Call) RunAndReturn(run func(context.Context, tags.ListTagAssignmentsRequest) listing.Iterator[tags.TagAssignment]) *MockTagAssignmentsInterface_ListTagAssignments_Call { + _c.Call.Return(run) + return _c +} + +// ListTagAssignmentsAll provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) ListTagAssignmentsAll(ctx context.Context, request tags.ListTagAssignmentsRequest) ([]tags.TagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListTagAssignmentsAll") + } + + var r0 []tags.TagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagAssignmentsRequest) ([]tags.TagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagAssignmentsRequest) []tags.TagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]tags.TagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.ListTagAssignmentsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagAssignmentsInterface_ListTagAssignmentsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTagAssignmentsAll' +type MockTagAssignmentsInterface_ListTagAssignmentsAll_Call struct { + *mock.Call +} + +// ListTagAssignmentsAll is a helper method to define mock.On call +// - ctx context.Context +// - request tags.ListTagAssignmentsRequest +func (_e *MockTagAssignmentsInterface_Expecter) ListTagAssignmentsAll(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call { + return &MockTagAssignmentsInterface_ListTagAssignmentsAll_Call{Call: _e.mock.On("ListTagAssignmentsAll", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call) Run(run func(ctx context.Context, request tags.ListTagAssignmentsRequest)) *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.ListTagAssignmentsRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call) Return(_a0 []tags.TagAssignment, _a1 error) *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call) RunAndReturn(run func(context.Context, tags.ListTagAssignmentsRequest) ([]tags.TagAssignment, error)) *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call { + _c.Call.Return(run) + return _c +} + +// UpdateTagAssignment provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) UpdateTagAssignment(ctx context.Context, request tags.UpdateTagAssignmentRequest) (*tags.TagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateTagAssignment") + } + + var r0 *tags.TagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.UpdateTagAssignmentRequest) (*tags.TagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.UpdateTagAssignmentRequest) *tags.TagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.UpdateTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagAssignmentsInterface_UpdateTagAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateTagAssignment' +type MockTagAssignmentsInterface_UpdateTagAssignment_Call struct { + *mock.Call +} + +// UpdateTagAssignment is a helper method to define mock.On call +// - ctx context.Context +// - request tags.UpdateTagAssignmentRequest +func (_e *MockTagAssignmentsInterface_Expecter) UpdateTagAssignment(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_UpdateTagAssignment_Call { + return &MockTagAssignmentsInterface_UpdateTagAssignment_Call{Call: _e.mock.On("UpdateTagAssignment", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_UpdateTagAssignment_Call) Run(run func(ctx context.Context, request tags.UpdateTagAssignmentRequest)) *MockTagAssignmentsInterface_UpdateTagAssignment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.UpdateTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_UpdateTagAssignment_Call) Return(_a0 *tags.TagAssignment, _a1 error) *MockTagAssignmentsInterface_UpdateTagAssignment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagAssignmentsInterface_UpdateTagAssignment_Call) RunAndReturn(run func(context.Context, tags.UpdateTagAssignmentRequest) (*tags.TagAssignment, error)) *MockTagAssignmentsInterface_UpdateTagAssignment_Call { + _c.Call.Return(run) + return _c +} + +// NewMockTagAssignmentsInterface creates a new instance of MockTagAssignmentsInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockTagAssignmentsInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockTagAssignmentsInterface { + mock := &MockTagAssignmentsInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/tags/mock_tag_policies_interface.go b/experimental/mocks/service/tags/mock_tag_policies_interface.go new file mode 100644 index 000000000..22f1731fc --- /dev/null +++ b/experimental/mocks/service/tags/mock_tag_policies_interface.go @@ -0,0 +1,371 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package tags + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" + + tags "github.com/databricks/databricks-sdk-go/service/tags" +) + +// MockTagPoliciesInterface is an autogenerated mock type for the TagPoliciesInterface type +type MockTagPoliciesInterface struct { + mock.Mock +} + +type MockTagPoliciesInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockTagPoliciesInterface) EXPECT() *MockTagPoliciesInterface_Expecter { + return &MockTagPoliciesInterface_Expecter{mock: &_m.Mock} +} + +// CreateTagPolicy provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) CreateTagPolicy(ctx context.Context, request tags.CreateTagPolicyRequest) (*tags.TagPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateTagPolicy") + } + + var r0 *tags.TagPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.CreateTagPolicyRequest) (*tags.TagPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.CreateTagPolicyRequest) *tags.TagPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.CreateTagPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagPoliciesInterface_CreateTagPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateTagPolicy' +type MockTagPoliciesInterface_CreateTagPolicy_Call struct { + *mock.Call +} + +// CreateTagPolicy is a helper method to define mock.On call +// - ctx context.Context +// - request tags.CreateTagPolicyRequest +func (_e *MockTagPoliciesInterface_Expecter) CreateTagPolicy(ctx interface{}, request interface{}) *MockTagPoliciesInterface_CreateTagPolicy_Call { + return &MockTagPoliciesInterface_CreateTagPolicy_Call{Call: _e.mock.On("CreateTagPolicy", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_CreateTagPolicy_Call) Run(run func(ctx context.Context, request tags.CreateTagPolicyRequest)) *MockTagPoliciesInterface_CreateTagPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.CreateTagPolicyRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_CreateTagPolicy_Call) Return(_a0 *tags.TagPolicy, _a1 error) *MockTagPoliciesInterface_CreateTagPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagPoliciesInterface_CreateTagPolicy_Call) RunAndReturn(run func(context.Context, tags.CreateTagPolicyRequest) (*tags.TagPolicy, error)) *MockTagPoliciesInterface_CreateTagPolicy_Call { + _c.Call.Return(run) + return _c +} + +// DeleteTagPolicy provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) DeleteTagPolicy(ctx context.Context, request tags.DeleteTagPolicyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteTagPolicy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, tags.DeleteTagPolicyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockTagPoliciesInterface_DeleteTagPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteTagPolicy' +type MockTagPoliciesInterface_DeleteTagPolicy_Call struct { + *mock.Call +} + +// DeleteTagPolicy is a helper method to define mock.On call +// - ctx context.Context +// - request tags.DeleteTagPolicyRequest +func (_e *MockTagPoliciesInterface_Expecter) DeleteTagPolicy(ctx interface{}, request interface{}) *MockTagPoliciesInterface_DeleteTagPolicy_Call { + return &MockTagPoliciesInterface_DeleteTagPolicy_Call{Call: _e.mock.On("DeleteTagPolicy", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_DeleteTagPolicy_Call) Run(run func(ctx context.Context, request tags.DeleteTagPolicyRequest)) *MockTagPoliciesInterface_DeleteTagPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.DeleteTagPolicyRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_DeleteTagPolicy_Call) Return(_a0 error) *MockTagPoliciesInterface_DeleteTagPolicy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockTagPoliciesInterface_DeleteTagPolicy_Call) RunAndReturn(run func(context.Context, tags.DeleteTagPolicyRequest) error) *MockTagPoliciesInterface_DeleteTagPolicy_Call { + _c.Call.Return(run) + return _c +} + +// GetTagPolicy provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) GetTagPolicy(ctx context.Context, request tags.GetTagPolicyRequest) (*tags.TagPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetTagPolicy") + } + + var r0 *tags.TagPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.GetTagPolicyRequest) (*tags.TagPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.GetTagPolicyRequest) *tags.TagPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.GetTagPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagPoliciesInterface_GetTagPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTagPolicy' +type MockTagPoliciesInterface_GetTagPolicy_Call struct { + *mock.Call +} + +// GetTagPolicy is a helper method to define mock.On call +// - ctx context.Context +// - request tags.GetTagPolicyRequest +func (_e *MockTagPoliciesInterface_Expecter) GetTagPolicy(ctx interface{}, request interface{}) *MockTagPoliciesInterface_GetTagPolicy_Call { + return &MockTagPoliciesInterface_GetTagPolicy_Call{Call: _e.mock.On("GetTagPolicy", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_GetTagPolicy_Call) Run(run func(ctx context.Context, request tags.GetTagPolicyRequest)) *MockTagPoliciesInterface_GetTagPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.GetTagPolicyRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_GetTagPolicy_Call) Return(_a0 *tags.TagPolicy, _a1 error) *MockTagPoliciesInterface_GetTagPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagPoliciesInterface_GetTagPolicy_Call) RunAndReturn(run func(context.Context, tags.GetTagPolicyRequest) (*tags.TagPolicy, error)) *MockTagPoliciesInterface_GetTagPolicy_Call { + _c.Call.Return(run) + return _c +} + +// ListTagPolicies provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) ListTagPolicies(ctx context.Context, request tags.ListTagPoliciesRequest) listing.Iterator[tags.TagPolicy] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListTagPolicies") + } + + var r0 listing.Iterator[tags.TagPolicy] + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagPoliciesRequest) listing.Iterator[tags.TagPolicy]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[tags.TagPolicy]) + } + } + + return r0 +} + +// MockTagPoliciesInterface_ListTagPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTagPolicies' +type MockTagPoliciesInterface_ListTagPolicies_Call struct { + *mock.Call +} + +// ListTagPolicies is a helper method to define mock.On call +// - ctx context.Context +// - request tags.ListTagPoliciesRequest +func (_e *MockTagPoliciesInterface_Expecter) ListTagPolicies(ctx interface{}, request interface{}) *MockTagPoliciesInterface_ListTagPolicies_Call { + return &MockTagPoliciesInterface_ListTagPolicies_Call{Call: _e.mock.On("ListTagPolicies", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_ListTagPolicies_Call) Run(run func(ctx context.Context, request tags.ListTagPoliciesRequest)) *MockTagPoliciesInterface_ListTagPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.ListTagPoliciesRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_ListTagPolicies_Call) Return(_a0 listing.Iterator[tags.TagPolicy]) *MockTagPoliciesInterface_ListTagPolicies_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockTagPoliciesInterface_ListTagPolicies_Call) RunAndReturn(run func(context.Context, tags.ListTagPoliciesRequest) listing.Iterator[tags.TagPolicy]) *MockTagPoliciesInterface_ListTagPolicies_Call { + _c.Call.Return(run) + return _c +} + +// ListTagPoliciesAll provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) ListTagPoliciesAll(ctx context.Context, request tags.ListTagPoliciesRequest) ([]tags.TagPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListTagPoliciesAll") + } + + var r0 []tags.TagPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagPoliciesRequest) ([]tags.TagPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagPoliciesRequest) []tags.TagPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]tags.TagPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.ListTagPoliciesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagPoliciesInterface_ListTagPoliciesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTagPoliciesAll' +type MockTagPoliciesInterface_ListTagPoliciesAll_Call struct { + *mock.Call +} + +// ListTagPoliciesAll is a helper method to define mock.On call +// - ctx context.Context +// - request tags.ListTagPoliciesRequest +func (_e *MockTagPoliciesInterface_Expecter) ListTagPoliciesAll(ctx interface{}, request interface{}) *MockTagPoliciesInterface_ListTagPoliciesAll_Call { + return &MockTagPoliciesInterface_ListTagPoliciesAll_Call{Call: _e.mock.On("ListTagPoliciesAll", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_ListTagPoliciesAll_Call) Run(run func(ctx context.Context, request tags.ListTagPoliciesRequest)) *MockTagPoliciesInterface_ListTagPoliciesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.ListTagPoliciesRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_ListTagPoliciesAll_Call) Return(_a0 []tags.TagPolicy, _a1 error) *MockTagPoliciesInterface_ListTagPoliciesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagPoliciesInterface_ListTagPoliciesAll_Call) RunAndReturn(run func(context.Context, tags.ListTagPoliciesRequest) ([]tags.TagPolicy, error)) *MockTagPoliciesInterface_ListTagPoliciesAll_Call { + _c.Call.Return(run) + return _c +} + +// UpdateTagPolicy provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) UpdateTagPolicy(ctx context.Context, request tags.UpdateTagPolicyRequest) (*tags.TagPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateTagPolicy") + } + + var r0 *tags.TagPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.UpdateTagPolicyRequest) (*tags.TagPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.UpdateTagPolicyRequest) *tags.TagPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.UpdateTagPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagPoliciesInterface_UpdateTagPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateTagPolicy' +type MockTagPoliciesInterface_UpdateTagPolicy_Call struct { + *mock.Call +} + +// UpdateTagPolicy is a helper method to define mock.On call +// - ctx context.Context +// - request tags.UpdateTagPolicyRequest +func (_e *MockTagPoliciesInterface_Expecter) UpdateTagPolicy(ctx interface{}, request interface{}) *MockTagPoliciesInterface_UpdateTagPolicy_Call { + return &MockTagPoliciesInterface_UpdateTagPolicy_Call{Call: _e.mock.On("UpdateTagPolicy", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_UpdateTagPolicy_Call) Run(run func(ctx context.Context, request tags.UpdateTagPolicyRequest)) *MockTagPoliciesInterface_UpdateTagPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.UpdateTagPolicyRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_UpdateTagPolicy_Call) Return(_a0 *tags.TagPolicy, _a1 error) *MockTagPoliciesInterface_UpdateTagPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagPoliciesInterface_UpdateTagPolicy_Call) RunAndReturn(run func(context.Context, tags.UpdateTagPolicyRequest) (*tags.TagPolicy, error)) *MockTagPoliciesInterface_UpdateTagPolicy_Call { + _c.Call.Return(run) + return _c +} + +// NewMockTagPoliciesInterface creates a new instance of MockTagPoliciesInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockTagPoliciesInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockTagPoliciesInterface { + mock := &MockTagPoliciesInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go b/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go index b396a28a5..06dde493b 100644 --- a/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go +++ b/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go @@ -745,6 +745,65 @@ func (_c *MockVectorSearchIndexesInterface_SyncIndex_Call) RunAndReturn(run func return _c } +// UpdateIndexBudgetPolicy provides a mock function with given fields: ctx, request +func (_m *MockVectorSearchIndexesInterface) UpdateIndexBudgetPolicy(ctx context.Context, request vectorsearch.UpdateVectorIndexUsagePolicyRequest) (*vectorsearch.UpdateVectorIndexUsagePolicyResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateIndexBudgetPolicy") + } + + var r0 *vectorsearch.UpdateVectorIndexUsagePolicyResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, vectorsearch.UpdateVectorIndexUsagePolicyRequest) (*vectorsearch.UpdateVectorIndexUsagePolicyResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, vectorsearch.UpdateVectorIndexUsagePolicyRequest) *vectorsearch.UpdateVectorIndexUsagePolicyResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vectorsearch.UpdateVectorIndexUsagePolicyResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, vectorsearch.UpdateVectorIndexUsagePolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateIndexBudgetPolicy' +type MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call struct { + *mock.Call +} + +// UpdateIndexBudgetPolicy is a helper method to define mock.On call +// - ctx context.Context +// - request vectorsearch.UpdateVectorIndexUsagePolicyRequest +func (_e *MockVectorSearchIndexesInterface_Expecter) UpdateIndexBudgetPolicy(ctx interface{}, request interface{}) *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call { + return &MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call{Call: _e.mock.On("UpdateIndexBudgetPolicy", ctx, request)} +} + +func (_c *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call) Run(run func(ctx context.Context, request vectorsearch.UpdateVectorIndexUsagePolicyRequest)) *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(vectorsearch.UpdateVectorIndexUsagePolicyRequest)) + }) + return _c +} + +func (_c *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call) Return(_a0 *vectorsearch.UpdateVectorIndexUsagePolicyResponse, _a1 error) *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call) RunAndReturn(run func(context.Context, vectorsearch.UpdateVectorIndexUsagePolicyRequest) (*vectorsearch.UpdateVectorIndexUsagePolicyResponse, error)) *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call { + _c.Call.Return(run) + return _c +} + // UpsertDataVectorIndex provides a mock function with given fields: ctx, request func (_m *MockVectorSearchIndexesInterface) UpsertDataVectorIndex(ctx context.Context, request vectorsearch.UpsertDataVectorIndexRequest) (*vectorsearch.UpsertDataVectorIndexResponse, error) { ret := _m.Called(ctx, request) diff --git a/internal/generatedtests/http_call_test.go b/internal/generatedtests/http_call_test.go index 09938783f..647705933 100755 --- a/internal/generatedtests/http_call_test.go +++ b/internal/generatedtests/http_call_test.go @@ -3,9 +3,11 @@ package generated_tests import ( "context" + "encoding/json" "testing" "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/common/types/fieldmask" "github.com/databricks/databricks-sdk-go/internal/testspecs/service/httpcallv2" "github.com/databricks/databricks-sdk-go/qa" ) @@ -54,6 +56,7 @@ func TestHttpCall_LegacyHttpPostWithBody(t *testing.T) { func TestHttpCall_UpdateResourceNoQueryParamsNoBody(t *testing.T) { input := httpcallv2.UpdateResourceRequest{ Resource: httpcallv2.Resource{ + AnyField: json.RawMessage("{\"key\": \"value\"}"), NestedPathParamBool: true, NestedPathParamInt: 789, NestedPathParamString: "update_string", @@ -67,6 +70,7 @@ func TestHttpCall_UpdateResourceNoQueryParamsNoBody(t *testing.T) { Method: "PATCH", Resource: "/api/2.0/http-call/update_string/789/true", ExpectedRequest: httpcallv2.Resource{ + AnyField: json.RawMessage("{\"key\": \"value\"}"), NestedPathParamBool: true, NestedPathParamInt: 789, NestedPathParamString: "update_string", @@ -120,7 +124,7 @@ func TestHttpCall_UpdateResourceWithSimpleQueryParams(t *testing.T) { QueryParamString: "query_string_val", QueryParamInt: 999, QueryParamBool: true, - FieldMask: "field.mask.value", + FieldMask: &fieldmask.FieldMask{Paths: []string{"field.mask.value"}}, } qa.HTTPFixtures{ { @@ -178,7 +182,11 @@ func TestHttpCall_UpdateResourceWithRepeatedQueryParam(t *testing.T) { NestedPathParamString: "update_string", NestedPathParamInt: 789, NestedPathParamBool: true, - RepeatedQueryParam: []string{"item1", "item2", "item3"}, + RepeatedQueryParam: []string{ + "item1", + "item2", + "item3", + }, } qa.HTTPFixtures{ { @@ -207,7 +215,11 @@ func TestHttpCall_UpdateResourceWithRepeatedNestedQueryParam(t *testing.T) { NestedPathParamInt: 789, NestedPathParamBool: true, OptionalComplexQueryParam: &httpcallv2.ComplexQueryParam{ - NestedRepeatedQueryParam: []string{"item1", "item2", "item3"}, + NestedRepeatedQueryParam: []string{ + "item1", + "item2", + "item3", + }, }, } qa.HTTPFixtures{ @@ -236,11 +248,22 @@ func TestHttpCall_UpdateResourceWithDoubleRepeatedNestedQueryParam(t *testing.T) NestedPathParamString: "update_string", NestedPathParamInt: 789, NestedPathParamBool: true, - RepeatedComplexQueryParam: []httpcallv2.ComplexQueryParam{httpcallv2.ComplexQueryParam{ - NestedRepeatedQueryParam: []string{"item1", "item2", "item3"}, - }, httpcallv2.ComplexQueryParam{ - NestedRepeatedQueryParam: []string{"item4", "item5", "item6"}, - }}, + RepeatedComplexQueryParam: []httpcallv2.ComplexQueryParam{ + httpcallv2.ComplexQueryParam{ + NestedRepeatedQueryParam: []string{ + "item1", + "item2", + "item3", + }, + }, + httpcallv2.ComplexQueryParam{ + NestedRepeatedQueryParam: []string{ + "item4", + "item5", + "item6", + }, + }, + }, } qa.HTTPFixtures{ { @@ -283,7 +306,7 @@ func TestHttpCall_GetResourceWithSimpleQueryParams(t *testing.T) { QueryParamString: "query_string_val", QueryParamInt: 999, QueryParamBool: true, - FieldMask: "field.mask.value", + FieldMask: &fieldmask.FieldMask{Paths: []string{"field.mask.value"}}, } qa.HTTPFixtures{ { @@ -318,10 +341,14 @@ func TestHttpCall_GetResourceWithOneNestedQueryParam(t *testing.T) { func TestHttpCall_GetResourceWithRepeatedQueryParam(t *testing.T) { input := httpcallv2.GetResourceRequest{ - PathParamString: "get_string", - PathParamInt: 101, - PathParamBool: false, - RepeatedQueryParam: []string{"item1", "item2", "item3"}, + PathParamString: "get_string", + PathParamInt: 101, + PathParamBool: false, + RepeatedQueryParam: []string{ + "item1", + "item2", + "item3", + }, } qa.HTTPFixtures{ { @@ -340,7 +367,11 @@ func TestHttpCall_GetResourceWithRepeatedNestedQueryParam(t *testing.T) { PathParamInt: 202, PathParamBool: true, OptionalComplexQueryParam: &httpcallv2.ComplexQueryParam{ - NestedRepeatedQueryParam: []string{"item1", "item2", "item3"}, + NestedRepeatedQueryParam: []string{ + "item1", + "item2", + "item3", + }, }, } qa.HTTPFixtures{ @@ -359,11 +390,22 @@ func TestHttpCall_GetResourceWithDoubleRepeatedNestedQueryParam(t *testing.T) { PathParamString: "get_string", PathParamInt: 303, PathParamBool: false, - RepeatedComplexQueryParam: []httpcallv2.ComplexQueryParam{httpcallv2.ComplexQueryParam{ - NestedRepeatedQueryParam: []string{"item1", "item2", "item3"}, - }, httpcallv2.ComplexQueryParam{ - NestedRepeatedQueryParam: []string{"item4", "item5", "item6"}, - }}, + RepeatedComplexQueryParam: []httpcallv2.ComplexQueryParam{ + httpcallv2.ComplexQueryParam{ + NestedRepeatedQueryParam: []string{ + "item1", + "item2", + "item3", + }, + }, + httpcallv2.ComplexQueryParam{ + NestedRepeatedQueryParam: []string{ + "item4", + "item5", + "item6", + }, + }, + }, } qa.HTTPFixtures{ { diff --git a/internal/generatedtests/json_marshall_test.go b/internal/generatedtests/json_marshall_test.go index bc3f855f3..3bb536891 100755 --- a/internal/generatedtests/json_marshall_test.go +++ b/internal/generatedtests/json_marshall_test.go @@ -4,11 +4,25 @@ package generated_tests import ( "encoding/json" "testing" + goTime "time" + "github.com/databricks/databricks-sdk-go/common/types/duration" + "github.com/databricks/databricks-sdk-go/common/types/fieldmask" + "github.com/databricks/databricks-sdk-go/common/types/time" "github.com/databricks/databricks-sdk-go/internal/testspecs/service/jsonmarshallv2" "github.com/google/go-cmp/cmp" ) +// Helper functions to simplify test generation. +// This allows us to define the test cases inline. +func timeFromString(s string) goTime.Time { + t, err := goTime.Parse(goTime.RFC3339, s) + if err != nil { + panic(err) + } + return t +} + func TestJsonMarshall(t *testing.T) { testCases := []struct { name string @@ -76,7 +90,10 @@ func TestJsonMarshall(t *testing.T) { { name: "OptionalMap", value: jsonmarshallv2.OptionalFields{ - Map: map[string]string{"key": "test_key", "value": "test_value"}, + Map: map[string]string{ + "key": "test_key", + "value": "test_value", + }, }, want: `{ "map": { @@ -88,7 +105,7 @@ func TestJsonMarshall(t *testing.T) { { name: "OptionalDuration", value: jsonmarshallv2.OptionalFields{ - Duration: "3600s", + Duration: duration.New(3600 * goTime.Second), }, want: `{ "duration": "3600s" @@ -97,7 +114,7 @@ func TestJsonMarshall(t *testing.T) { { name: "OptionalFieldMask", value: jsonmarshallv2.OptionalFields{ - FieldMask: "optional_string,optional_int32", + FieldMask: &fieldmask.FieldMask{Paths: []string{"optional_string", "optional_int32"}}, }, want: `{ "field_mask": "optional_string,optional_int32" @@ -106,7 +123,7 @@ func TestJsonMarshall(t *testing.T) { { name: "OptionalTimestamp", value: jsonmarshallv2.OptionalFields{ - Timestamp: "2023-01-01T00:00:00Z", + Timestamp: time.New(timeFromString("2023-01-01T00:00:00Z")), }, want: `{ "timestamp": "2023-01-01T00:00:00Z" @@ -133,11 +150,14 @@ func TestJsonMarshall(t *testing.T) { "required_int32": 0, "required_int64": 0, "required_bool": false, + "required_value": null, + "required_list_value": null, + "required_struct": null, "required_message": {}, "test_required_enum": "", - "required_duration": "", + "required_duration": "0s", "required_field_mask": "", - "required_timestamp": "" + "required_timestamp": "1970-01-01T00:00:00Z" }`, }, { @@ -154,23 +174,26 @@ func TestJsonMarshall(t *testing.T) { "required_int32": 0, "required_int64": 0, "required_bool": false, + "required_value": null, + "required_list_value": null, + "required_struct": null, "required_message": {}, "test_required_enum": "TEST_ENUM_ONE", - "required_duration": "", + "required_duration": "0s", "required_field_mask": "", - "required_timestamp": "" + "required_timestamp": "1970-01-01T00:00:00Z" }`, }, { name: "RequiredFieldsNonDefaults", value: jsonmarshallv2.RequiredFields{ RequiredBool: true, - RequiredDuration: "7200s", - RequiredFieldMask: "required_string,required_int32", + RequiredDuration: *duration.New(7200 * goTime.Second), + RequiredFieldMask: fieldmask.FieldMask{Paths: []string{"required_string", "required_int32"}}, RequiredInt32: 42, RequiredInt64: 1234567890123456789, RequiredString: "non_default_string", - RequiredTimestamp: "2023-12-31T23:59:59Z", + RequiredTimestamp: *time.New(timeFromString("2023-12-31T23:59:59Z")), TestRequiredEnum: jsonmarshallv2.TestEnumTestEnumTwo, }, want: `{ @@ -178,6 +201,9 @@ func TestJsonMarshall(t *testing.T) { "required_int32": 42, "required_int64": 1234567890123456789, "required_bool": true, + "required_value": null, + "required_list_value": null, + "required_struct": null, "required_message": {}, "test_required_enum": "TEST_ENUM_TWO", "required_duration": "7200s", @@ -197,19 +223,26 @@ func TestJsonMarshall(t *testing.T) { "required_int32": 0, "required_int64": 0, "required_bool": false, + "required_value": null, + "required_list_value": null, + "required_struct": null, "required_message": { "optional_string": "nested_value" }, "test_required_enum": "", - "required_duration": "", + "required_duration": "0s", "required_field_mask": "", - "required_timestamp": "" + "required_timestamp": "1970-01-01T00:00:00Z" }`, }, { name: "RepeatedString", value: jsonmarshallv2.RepeatedFields{ - RepeatedString: []string{"item1", "item2", "item3"}, + RepeatedString: []string{ + "item1", + "item2", + "item3", + }, }, want: `{ "repeated_string": ["item1", "item2", "item3"] @@ -218,7 +251,13 @@ func TestJsonMarshall(t *testing.T) { { name: "RepeatedInt32", value: jsonmarshallv2.RepeatedFields{ - RepeatedInt32: []int{1, 2, 3, 4, 5}, + RepeatedInt32: []int{ + 1, + 2, + 3, + 4, + 5, + }, }, want: `{ "repeated_int32": [1, 2, 3, 4, 5] @@ -227,7 +266,10 @@ func TestJsonMarshall(t *testing.T) { { name: "RepeatedInt64", value: jsonmarshallv2.RepeatedFields{ - RepeatedInt64: []int64{1000000000000000000, 2000000000000000000}, + RepeatedInt64: []int64{ + 1000000000000000000, + 2000000000000000000, + }, }, want: `{ "repeated_int64": [1000000000000000000, 2000000000000000000] @@ -236,7 +278,11 @@ func TestJsonMarshall(t *testing.T) { { name: "RepeatedBool", value: jsonmarshallv2.RepeatedFields{ - RepeatedBool: []bool{true, false, true}, + RepeatedBool: []bool{ + true, + false, + true, + }, }, want: `{ "repeated_bool": [true, false, true] @@ -245,7 +291,10 @@ func TestJsonMarshall(t *testing.T) { { name: "RepeatedEnum", value: jsonmarshallv2.RepeatedFields{ - TestRepeatedEnum: []jsonmarshallv2.TestEnum{jsonmarshallv2.TestEnumTestEnumOne, jsonmarshallv2.TestEnumTestEnumTwo}, + TestRepeatedEnum: []jsonmarshallv2.TestEnum{ + jsonmarshallv2.TestEnumTestEnumOne, + jsonmarshallv2.TestEnumTestEnumTwo, + }, }, want: `{ "test_repeated_enum": ["TEST_ENUM_ONE", "TEST_ENUM_TWO"] @@ -254,11 +303,14 @@ func TestJsonMarshall(t *testing.T) { { name: "RepeatedNestedMessage", value: jsonmarshallv2.RepeatedFields{ - RepeatedMessage: []jsonmarshallv2.NestedMessage{jsonmarshallv2.NestedMessage{ - OptionalString: "nested1", - }, jsonmarshallv2.NestedMessage{ - OptionalString: "nested2", - }}, + RepeatedMessage: []jsonmarshallv2.NestedMessage{ + jsonmarshallv2.NestedMessage{ + OptionalString: "nested1", + }, + jsonmarshallv2.NestedMessage{ + OptionalString: "nested2", + }, + }, }, want: `{ "repeated_message": [ @@ -274,7 +326,11 @@ func TestJsonMarshall(t *testing.T) { { name: "RepeatedDuration", value: jsonmarshallv2.RepeatedFields{ - RepeatedDuration: []string{"60s", "120s", "180s"}, + RepeatedDuration: []duration.Duration{ + *duration.New(60 * goTime.Second), + *duration.New(120 * goTime.Second), + *duration.New(180 * goTime.Second), + }, }, want: `{ "repeated_duration": ["60s", "120s", "180s"] @@ -283,7 +339,10 @@ func TestJsonMarshall(t *testing.T) { { name: "RepeatedFieldMask", value: jsonmarshallv2.RepeatedFields{ - RepeatedFieldMask: []string{"field1", "field2,field3"}, + RepeatedFieldMask: []fieldmask.FieldMask{ + fieldmask.FieldMask{Paths: []string{"field1"}}, + fieldmask.FieldMask{Paths: []string{"field2", "field3"}}, + }, }, want: `{ "repeated_field_mask": ["field1", "field2,field3"] @@ -292,7 +351,10 @@ func TestJsonMarshall(t *testing.T) { { name: "RepeatedTimestamp", value: jsonmarshallv2.RepeatedFields{ - RepeatedTimestamp: []string{"2023-01-01T00:00:00Z", "2023-01-02T00:00:00Z"}, + RepeatedTimestamp: []time.Time{ + *time.New(timeFromString("2023-01-01T00:00:00Z")), + *time.New(timeFromString("2023-01-02T00:00:00Z")), + }, }, want: `{ "repeated_timestamp": ["2023-01-01T00:00:00Z", "2023-01-02T00:00:00Z"] @@ -301,9 +363,20 @@ func TestJsonMarshall(t *testing.T) { { name: "MultipleRepeatedFields", value: jsonmarshallv2.RepeatedFields{ - RepeatedBool: []bool{true, false}, - RepeatedInt32: []int{10, 20, 30}, - RepeatedString: []string{"a", "b", "c"}, + RepeatedBool: []bool{ + true, + false, + }, + RepeatedInt32: []int{ + 10, + 20, + 30, + }, + RepeatedString: []string{ + "a", + "b", + "c", + }, }, want: `{ "repeated_string": ["a", "b", "c"], @@ -333,6 +406,19 @@ func TestJsonMarshall(t *testing.T) { }, want: `{}`, }, + { + name: "LegacyWellKnownTypes", + value: jsonmarshallv2.OptionalFields{ + LegacyDuration: "1s", + LegacyFieldMask: "legacy_duration,legacy_timestamp", + LegacyTimestamp: "2023-01-01T00:00:00Z", + }, + want: `{ + "legacy_duration": "1s", + "legacy_timestamp": "2023-01-01T00:00:00Z", + "legacy_field_mask": "legacy_duration,legacy_timestamp" + }`, + }, } for _, tc := range testCases { diff --git a/internal/generatedtests/lro_call_test.go b/internal/generatedtests/lro_call_test.go new file mode 100755 index 000000000..dfa757db9 --- /dev/null +++ b/internal/generatedtests/lro_call_test.go @@ -0,0 +1,329 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +package generated_tests + +import ( + "context" + "encoding/json" + "testing" + "time" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/internal/testspecs/service/common" + "github.com/databricks/databricks-sdk-go/internal/testspecs/service/lrotesting" + "github.com/databricks/databricks-sdk-go/qa" + "github.com/databricks/databricks-sdk-go/service/common/lro" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" +) + +func TestLRO_CreateTestResource_Wait(t *testing.T) { + tests := []struct { + name string + fixtures qa.HTTPFixtures + wantResult *lrotesting.TestResource + wantErr bool + }{ + + { + name: "Success", + fixtures: qa.HTTPFixtures{{ + Method: "POST", + Resource: "/api/2.0/lro-testing/resources", + Response: common.Operation{ + Done: false, + Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), + Name: "operations/test-resource-create-12345", + }, + }, { + Method: "GET", + Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345?", + Response: common.Operation{ + Done: false, + Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 75\n\t\t\t\t}"), + Name: "operations/test-resource-create-12345", + }, + }, { + Method: "GET", + Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345?", + Response: common.Operation{ + Done: true, + Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 100\n\t\t\t\t}"), + Name: "operations/test-resource-create-12345", + Response: json.RawMessage("{\n\t\t\t\t\t\"id\": \"test-resource-123\",\n\t\t\t\t\t\"name\": \"test-resource\"\n\t\t\t\t}"), + }, + }}, + wantResult: &lrotesting.TestResource{ + Id: "test-resource-123", + Name: "test-resource", + }, + wantErr: false, + }, + + { + name: "Error", + fixtures: qa.HTTPFixtures{{ + Method: "POST", + Resource: "/api/2.0/lro-testing/resources", + Response: common.Operation{ + Done: false, + Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), + Name: "operations/test-resource-create-12345", + }, + }, { + Method: "GET", + Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345?", + Response: common.Operation{ + Done: true, + Error: &common.DatabricksServiceExceptionWithDetailsProto{ + ErrorCode: common.ErrorCodeInternalError, + Message: "Test error message", + }, + Name: "operations/test-resource-create-12345", + }, + }}, + wantResult: nil, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.fixtures.ApplyClient(t, func(ctx context.Context, client *client.DatabricksClient) { + service := lrotesting.NewLroTesting(client) + lroOp, err := service.CreateTestResource(ctx, lrotesting.CreateTestResourceRequest{ + Resource: lrotesting.TestResource{}, + }) + if err != nil { + t.Fatalf("CreateTestResource failed: %v", err) + } + result, err := lroOp.Wait(ctx, &lro.LroOptions{Timeout: 1 * time.Minute}) + if diff := cmp.Diff(tt.wantResult, result, cmpopts.IgnoreFields(lrotesting.TestResource{}, "ForceSendFields")); diff != "" { + t.Errorf("result mismatch (-expected +actual):\n%s", diff) + } + if tt.wantErr && err == nil { + t.Fatalf("expected error, got nil") + } + if !tt.wantErr && err != nil { + t.Fatalf("expected no error, got: %v", err) + } + }) + }) + } +} + +func TestLRO_CancelTestResource_Cancel(t *testing.T) { + tests := []struct { + name string + fixtures qa.HTTPFixtures + wantErr bool + }{ + + { + name: "Success", + fixtures: qa.HTTPFixtures{{ + Method: "POST", + Resource: "/api/2.0/lro-testing/resources", + Response: common.Operation{ + Done: false, + Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), + Name: "operations/test-resource-create-12345", + }, + }, { + Method: "POST", + Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345/cancel", + Response: common.Operation{ + Done: true, + Name: "operations/test-resource-create-12345", + }, + }}, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.fixtures.ApplyClient(t, func(ctx context.Context, client *client.DatabricksClient) { + service := lrotesting.NewLroTesting(client) + lroOp, err := service.CreateTestResource(ctx, lrotesting.CreateTestResourceRequest{ + Resource: lrotesting.TestResource{}, + }) + if err != nil { + t.Fatalf("CreateTestResource failed: %v", err) + } + err = lroOp.Cancel(ctx) + if tt.wantErr && err == nil { + t.Fatal("Cancel should have failed") + } + if !tt.wantErr && err != nil { + t.Fatalf("Cancel failed: %v", err) + } + }) + }) + } +} +func TestLRO_CreateTestResource_Name(t *testing.T) { + tests := []struct { + name string + fixtures qa.HTTPFixtures + wantName string + }{ + + { + name: "Success", + fixtures: qa.HTTPFixtures{{ + Method: "POST", + Resource: "/api/2.0/lro-testing/resources", + Response: common.Operation{ + Done: false, + Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), + Name: "operations/test-resource-create-12345", + }, + }}, + wantName: "operations/test-resource-create-12345", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.fixtures.ApplyClient(t, func(ctx context.Context, client *client.DatabricksClient) { + service := lrotesting.NewLroTesting(client) + lroOp, err := service.CreateTestResource(ctx, lrotesting.CreateTestResourceRequest{ + Resource: lrotesting.TestResource{}, + }) + if err != nil { + t.Fatalf("CreateTestResource failed: %v", err) + } + name := lroOp.Name() + if name != tt.wantName { + t.Errorf("name mismatch: expected %q, got %q", tt.wantName, name) + } + }) + }) + } +} +func TestLRO_CreateTestResource_Metadata(t *testing.T) { + tests := []struct { + name string + fixtures qa.HTTPFixtures + wantMetadata *lrotesting.TestResourceOperationMetadata + wantErr bool + }{ + + { + name: "Success", + fixtures: qa.HTTPFixtures{{ + Method: "POST", + Resource: "/api/2.0/lro-testing/resources", + Response: common.Operation{ + Done: false, + Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), + Name: "operations/test-resource-create-12345", + }, + }}, + wantMetadata: &lrotesting.TestResourceOperationMetadata{ + ProgressPercent: 5, + ResourceId: "test-resource-123", + }, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.fixtures.ApplyClient(t, func(ctx context.Context, client *client.DatabricksClient) { + service := lrotesting.NewLroTesting(client) + lroOp, err := service.CreateTestResource(ctx, lrotesting.CreateTestResourceRequest{ + Resource: lrotesting.TestResource{}, + }) + if err != nil { + t.Fatalf("CreateTestResource failed: %v", err) + } + metadata, err := lroOp.Metadata() + if tt.wantErr && err == nil { + t.Fatal("Metadata should have failed") + } + if !tt.wantErr && err != nil { + t.Fatalf("Metadata failed: %v", err) + } + if diff := cmp.Diff(tt.wantMetadata, metadata, cmpopts.IgnoreFields(lrotesting.TestResourceOperationMetadata{}, "ForceSendFields")); diff != "" { + t.Errorf("metadata mismatch (-expected +actual):\n%s", diff) + } + }) + }) + } +} +func TestLRO_CreateTestResource_Done(t *testing.T) { + tests := []struct { + name string + fixtures qa.HTTPFixtures + wantDone bool + wantErr bool + }{ + + { + name: "True", + fixtures: qa.HTTPFixtures{{ + Method: "POST", + Resource: "/api/2.0/lro-testing/resources", + Response: common.Operation{ + Done: false, + Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), + Name: "operations/test-resource-create-12345", + }, + }, { + Method: "GET", + Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345?", + Response: common.Operation{ + Done: true, + Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 100\n\t\t\t\t}"), + Name: "operations/test-resource-create-12345", + Response: json.RawMessage("{\n\t\t\t\t\t\"id\": \"test-resource-123\",\n\t\t\t\t\t\"name\": \"test-resource\"\n\t\t\t\t}"), + }, + }}, + wantDone: true, + wantErr: false, + }, + + { + name: "False", + fixtures: qa.HTTPFixtures{{ + Method: "POST", + Resource: "/api/2.0/lro-testing/resources", + Response: common.Operation{ + Done: false, + Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), + Name: "operations/test-resource-create-12345", + }, + }, { + Method: "GET", + Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345?", + Response: common.Operation{ + Done: false, + Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 75\n\t\t\t\t}"), + Name: "operations/test-resource-create-12345", + }, + }}, + wantDone: false, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.fixtures.ApplyClient(t, func(ctx context.Context, client *client.DatabricksClient) { + service := lrotesting.NewLroTesting(client) + lroOp, err := service.CreateTestResource(ctx, lrotesting.CreateTestResourceRequest{ + Resource: lrotesting.TestResource{}, + }) + if err != nil { + t.Fatalf("CreateTestResource failed: %v", err) + } + done, err := lroOp.Done() + if tt.wantErr && err == nil { + t.Fatal("Done should have failed") + } + if !tt.wantErr && err != nil { + t.Fatalf("Done failed: %v", err) + } + if done != tt.wantDone { + t.Errorf("done mismatch: expected %v, got %v", tt.wantDone, done) + } + }) + }) + } +} diff --git a/internal/testspecs/service/common/api.go b/internal/testspecs/service/common/api.go new file mode 100755 index 000000000..9e75d4f1f --- /dev/null +++ b/internal/testspecs/service/common/api.go @@ -0,0 +1,4 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +// These APIs allow you to manage etc. +package common diff --git a/internal/testspecs/service/common/impl.go b/internal/testspecs/service/common/impl.go new file mode 100755 index 000000000..e4ce41db1 --- /dev/null +++ b/internal/testspecs/service/common/impl.go @@ -0,0 +1,3 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package common diff --git a/internal/testspecs/service/common/model.go b/internal/testspecs/service/common/model.go new file mode 100755 index 000000000..cd47bcfb9 --- /dev/null +++ b/internal/testspecs/service/common/model.go @@ -0,0 +1,357 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package common + +import ( + "encoding/json" + "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" +) + +// Serialization format for DatabricksServiceException with error details. This +// message doesn't work for ScalaPB-04 as google.protobuf.Any is only available +// to ScalaPB-09. Note the definition of this message should be in sync with +// DatabricksServiceExceptionProto defined in +// /api-base/proto/legacy/databricks.proto except the later one doesn't have the +// error details field defined. +type DatabricksServiceExceptionWithDetailsProto struct { + // @pbjson-skip + Details []json.RawMessage `json:"details,omitempty"` + + ErrorCode ErrorCode `json:"error_code,omitempty"` + + Message string `json:"message,omitempty"` + + StackTrace string `json:"stack_trace,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabricksServiceExceptionWithDetailsProto) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabricksServiceExceptionWithDetailsProto) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Legacy definition of the ErrorCode enum. Please keep in sync with +// api-base/proto/error_code.proto (except status code mapping annotations as +// this file doesn't have them). Will be removed eventually, pending the ScalaPB +// 0.4 cleanup. +type ErrorCode string + +const ErrorCodeAborted ErrorCode = `ABORTED` + +const ErrorCodeAlreadyExists ErrorCode = `ALREADY_EXISTS` + +const ErrorCodeBadRequest ErrorCode = `BAD_REQUEST` + +const ErrorCodeCancelled ErrorCode = `CANCELLED` + +const ErrorCodeCatalogAlreadyExists ErrorCode = `CATALOG_ALREADY_EXISTS` + +const ErrorCodeCatalogDoesNotExist ErrorCode = `CATALOG_DOES_NOT_EXIST` + +const ErrorCodeCatalogNotEmpty ErrorCode = `CATALOG_NOT_EMPTY` + +const ErrorCodeCouldNotAcquireLock ErrorCode = `COULD_NOT_ACQUIRE_LOCK` + +const ErrorCodeCustomerUnauthorized ErrorCode = `CUSTOMER_UNAUTHORIZED` + +const ErrorCodeDacAlreadyExists ErrorCode = `DAC_ALREADY_EXISTS` + +const ErrorCodeDacDoesNotExist ErrorCode = `DAC_DOES_NOT_EXIST` + +const ErrorCodeDataLoss ErrorCode = `DATA_LOSS` + +const ErrorCodeDeadlineExceeded ErrorCode = `DEADLINE_EXCEEDED` + +const ErrorCodeDeploymentTimeout ErrorCode = `DEPLOYMENT_TIMEOUT` + +const ErrorCodeDirectoryNotEmpty ErrorCode = `DIRECTORY_NOT_EMPTY` + +const ErrorCodeDirectoryProtected ErrorCode = `DIRECTORY_PROTECTED` + +const ErrorCodeDryRunFailed ErrorCode = `DRY_RUN_FAILED` + +const ErrorCodeEndpointNotFound ErrorCode = `ENDPOINT_NOT_FOUND` + +const ErrorCodeExternalLocationAlreadyExists ErrorCode = `EXTERNAL_LOCATION_ALREADY_EXISTS` + +const ErrorCodeExternalLocationDoesNotExist ErrorCode = `EXTERNAL_LOCATION_DOES_NOT_EXIST` + +const ErrorCodeFeatureDisabled ErrorCode = `FEATURE_DISABLED` + +const ErrorCodeGitConflict ErrorCode = `GIT_CONFLICT` + +const ErrorCodeGitRemoteError ErrorCode = `GIT_REMOTE_ERROR` + +const ErrorCodeGitSensitiveTokenDetected ErrorCode = `GIT_SENSITIVE_TOKEN_DETECTED` + +const ErrorCodeGitUnknownRef ErrorCode = `GIT_UNKNOWN_REF` + +const ErrorCodeGitUrlNotOnAllowList ErrorCode = `GIT_URL_NOT_ON_ALLOW_LIST` + +const ErrorCodeInsecurePartnerResponse ErrorCode = `INSECURE_PARTNER_RESPONSE` + +const ErrorCodeInternalError ErrorCode = `INTERNAL_ERROR` + +const ErrorCodeInvalidParameterValue ErrorCode = `INVALID_PARAMETER_VALUE` + +const ErrorCodeInvalidState ErrorCode = `INVALID_STATE` + +const ErrorCodeInvalidStateTransition ErrorCode = `INVALID_STATE_TRANSITION` + +const ErrorCodeIoError ErrorCode = `IO_ERROR` + +const ErrorCodeIpynbFileInRepo ErrorCode = `IPYNB_FILE_IN_REPO` + +const ErrorCodeMalformedPartnerResponse ErrorCode = `MALFORMED_PARTNER_RESPONSE` + +const ErrorCodeMalformedRequest ErrorCode = `MALFORMED_REQUEST` + +const ErrorCodeManagedResourceGroupDoesNotExist ErrorCode = `MANAGED_RESOURCE_GROUP_DOES_NOT_EXIST` + +const ErrorCodeMaxBlockSizeExceeded ErrorCode = `MAX_BLOCK_SIZE_EXCEEDED` + +const ErrorCodeMaxChildNodeSizeExceeded ErrorCode = `MAX_CHILD_NODE_SIZE_EXCEEDED` + +const ErrorCodeMaxListSizeExceeded ErrorCode = `MAX_LIST_SIZE_EXCEEDED` + +const ErrorCodeMaxNotebookSizeExceeded ErrorCode = `MAX_NOTEBOOK_SIZE_EXCEEDED` + +const ErrorCodeMaxReadSizeExceeded ErrorCode = `MAX_READ_SIZE_EXCEEDED` + +const ErrorCodeMetastoreAlreadyExists ErrorCode = `METASTORE_ALREADY_EXISTS` + +const ErrorCodeMetastoreDoesNotExist ErrorCode = `METASTORE_DOES_NOT_EXIST` + +const ErrorCodeMetastoreNotEmpty ErrorCode = `METASTORE_NOT_EMPTY` + +const ErrorCodeNotFound ErrorCode = `NOT_FOUND` + +const ErrorCodeNotImplemented ErrorCode = `NOT_IMPLEMENTED` + +const ErrorCodePartialDelete ErrorCode = `PARTIAL_DELETE` + +const ErrorCodePermissionDenied ErrorCode = `PERMISSION_DENIED` + +const ErrorCodePermissionNotPropagated ErrorCode = `PERMISSION_NOT_PROPAGATED` + +const ErrorCodePrincipalDoesNotExist ErrorCode = `PRINCIPAL_DOES_NOT_EXIST` + +const ErrorCodeProjectsOperationTimeout ErrorCode = `PROJECTS_OPERATION_TIMEOUT` + +const ErrorCodeProviderAlreadyExists ErrorCode = `PROVIDER_ALREADY_EXISTS` + +const ErrorCodeProviderDoesNotExist ErrorCode = `PROVIDER_DOES_NOT_EXIST` + +const ErrorCodeProviderShareNotAccessible ErrorCode = `PROVIDER_SHARE_NOT_ACCESSIBLE` + +const ErrorCodeQuotaExceeded ErrorCode = `QUOTA_EXCEEDED` + +const ErrorCodeRecipientAlreadyExists ErrorCode = `RECIPIENT_ALREADY_EXISTS` + +const ErrorCodeRecipientDoesNotExist ErrorCode = `RECIPIENT_DOES_NOT_EXIST` + +const ErrorCodeRequestLimitExceeded ErrorCode = `REQUEST_LIMIT_EXCEEDED` + +const ErrorCodeResourceAlreadyExists ErrorCode = `RESOURCE_ALREADY_EXISTS` + +const ErrorCodeResourceConflict ErrorCode = `RESOURCE_CONFLICT` + +const ErrorCodeResourceDoesNotExist ErrorCode = `RESOURCE_DOES_NOT_EXIST` + +const ErrorCodeResourceExhausted ErrorCode = `RESOURCE_EXHAUSTED` + +const ErrorCodeResourceLimitExceeded ErrorCode = `RESOURCE_LIMIT_EXCEEDED` + +const ErrorCodeSchemaAlreadyExists ErrorCode = `SCHEMA_ALREADY_EXISTS` + +const ErrorCodeSchemaDoesNotExist ErrorCode = `SCHEMA_DOES_NOT_EXIST` + +const ErrorCodeSchemaNotEmpty ErrorCode = `SCHEMA_NOT_EMPTY` + +const ErrorCodeSearchQueryTooLong ErrorCode = `SEARCH_QUERY_TOO_LONG` + +const ErrorCodeSearchQueryTooShort ErrorCode = `SEARCH_QUERY_TOO_SHORT` + +const ErrorCodeServiceUnderMaintenance ErrorCode = `SERVICE_UNDER_MAINTENANCE` + +const ErrorCodeShareAlreadyExists ErrorCode = `SHARE_ALREADY_EXISTS` + +const ErrorCodeShareDoesNotExist ErrorCode = `SHARE_DOES_NOT_EXIST` + +const ErrorCodeStorageCredentialAlreadyExists ErrorCode = `STORAGE_CREDENTIAL_ALREADY_EXISTS` + +const ErrorCodeStorageCredentialDoesNotExist ErrorCode = `STORAGE_CREDENTIAL_DOES_NOT_EXIST` + +const ErrorCodeTableAlreadyExists ErrorCode = `TABLE_ALREADY_EXISTS` + +const ErrorCodeTableDoesNotExist ErrorCode = `TABLE_DOES_NOT_EXIST` + +const ErrorCodeTemporarilyUnavailable ErrorCode = `TEMPORARILY_UNAVAILABLE` + +const ErrorCodeUnauthenticated ErrorCode = `UNAUTHENTICATED` + +const ErrorCodeUnavailable ErrorCode = `UNAVAILABLE` + +const ErrorCodeUnknown ErrorCode = `UNKNOWN` + +const ErrorCodeUnparseableHttpError ErrorCode = `UNPARSEABLE_HTTP_ERROR` + +const ErrorCodeWorkspaceTemporarilyUnavailable ErrorCode = `WORKSPACE_TEMPORARILY_UNAVAILABLE` + +// String representation for [fmt.Print] +func (f *ErrorCode) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ErrorCode) Set(v string) error { + switch v { + case `ABORTED`, `ALREADY_EXISTS`, `BAD_REQUEST`, `CANCELLED`, `CATALOG_ALREADY_EXISTS`, `CATALOG_DOES_NOT_EXIST`, `CATALOG_NOT_EMPTY`, `COULD_NOT_ACQUIRE_LOCK`, `CUSTOMER_UNAUTHORIZED`, `DAC_ALREADY_EXISTS`, `DAC_DOES_NOT_EXIST`, `DATA_LOSS`, `DEADLINE_EXCEEDED`, `DEPLOYMENT_TIMEOUT`, `DIRECTORY_NOT_EMPTY`, `DIRECTORY_PROTECTED`, `DRY_RUN_FAILED`, `ENDPOINT_NOT_FOUND`, `EXTERNAL_LOCATION_ALREADY_EXISTS`, `EXTERNAL_LOCATION_DOES_NOT_EXIST`, `FEATURE_DISABLED`, `GIT_CONFLICT`, `GIT_REMOTE_ERROR`, `GIT_SENSITIVE_TOKEN_DETECTED`, `GIT_UNKNOWN_REF`, `GIT_URL_NOT_ON_ALLOW_LIST`, `INSECURE_PARTNER_RESPONSE`, `INTERNAL_ERROR`, `INVALID_PARAMETER_VALUE`, `INVALID_STATE`, `INVALID_STATE_TRANSITION`, `IO_ERROR`, `IPYNB_FILE_IN_REPO`, `MALFORMED_PARTNER_RESPONSE`, `MALFORMED_REQUEST`, `MANAGED_RESOURCE_GROUP_DOES_NOT_EXIST`, `MAX_BLOCK_SIZE_EXCEEDED`, `MAX_CHILD_NODE_SIZE_EXCEEDED`, `MAX_LIST_SIZE_EXCEEDED`, `MAX_NOTEBOOK_SIZE_EXCEEDED`, `MAX_READ_SIZE_EXCEEDED`, `METASTORE_ALREADY_EXISTS`, `METASTORE_DOES_NOT_EXIST`, `METASTORE_NOT_EMPTY`, `NOT_FOUND`, `NOT_IMPLEMENTED`, `PARTIAL_DELETE`, `PERMISSION_DENIED`, `PERMISSION_NOT_PROPAGATED`, `PRINCIPAL_DOES_NOT_EXIST`, `PROJECTS_OPERATION_TIMEOUT`, `PROVIDER_ALREADY_EXISTS`, `PROVIDER_DOES_NOT_EXIST`, `PROVIDER_SHARE_NOT_ACCESSIBLE`, `QUOTA_EXCEEDED`, `RECIPIENT_ALREADY_EXISTS`, `RECIPIENT_DOES_NOT_EXIST`, `REQUEST_LIMIT_EXCEEDED`, `RESOURCE_ALREADY_EXISTS`, `RESOURCE_CONFLICT`, `RESOURCE_DOES_NOT_EXIST`, `RESOURCE_EXHAUSTED`, `RESOURCE_LIMIT_EXCEEDED`, `SCHEMA_ALREADY_EXISTS`, `SCHEMA_DOES_NOT_EXIST`, `SCHEMA_NOT_EMPTY`, `SEARCH_QUERY_TOO_LONG`, `SEARCH_QUERY_TOO_SHORT`, `SERVICE_UNDER_MAINTENANCE`, `SHARE_ALREADY_EXISTS`, `SHARE_DOES_NOT_EXIST`, `STORAGE_CREDENTIAL_ALREADY_EXISTS`, `STORAGE_CREDENTIAL_DOES_NOT_EXIST`, `TABLE_ALREADY_EXISTS`, `TABLE_DOES_NOT_EXIST`, `TEMPORARILY_UNAVAILABLE`, `UNAUTHENTICATED`, `UNAVAILABLE`, `UNKNOWN`, `UNPARSEABLE_HTTP_ERROR`, `WORKSPACE_TEMPORARILY_UNAVAILABLE`: + *f = ErrorCode(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ABORTED", "ALREADY_EXISTS", "BAD_REQUEST", "CANCELLED", "CATALOG_ALREADY_EXISTS", "CATALOG_DOES_NOT_EXIST", "CATALOG_NOT_EMPTY", "COULD_NOT_ACQUIRE_LOCK", "CUSTOMER_UNAUTHORIZED", "DAC_ALREADY_EXISTS", "DAC_DOES_NOT_EXIST", "DATA_LOSS", "DEADLINE_EXCEEDED", "DEPLOYMENT_TIMEOUT", "DIRECTORY_NOT_EMPTY", "DIRECTORY_PROTECTED", "DRY_RUN_FAILED", "ENDPOINT_NOT_FOUND", "EXTERNAL_LOCATION_ALREADY_EXISTS", "EXTERNAL_LOCATION_DOES_NOT_EXIST", "FEATURE_DISABLED", "GIT_CONFLICT", "GIT_REMOTE_ERROR", "GIT_SENSITIVE_TOKEN_DETECTED", "GIT_UNKNOWN_REF", "GIT_URL_NOT_ON_ALLOW_LIST", "INSECURE_PARTNER_RESPONSE", "INTERNAL_ERROR", "INVALID_PARAMETER_VALUE", "INVALID_STATE", "INVALID_STATE_TRANSITION", "IO_ERROR", "IPYNB_FILE_IN_REPO", "MALFORMED_PARTNER_RESPONSE", "MALFORMED_REQUEST", "MANAGED_RESOURCE_GROUP_DOES_NOT_EXIST", "MAX_BLOCK_SIZE_EXCEEDED", "MAX_CHILD_NODE_SIZE_EXCEEDED", "MAX_LIST_SIZE_EXCEEDED", "MAX_NOTEBOOK_SIZE_EXCEEDED", "MAX_READ_SIZE_EXCEEDED", "METASTORE_ALREADY_EXISTS", "METASTORE_DOES_NOT_EXIST", "METASTORE_NOT_EMPTY", "NOT_FOUND", "NOT_IMPLEMENTED", "PARTIAL_DELETE", "PERMISSION_DENIED", "PERMISSION_NOT_PROPAGATED", "PRINCIPAL_DOES_NOT_EXIST", "PROJECTS_OPERATION_TIMEOUT", "PROVIDER_ALREADY_EXISTS", "PROVIDER_DOES_NOT_EXIST", "PROVIDER_SHARE_NOT_ACCESSIBLE", "QUOTA_EXCEEDED", "RECIPIENT_ALREADY_EXISTS", "RECIPIENT_DOES_NOT_EXIST", "REQUEST_LIMIT_EXCEEDED", "RESOURCE_ALREADY_EXISTS", "RESOURCE_CONFLICT", "RESOURCE_DOES_NOT_EXIST", "RESOURCE_EXHAUSTED", "RESOURCE_LIMIT_EXCEEDED", "SCHEMA_ALREADY_EXISTS", "SCHEMA_DOES_NOT_EXIST", "SCHEMA_NOT_EMPTY", "SEARCH_QUERY_TOO_LONG", "SEARCH_QUERY_TOO_SHORT", "SERVICE_UNDER_MAINTENANCE", "SHARE_ALREADY_EXISTS", "SHARE_DOES_NOT_EXIST", "STORAGE_CREDENTIAL_ALREADY_EXISTS", "STORAGE_CREDENTIAL_DOES_NOT_EXIST", "TABLE_ALREADY_EXISTS", "TABLE_DOES_NOT_EXIST", "TEMPORARILY_UNAVAILABLE", "UNAUTHENTICATED", "UNAVAILABLE", "UNKNOWN", "UNPARSEABLE_HTTP_ERROR", "WORKSPACE_TEMPORARILY_UNAVAILABLE"`, v) + } +} + +// Values returns all possible values for ErrorCode. +// +// There is no guarantee on the order of the values in the slice. +func (f *ErrorCode) Values() []ErrorCode { + return []ErrorCode{ + ErrorCodeAborted, + ErrorCodeAlreadyExists, + ErrorCodeBadRequest, + ErrorCodeCancelled, + ErrorCodeCatalogAlreadyExists, + ErrorCodeCatalogDoesNotExist, + ErrorCodeCatalogNotEmpty, + ErrorCodeCouldNotAcquireLock, + ErrorCodeCustomerUnauthorized, + ErrorCodeDacAlreadyExists, + ErrorCodeDacDoesNotExist, + ErrorCodeDataLoss, + ErrorCodeDeadlineExceeded, + ErrorCodeDeploymentTimeout, + ErrorCodeDirectoryNotEmpty, + ErrorCodeDirectoryProtected, + ErrorCodeDryRunFailed, + ErrorCodeEndpointNotFound, + ErrorCodeExternalLocationAlreadyExists, + ErrorCodeExternalLocationDoesNotExist, + ErrorCodeFeatureDisabled, + ErrorCodeGitConflict, + ErrorCodeGitRemoteError, + ErrorCodeGitSensitiveTokenDetected, + ErrorCodeGitUnknownRef, + ErrorCodeGitUrlNotOnAllowList, + ErrorCodeInsecurePartnerResponse, + ErrorCodeInternalError, + ErrorCodeInvalidParameterValue, + ErrorCodeInvalidState, + ErrorCodeInvalidStateTransition, + ErrorCodeIoError, + ErrorCodeIpynbFileInRepo, + ErrorCodeMalformedPartnerResponse, + ErrorCodeMalformedRequest, + ErrorCodeManagedResourceGroupDoesNotExist, + ErrorCodeMaxBlockSizeExceeded, + ErrorCodeMaxChildNodeSizeExceeded, + ErrorCodeMaxListSizeExceeded, + ErrorCodeMaxNotebookSizeExceeded, + ErrorCodeMaxReadSizeExceeded, + ErrorCodeMetastoreAlreadyExists, + ErrorCodeMetastoreDoesNotExist, + ErrorCodeMetastoreNotEmpty, + ErrorCodeNotFound, + ErrorCodeNotImplemented, + ErrorCodePartialDelete, + ErrorCodePermissionDenied, + ErrorCodePermissionNotPropagated, + ErrorCodePrincipalDoesNotExist, + ErrorCodeProjectsOperationTimeout, + ErrorCodeProviderAlreadyExists, + ErrorCodeProviderDoesNotExist, + ErrorCodeProviderShareNotAccessible, + ErrorCodeQuotaExceeded, + ErrorCodeRecipientAlreadyExists, + ErrorCodeRecipientDoesNotExist, + ErrorCodeRequestLimitExceeded, + ErrorCodeResourceAlreadyExists, + ErrorCodeResourceConflict, + ErrorCodeResourceDoesNotExist, + ErrorCodeResourceExhausted, + ErrorCodeResourceLimitExceeded, + ErrorCodeSchemaAlreadyExists, + ErrorCodeSchemaDoesNotExist, + ErrorCodeSchemaNotEmpty, + ErrorCodeSearchQueryTooLong, + ErrorCodeSearchQueryTooShort, + ErrorCodeServiceUnderMaintenance, + ErrorCodeShareAlreadyExists, + ErrorCodeShareDoesNotExist, + ErrorCodeStorageCredentialAlreadyExists, + ErrorCodeStorageCredentialDoesNotExist, + ErrorCodeTableAlreadyExists, + ErrorCodeTableDoesNotExist, + ErrorCodeTemporarilyUnavailable, + ErrorCodeUnauthenticated, + ErrorCodeUnavailable, + ErrorCodeUnknown, + ErrorCodeUnparseableHttpError, + ErrorCodeWorkspaceTemporarilyUnavailable, + } +} + +// Type always returns ErrorCode to satisfy [pflag.Value] interface +func (f *ErrorCode) Type() string { + return "ErrorCode" +} + +// This resource represents a long-running operation that is the result of a +// network API call. +type Operation struct { + // If the value is `false`, it means the operation is still in progress. If + // `true`, the operation is completed, and either `error` or `response` is + // available. + Done bool `json:"done,omitempty"` + // The error result of the operation in case of failure or cancellation. + Error *DatabricksServiceExceptionWithDetailsProto `json:"error,omitempty"` + // Service-specific metadata associated with the operation. It typically + // contains progress information and common metadata such as create time. + // Some services might not provide such metadata. Any method that returns a + // long-running operation should document the metadata type, if any. + Metadata json.RawMessage `json:"metadata,omitempty"` + // The server-assigned name, which is only unique within the same service + // that originally returns it. If you use the default HTTP mapping, the + // `name` should be a resource name ending with `operations/{unique_id}`. + // + // Note: multi-segment resource names are not yet supported in the RPC + // framework and SDK/TF. Until that support is added, `name` must be string + // without internal `/` separators. + Name string `json:"name,omitempty"` + // The normal, successful response of the operation. If the original method + // returns no data on success, such as `Delete`, the response is + // `google.protobuf.Empty`. If the original method is standard + // `Get`/`Create`/`Update`, the response should be the resource. For other + // methods, the response should have the type `XxxResponse`, where `Xxx` is + // the original method name. For example, if the original method name is + // `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. + Response json.RawMessage `json:"response,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Operation) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Operation) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} diff --git a/internal/testspecs/service/httpcallv2/impl.go b/internal/testspecs/service/httpcallv2/impl.go index 253f37fcf..9c10a48f3 100755 --- a/internal/testspecs/service/httpcallv2/impl.go +++ b/internal/testspecs/service/httpcallv2/impl.go @@ -4,8 +4,10 @@ package httpcallv2 import ( "context" + "encoding/json" "fmt" "net/http" + "strings" "github.com/databricks/databricks-sdk-go/client" "golang.org/x/exp/slices" @@ -41,25 +43,37 @@ func (a *httpCallV2Impl) UpdateResource(ctx context.Context, request UpdateResou var resource Resource path := fmt.Sprintf("/api/2.0/http-call/%v/%v/%v", request.NestedPathParamString, request.NestedPathParamInt, request.NestedPathParamBool) queryParams := make(map[string]any) - if request.FieldMask != "" || slices.Contains(request.ForceSendFields, "FieldMask") { - queryParams["field_mask"] = request.FieldMask + + if request.FieldMask != nil || slices.Contains(request.ForceSendFields, "FieldMask") { + fieldMaskJson, fieldMaskMarshallError := json.Marshal(request.FieldMask) + if fieldMaskMarshallError != nil { + return nil, fieldMaskMarshallError + } + + queryParams["field_mask"] = strings.Trim(string(fieldMaskJson), `"`) } + if request.OptionalComplexQueryParam != nil || slices.Contains(request.ForceSendFields, "OptionalComplexQueryParam") { queryParams["optional_complex_query_param"] = request.OptionalComplexQueryParam } + if request.QueryParamBool != false || slices.Contains(request.ForceSendFields, "QueryParamBool") { queryParams["query_param_bool"] = request.QueryParamBool } + if request.QueryParamInt != 0 || slices.Contains(request.ForceSendFields, "QueryParamInt") { queryParams["query_param_int"] = request.QueryParamInt } + if request.QueryParamString != "" || slices.Contains(request.ForceSendFields, "QueryParamString") { queryParams["query_param_string"] = request.QueryParamString } - if request.RepeatedComplexQueryParam != nil || slices.Contains(request.ForceSendFields, "RepeatedComplexQueryParam") { + + if slices.Contains(request.ForceSendFields, "RepeatedComplexQueryParam") { queryParams["repeated_complex_query_param"] = request.RepeatedComplexQueryParam } - if request.RepeatedQueryParam != nil || slices.Contains(request.ForceSendFields, "RepeatedQueryParam") { + + if slices.Contains(request.ForceSendFields, "RepeatedQueryParam") { queryParams["repeated_query_param"] = request.RepeatedQueryParam } headers := make(map[string]string) diff --git a/internal/testspecs/service/httpcallv2/model.go b/internal/testspecs/service/httpcallv2/model.go index 156db6cdb..a089f94e4 100755 --- a/internal/testspecs/service/httpcallv2/model.go +++ b/internal/testspecs/service/httpcallv2/model.go @@ -3,6 +3,9 @@ package httpcallv2 import ( + "encoding/json" + + "github.com/databricks/databricks-sdk-go/common/types/fieldmask" "github.com/databricks/databricks-sdk-go/marshal" ) @@ -51,7 +54,7 @@ type GetResourceRequest struct { // Specification of elements in sequence or map fields is not allowed, as // only the entire collection field can be specified. Field names must // exactly match the resource field names. - FieldMask string `json:"-" url:"field_mask,omitempty"` + FieldMask *fieldmask.FieldMask `json:"-" url:"field_mask,omitempty"` OptionalComplexQueryParam *ComplexQueryParam `json:"-" url:"optional_complex_query_param,omitempty"` @@ -83,6 +86,8 @@ func (s GetResourceRequest) MarshalJSON() ([]byte, error) { } type Resource struct { + AnyField json.RawMessage `json:"any_field,omitempty"` + BodyField string `json:"body_field,omitempty"` NestedPathParamBool bool `json:"nested_path_param_bool,omitempty"` @@ -109,7 +114,7 @@ type UpdateResourceRequest struct { // Specification of elements in sequence or map fields is not allowed, as // only the entire collection field can be specified. Field names must // exactly match the resource field names. - FieldMask string `json:"-" url:"field_mask,omitempty"` + FieldMask *fieldmask.FieldMask `json:"-" url:"field_mask,omitempty"` NestedPathParamBool bool `json:"-" url:"-"` diff --git a/internal/testspecs/service/jsonmarshallv2/model.go b/internal/testspecs/service/jsonmarshallv2/model.go index b1e9899e1..be284152b 100755 --- a/internal/testspecs/service/jsonmarshallv2/model.go +++ b/internal/testspecs/service/jsonmarshallv2/model.go @@ -3,8 +3,12 @@ package jsonmarshallv2 import ( + "encoding/json" "fmt" + "github.com/databricks/databricks-sdk-go/common/types/duration" + "github.com/databricks/databricks-sdk-go/common/types/fieldmask" + "github.com/databricks/databricks-sdk-go/common/types/time" "github.com/databricks/databricks-sdk-go/marshal" ) @@ -15,11 +19,11 @@ type GetResourceRequest struct { } type NestedMessage struct { - OptionalDuration string `json:"optional_duration,omitempty" url:"optional_duration,omitempty"` + OptionalDuration *duration.Duration `json:"optional_duration,omitempty" url:"optional_duration,omitempty"` OptionalString string `json:"optional_string,omitempty" url:"optional_string,omitempty"` - OptionalTimestamp string `json:"optional_timestamp,omitempty" url:"optional_timestamp,omitempty"` + OptionalTimestamp *time.Time `json:"optional_timestamp,omitempty" url:"optional_timestamp,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -33,14 +37,27 @@ func (s NestedMessage) MarshalJSON() ([]byte, error) { } type OptionalFields struct { - Duration string `json:"duration,omitempty" url:"duration,omitempty"` + Duration *duration.Duration `json:"duration,omitempty" url:"duration,omitempty"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). // Specification of elements in sequence or map fields is not allowed, as // only the entire collection field can be specified. Field names must // exactly match the resource field names. - FieldMask string `json:"field_mask,omitempty" url:"field_mask,omitempty"` + FieldMask *fieldmask.FieldMask `json:"field_mask,omitempty" url:"field_mask,omitempty"` + // Legacy Well Known types + LegacyDuration string `json:"legacy_duration,omitempty" url:"legacy_duration,omitempty"` + // The field mask must be a single string, with multiple fields separated by + // commas (no spaces). The field path is relative to the resource object, + // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). + // Specification of elements in sequence or map fields is not allowed, as + // only the entire collection field can be specified. Field names must + // exactly match the resource field names. + LegacyFieldMask string `json:"legacy_field_mask,omitempty" url:"legacy_field_mask,omitempty"` + + LegacyTimestamp string `json:"legacy_timestamp,omitempty" url:"legacy_timestamp,omitempty"` + + ListValue []json.RawMessage `json:"list_value,omitempty" url:"list_value,omitempty"` // Lint disable reason: This is a dummy field used to test SDK Generation // logic. Map map[string]string `json:"map,omitempty" url:"map,omitempty"` @@ -55,9 +72,13 @@ type OptionalFields struct { OptionalString string `json:"optional_string,omitempty" url:"optional_string,omitempty"` + Struct map[string]json.RawMessage `json:"struct,omitempty" url:"struct,omitempty"` + TestEnum TestEnum `json:"test_enum,omitempty" url:"test_enum,omitempty"` - Timestamp string `json:"timestamp,omitempty" url:"timestamp,omitempty"` + Timestamp *time.Time `json:"timestamp,omitempty" url:"timestamp,omitempty"` + + Value *json.RawMessage `json:"value,omitempty" url:"value,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -73,19 +94,25 @@ func (s OptionalFields) MarshalJSON() ([]byte, error) { type RepeatedFields struct { RepeatedBool []bool `json:"repeated_bool,omitempty" url:"repeated_bool,omitempty"` - RepeatedDuration []string `json:"repeated_duration,omitempty" url:"repeated_duration,omitempty"` + RepeatedDuration []duration.Duration `json:"repeated_duration,omitempty" url:"repeated_duration,omitempty"` - RepeatedFieldMask []string `json:"repeated_field_mask,omitempty" url:"repeated_field_mask,omitempty"` + RepeatedFieldMask []fieldmask.FieldMask `json:"repeated_field_mask,omitempty" url:"repeated_field_mask,omitempty"` RepeatedInt32 []int `json:"repeated_int32,omitempty" url:"repeated_int32,omitempty"` RepeatedInt64 []int64 `json:"repeated_int64,omitempty" url:"repeated_int64,omitempty"` + RepeatedListValue [][]json.RawMessage `json:"repeated_list_value,omitempty" url:"repeated_list_value,omitempty"` + RepeatedMessage []NestedMessage `json:"repeated_message,omitempty" url:"repeated_message,omitempty"` RepeatedString []string `json:"repeated_string,omitempty" url:"repeated_string,omitempty"` - RepeatedTimestamp []string `json:"repeated_timestamp,omitempty" url:"repeated_timestamp,omitempty"` + RepeatedStruct []map[string]json.RawMessage `json:"repeated_struct,omitempty" url:"repeated_struct,omitempty"` + + RepeatedTimestamp []time.Time `json:"repeated_timestamp,omitempty" url:"repeated_timestamp,omitempty"` + + RepeatedValue []json.RawMessage `json:"repeated_value,omitempty" url:"repeated_value,omitempty"` TestRepeatedEnum []TestEnum `json:"test_repeated_enum,omitempty" url:"test_repeated_enum,omitempty"` } @@ -93,24 +120,30 @@ type RepeatedFields struct { type RequiredFields struct { RequiredBool bool `json:"required_bool" url:"required_bool"` - RequiredDuration string `json:"required_duration" url:"required_duration"` + RequiredDuration duration.Duration `json:"required_duration" url:"required_duration"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). // Specification of elements in sequence or map fields is not allowed, as // only the entire collection field can be specified. Field names must // exactly match the resource field names. - RequiredFieldMask string `json:"required_field_mask" url:"required_field_mask"` + RequiredFieldMask fieldmask.FieldMask `json:"required_field_mask" url:"required_field_mask"` RequiredInt32 int `json:"required_int32" url:"required_int32"` RequiredInt64 int64 `json:"required_int64" url:"required_int64"` + RequiredListValue []json.RawMessage `json:"required_list_value" url:"required_list_value"` + RequiredMessage NestedMessage `json:"required_message" url:"required_message"` RequiredString string `json:"required_string" url:"required_string"` - RequiredTimestamp string `json:"required_timestamp" url:"required_timestamp"` + RequiredStruct map[string]json.RawMessage `json:"required_struct" url:"required_struct"` + + RequiredTimestamp time.Time `json:"required_timestamp" url:"required_timestamp"` + + RequiredValue json.RawMessage `json:"required_value" url:"required_value"` TestRequiredEnum TestEnum `json:"test_required_enum" url:"test_required_enum"` } diff --git a/internal/testspecs/service/lrotesting/api.go b/internal/testspecs/service/lrotesting/api.go new file mode 100755 index 000000000..c2bf712a0 --- /dev/null +++ b/internal/testspecs/service/lrotesting/api.go @@ -0,0 +1,159 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +// Test service for Long Running Operations +package lrotesting + +import ( + "context" + "encoding/json" + "fmt" + "time" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/internal/testspecs/service/common" + "github.com/databricks/databricks-sdk-go/retries" + "github.com/databricks/databricks-sdk-go/service/common/lro" + "github.com/databricks/databricks-sdk-go/useragent" +) + +type LroTestingInterface interface { + CancelOperation(ctx context.Context, request CancelOperationRequest) error + + CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (*CreateTestResourceOperation, error) + + GetOperation(ctx context.Context, request GetOperationRequest) (*common.Operation, error) + + // Simple method to get test resource + GetTestResource(ctx context.Context, request GetTestResourceRequest) (*TestResource, error) +} + +func NewLroTesting(client *client.DatabricksClient) *LroTestingAPI { + return &LroTestingAPI{ + lroTestingImpl: lroTestingImpl{ + client: client, + }, + } +} + +// Test service for Long Running Operations +type LroTestingAPI struct { + lroTestingImpl +} + +func (a *LroTestingAPI) CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (*CreateTestResourceOperation, error) { + operation, err := a.lroTestingImpl.CreateTestResource(ctx, request) + if err != nil { + return nil, err + } + return &CreateTestResourceOperation{ + impl: &a.lroTestingImpl, + operation: operation, + }, nil +} + +type CreateTestResourceOperation struct { + impl *lroTestingImpl + operation *common.Operation +} + +// Wait blocks until the long-running operation is completed with default 20 min +// timeout, the timeout can be overridden in the opts. If the operation didn't +// finished within the timeout, this function will through an error of type +// ErrTimedOut, otherwise successful response and any errors encountered. +func (a *CreateTestResourceOperation) Wait(ctx context.Context, opts *lro.LroOptions) (*TestResource, error) { + timeout := 20 * time.Minute // default timeout per LRO spec + if opts != nil && opts.Timeout > 0 { + timeout = opts.Timeout + } + + ctx = useragent.InContext(ctx, "sdk-feature", "long-running") + return retries.Poll[TestResource](ctx, timeout, func() (*TestResource, *retries.Err) { + operation, err := a.impl.GetOperation(ctx, GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return nil, retries.Halt(err) + } + + // Update local operation state + a.operation = operation + + if !operation.Done { + return nil, retries.Continues("operation still in progress") + } + + if operation.Error != nil { + var errorMsg string + if operation.Error.Message != "" { + errorMsg = operation.Error.Message + } else { + errorMsg = "unknown error" + } + + if operation.Error.ErrorCode != "" { + errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) + } + + return nil, retries.Halt(fmt.Errorf("operation failed: %s", errorMsg)) + } + + // Operation completed successfully, unmarshal response + if operation.Response == nil { + return nil, retries.Halt(fmt.Errorf("operation completed but no response available")) + } + + var testResource TestResource + err = json.Unmarshal(operation.Response, &testResource) + if err != nil { + return nil, retries.Halt(fmt.Errorf("failed to unmarshal testResource response: %w", err)) + } + + return &testResource, nil + }) +} + +// Starts asynchronous cancellation on a long-running operation. The server +// makes a best effort to cancel the operation, but success is not guaranteed. +func (a *CreateTestResourceOperation) Cancel(ctx context.Context) error { + return a.impl.CancelOperation(ctx, CancelOperationRequest{ + Name: a.operation.Name, + }) +} + +// Name returns the name of the long-running operation. The name is assigned +// by the server and is unique within the service from which the operation is created. +func (a *CreateTestResourceOperation) Name() string { + return a.operation.Name +} + +// Metadata returns metadata associated with the long-running operation. +// If the metadata is not available, the returned metadata and error are both nil. +func (a *CreateTestResourceOperation) Metadata() (*TestResourceOperationMetadata, error) { + if a.operation.Metadata == nil { + return nil, nil + } + + var metadata TestResourceOperationMetadata + err := json.Unmarshal(a.operation.Metadata, &metadata) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal operation metadata: %w", err) + } + + return &metadata, nil +} + +// Done reports whether the long-running operation has completed. +func (a *CreateTestResourceOperation) Done() (bool, error) { + // Refresh the operation state first + operation, err := a.impl.GetOperation(context.Background(), GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return false, err + } + + // Update local operation state + a.operation = operation + + return operation.Done, nil +} diff --git a/internal/testspecs/service/lrotesting/impl.go b/internal/testspecs/service/lrotesting/impl.go new file mode 100755 index 000000000..c975fa3b6 --- /dev/null +++ b/internal/testspecs/service/lrotesting/impl.go @@ -0,0 +1,57 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package lrotesting + +import ( + "context" + "fmt" + "net/http" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/internal/testspecs/service/common" +) + +// unexported type that holds implementations of just LroTesting API methods +type lroTestingImpl struct { + client *client.DatabricksClient +} + +func (a *lroTestingImpl) CancelOperation(ctx context.Context, request CancelOperationRequest) error { + path := fmt.Sprintf("/api/2.0/lro-testing/operations/%v/cancel", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, nil) + return err +} + +func (a *lroTestingImpl) CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (*common.Operation, error) { + var operation common.Operation + path := "/api/2.0/lro-testing/resources" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Resource, &operation) + return &operation, err +} + +func (a *lroTestingImpl) GetOperation(ctx context.Context, request GetOperationRequest) (*common.Operation, error) { + var operation common.Operation + path := fmt.Sprintf("/api/2.0/lro-testing/operations/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &operation) + return &operation, err +} + +func (a *lroTestingImpl) GetTestResource(ctx context.Context, request GetTestResourceRequest) (*TestResource, error) { + var testResource TestResource + path := fmt.Sprintf("/api/2.0/lro-testing/resources/%v", request.ResourceId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &testResource) + return &testResource, err +} diff --git a/internal/testspecs/service/lrotesting/model.go b/internal/testspecs/service/lrotesting/model.go new file mode 100755 index 000000000..f111e7c3c --- /dev/null +++ b/internal/testspecs/service/lrotesting/model.go @@ -0,0 +1,63 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package lrotesting + +import ( + "github.com/databricks/databricks-sdk-go/marshal" +) + +type CancelOperationRequest struct { + // The name of the operation resource to be cancelled. + Name string `json:"-" url:"-"` +} + +type CreateTestResourceRequest struct { + // The resource to create + Resource TestResource `json:"resource"` +} + +type GetOperationRequest struct { + // The name of the operation resource. + Name string `json:"-" url:"-"` +} + +type GetTestResourceRequest struct { + // Resource ID to get + ResourceId string `json:"-" url:"-"` +} + +// Test resource for LRO operations +type TestResource struct { + // Unique identifier for the resource + Id string `json:"id,omitempty"` + // Name of the resource + Name string `json:"name,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *TestResource) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s TestResource) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Metadata for test resource operations +type TestResourceOperationMetadata struct { + // Progress percentage (0-100) + ProgressPercent int `json:"progress_percent,omitempty"` + // ID of the resource being operated on + ResourceId string `json:"resource_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *TestResourceOperationMetadata) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s TestResourceOperationMetadata) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} diff --git a/service/agentbricks/model.go b/service/agentbricks/model.go index e6898b6de..1280551de 100755 --- a/service/agentbricks/model.go +++ b/service/agentbricks/model.go @@ -13,9 +13,10 @@ type CancelCustomLlmOptimizationRunRequest struct { } type CreateCustomLlmRequest struct { - // Optional: UC path for agent artifacts. If you are using a dataset that - // you only have read permissions, please provide a destination path where - // you have write permissions. Please provide this in catalog.schema format. + // This will soon be deprecated!! Optional: UC path for agent artifacts. If + // you are using a dataset that you only have read permissions, please + // provide a destination path where you have write permissions. Please + // provide this in catalog.schema format. AgentArtifactPath string `json:"agent_artifact_path,omitempty"` // Datasets used for training and evaluating the model, not for inference. // Currently, only 1 dataset is accepted. diff --git a/service/apps/api.go b/service/apps/api.go index 5ead2c444..97d13e734 100755 --- a/service/apps/api.go +++ b/service/apps/api.go @@ -1,8 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// Apps run directly on a customer’s Databricks instance, integrate with their -// data, use and extend Databricks services, and enable users to interact -// through single sign-on. +// These APIs allow you to manage Apps, Apps Settings, etc. package apps import ( @@ -553,3 +551,43 @@ func (a *AppsAPI) StopAndWait(ctx context.Context, stopAppRequest StopAppRequest } return wait.Get() } + +type AppsSettingsInterface interface { + + // Creates a custom template. + CreateCustomTemplate(ctx context.Context, request CreateCustomTemplateRequest) (*CustomTemplate, error) + + // Deletes the custom template with the specified name. + DeleteCustomTemplate(ctx context.Context, request DeleteCustomTemplateRequest) (*CustomTemplate, error) + + // Gets the custom template with the specified name. + GetCustomTemplate(ctx context.Context, request GetCustomTemplateRequest) (*CustomTemplate, error) + + // Lists all custom templates in the workspace. + // + // This method is generated by Databricks SDK Code Generator. + ListCustomTemplates(ctx context.Context, request ListCustomTemplatesRequest) listing.Iterator[CustomTemplate] + + // Lists all custom templates in the workspace. + // + // This method is generated by Databricks SDK Code Generator. + ListCustomTemplatesAll(ctx context.Context, request ListCustomTemplatesRequest) ([]CustomTemplate, error) + + // Updates the custom template with the specified name. Note that the template + // name cannot be updated. + UpdateCustomTemplate(ctx context.Context, request UpdateCustomTemplateRequest) (*CustomTemplate, error) +} + +func NewAppsSettings(client *client.DatabricksClient) *AppsSettingsAPI { + return &AppsSettingsAPI{ + appsSettingsImpl: appsSettingsImpl{ + client: client, + }, + } +} + +// Apps Settings manage the settings for the Apps service on a customer's +// Databricks instance. +type AppsSettingsAPI struct { + appsSettingsImpl +} diff --git a/service/apps/impl.go b/service/apps/impl.go index a2f7de3d1..69f44051f 100755 --- a/service/apps/impl.go +++ b/service/apps/impl.go @@ -22,6 +22,7 @@ func (a *appsImpl) Create(ctx context.Context, request CreateAppRequest) (*App, var app App path := "/api/2.0/apps" queryParams := make(map[string]any) + if request.NoCompute != false || slices.Contains(request.ForceSendFields, "NoCompute") { queryParams["no_compute"] = request.NoCompute } @@ -229,3 +230,91 @@ func (a *appsImpl) UpdatePermissions(ctx context.Context, request AppPermissions err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &appPermissions) return &appPermissions, err } + +// unexported type that holds implementations of just AppsSettings API methods +type appsSettingsImpl struct { + client *client.DatabricksClient +} + +func (a *appsSettingsImpl) CreateCustomTemplate(ctx context.Context, request CreateCustomTemplateRequest) (*CustomTemplate, error) { + var customTemplate CustomTemplate + path := "/api/2.0/apps-settings/templates" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Template, &customTemplate) + return &customTemplate, err +} + +func (a *appsSettingsImpl) DeleteCustomTemplate(ctx context.Context, request DeleteCustomTemplateRequest) (*CustomTemplate, error) { + var customTemplate CustomTemplate + path := fmt.Sprintf("/api/2.0/apps-settings/templates/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &customTemplate) + return &customTemplate, err +} + +func (a *appsSettingsImpl) GetCustomTemplate(ctx context.Context, request GetCustomTemplateRequest) (*CustomTemplate, error) { + var customTemplate CustomTemplate + path := fmt.Sprintf("/api/2.0/apps-settings/templates/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &customTemplate) + return &customTemplate, err +} + +// Lists all custom templates in the workspace. +func (a *appsSettingsImpl) ListCustomTemplates(ctx context.Context, request ListCustomTemplatesRequest) listing.Iterator[CustomTemplate] { + + getNextPage := func(ctx context.Context, req ListCustomTemplatesRequest) (*ListCustomTemplatesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListCustomTemplates(ctx, req) + } + getItems := func(resp *ListCustomTemplatesResponse) []CustomTemplate { + return resp.Templates + } + getNextReq := func(resp *ListCustomTemplatesResponse) *ListCustomTemplatesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// Lists all custom templates in the workspace. +func (a *appsSettingsImpl) ListCustomTemplatesAll(ctx context.Context, request ListCustomTemplatesRequest) ([]CustomTemplate, error) { + iterator := a.ListCustomTemplates(ctx, request) + return listing.ToSlice[CustomTemplate](ctx, iterator) +} + +func (a *appsSettingsImpl) internalListCustomTemplates(ctx context.Context, request ListCustomTemplatesRequest) (*ListCustomTemplatesResponse, error) { + var listCustomTemplatesResponse ListCustomTemplatesResponse + path := "/api/2.0/apps-settings/templates" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCustomTemplatesResponse) + return &listCustomTemplatesResponse, err +} + +func (a *appsSettingsImpl) UpdateCustomTemplate(ctx context.Context, request UpdateCustomTemplateRequest) (*CustomTemplate, error) { + var customTemplate CustomTemplate + path := fmt.Sprintf("/api/2.0/apps-settings/templates/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.Template, &customTemplate) + return &customTemplate, err +} diff --git a/service/apps/interface.go b/service/apps/interface.go index e7398a918..5fcd1289c 100755 --- a/service/apps/interface.go +++ b/service/apps/interface.go @@ -60,3 +60,26 @@ type AppsService interface { // their root object. UpdatePermissions(ctx context.Context, request AppPermissionsRequest) (*AppPermissions, error) } + +// Apps Settings manage the settings for the Apps service on a customer's +// Databricks instance. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type AppsSettingsService interface { + + // Creates a custom template. + CreateCustomTemplate(ctx context.Context, request CreateCustomTemplateRequest) (*CustomTemplate, error) + + // Deletes the custom template with the specified name. + DeleteCustomTemplate(ctx context.Context, request DeleteCustomTemplateRequest) (*CustomTemplate, error) + + // Gets the custom template with the specified name. + GetCustomTemplate(ctx context.Context, request GetCustomTemplateRequest) (*CustomTemplate, error) + + // Lists all custom templates in the workspace. + ListCustomTemplates(ctx context.Context, request ListCustomTemplatesRequest) (*ListCustomTemplatesResponse, error) + + // Updates the custom template with the specified name. Note that the + // template name cannot be updated. + UpdateCustomTemplate(ctx context.Context, request UpdateCustomTemplateRequest) (*CustomTemplate, error) +} diff --git a/service/apps/model.go b/service/apps/model.go index 7f768e864..ac022f9d7 100755 --- a/service/apps/model.go +++ b/service/apps/model.go @@ -30,6 +30,8 @@ type App struct { Description string `json:"description,omitempty"` EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The effective api scopes granted to the user access token. EffectiveUserApiScopes []string `json:"effective_user_api_scopes,omitempty"` // The unique identifier of the app. @@ -59,6 +61,8 @@ type App struct { // The URL of the app once it is deployed. Url string `json:"url,omitempty"` + UsagePolicyId string `json:"usage_policy_id,omitempty"` + UserApiScopes []string `json:"user_api_scopes,omitempty"` ForceSendFields []string `json:"-" url:"-"` @@ -264,6 +268,326 @@ func (s AppDeploymentStatus) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// App manifest definition +type AppManifest struct { + // Description of the app defined by manifest author / publisher + Description string `json:"description,omitempty"` + // Name of the app defined by manifest author / publisher + Name string `json:"name"` + + ResourceSpecs []AppManifestAppResourceSpec `json:"resource_specs,omitempty"` + // The manifest schema version, for now only 1 is allowed + Version int `json:"version"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AppManifest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AppManifest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type AppManifestAppResourceJobSpec struct { + // Permissions to grant on the Job. Supported permissions are: "CAN_MANAGE", + // "IS_OWNER", "CAN_MANAGE_RUN", "CAN_VIEW". + Permission AppManifestAppResourceJobSpecJobPermission `json:"permission"` +} + +type AppManifestAppResourceJobSpecJobPermission string + +const AppManifestAppResourceJobSpecJobPermissionCanManage AppManifestAppResourceJobSpecJobPermission = `CAN_MANAGE` + +const AppManifestAppResourceJobSpecJobPermissionCanManageRun AppManifestAppResourceJobSpecJobPermission = `CAN_MANAGE_RUN` + +const AppManifestAppResourceJobSpecJobPermissionCanView AppManifestAppResourceJobSpecJobPermission = `CAN_VIEW` + +const AppManifestAppResourceJobSpecJobPermissionIsOwner AppManifestAppResourceJobSpecJobPermission = `IS_OWNER` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceJobSpecJobPermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceJobSpecJobPermission) Set(v string) error { + switch v { + case `CAN_MANAGE`, `CAN_MANAGE_RUN`, `CAN_VIEW`, `IS_OWNER`: + *f = AppManifestAppResourceJobSpecJobPermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CAN_MANAGE", "CAN_MANAGE_RUN", "CAN_VIEW", "IS_OWNER"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceJobSpecJobPermission. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceJobSpecJobPermission) Values() []AppManifestAppResourceJobSpecJobPermission { + return []AppManifestAppResourceJobSpecJobPermission{ + AppManifestAppResourceJobSpecJobPermissionCanManage, + AppManifestAppResourceJobSpecJobPermissionCanManageRun, + AppManifestAppResourceJobSpecJobPermissionCanView, + AppManifestAppResourceJobSpecJobPermissionIsOwner, + } +} + +// Type always returns AppManifestAppResourceJobSpecJobPermission to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceJobSpecJobPermission) Type() string { + return "AppManifestAppResourceJobSpecJobPermission" +} + +type AppManifestAppResourceSecretSpec struct { + // Permission to grant on the secret scope. For secrets, only one permission + // is allowed. Permission must be one of: "READ", "WRITE", "MANAGE". + Permission AppManifestAppResourceSecretSpecSecretPermission `json:"permission"` +} + +// Permission to grant on the secret scope. Supported permissions are: "READ", +// "WRITE", "MANAGE". +type AppManifestAppResourceSecretSpecSecretPermission string + +const AppManifestAppResourceSecretSpecSecretPermissionManage AppManifestAppResourceSecretSpecSecretPermission = `MANAGE` + +const AppManifestAppResourceSecretSpecSecretPermissionRead AppManifestAppResourceSecretSpecSecretPermission = `READ` + +const AppManifestAppResourceSecretSpecSecretPermissionWrite AppManifestAppResourceSecretSpecSecretPermission = `WRITE` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceSecretSpecSecretPermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceSecretSpecSecretPermission) Set(v string) error { + switch v { + case `MANAGE`, `READ`, `WRITE`: + *f = AppManifestAppResourceSecretSpecSecretPermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "MANAGE", "READ", "WRITE"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceSecretSpecSecretPermission. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceSecretSpecSecretPermission) Values() []AppManifestAppResourceSecretSpecSecretPermission { + return []AppManifestAppResourceSecretSpecSecretPermission{ + AppManifestAppResourceSecretSpecSecretPermissionManage, + AppManifestAppResourceSecretSpecSecretPermissionRead, + AppManifestAppResourceSecretSpecSecretPermissionWrite, + } +} + +// Type always returns AppManifestAppResourceSecretSpecSecretPermission to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceSecretSpecSecretPermission) Type() string { + return "AppManifestAppResourceSecretSpecSecretPermission" +} + +type AppManifestAppResourceServingEndpointSpec struct { + // Permission to grant on the serving endpoint. Supported permissions are: + // "CAN_MANAGE", "CAN_QUERY", "CAN_VIEW". + Permission AppManifestAppResourceServingEndpointSpecServingEndpointPermission `json:"permission"` +} + +type AppManifestAppResourceServingEndpointSpecServingEndpointPermission string + +const AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanManage AppManifestAppResourceServingEndpointSpecServingEndpointPermission = `CAN_MANAGE` + +const AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanQuery AppManifestAppResourceServingEndpointSpecServingEndpointPermission = `CAN_QUERY` + +const AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanView AppManifestAppResourceServingEndpointSpecServingEndpointPermission = `CAN_VIEW` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceServingEndpointSpecServingEndpointPermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceServingEndpointSpecServingEndpointPermission) Set(v string) error { + switch v { + case `CAN_MANAGE`, `CAN_QUERY`, `CAN_VIEW`: + *f = AppManifestAppResourceServingEndpointSpecServingEndpointPermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CAN_MANAGE", "CAN_QUERY", "CAN_VIEW"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceServingEndpointSpecServingEndpointPermission. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceServingEndpointSpecServingEndpointPermission) Values() []AppManifestAppResourceServingEndpointSpecServingEndpointPermission { + return []AppManifestAppResourceServingEndpointSpecServingEndpointPermission{ + AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanManage, + AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanQuery, + AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanView, + } +} + +// Type always returns AppManifestAppResourceServingEndpointSpecServingEndpointPermission to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceServingEndpointSpecServingEndpointPermission) Type() string { + return "AppManifestAppResourceServingEndpointSpecServingEndpointPermission" +} + +// AppResource related fields are copied from app.proto but excludes resource +// identifiers (e.g. name, id, key, scope, etc.) +type AppManifestAppResourceSpec struct { + // Description of the App Resource. + Description string `json:"description,omitempty"` + + JobSpec *AppManifestAppResourceJobSpec `json:"job_spec,omitempty"` + // Name of the App Resource. + Name string `json:"name"` + + SecretSpec *AppManifestAppResourceSecretSpec `json:"secret_spec,omitempty"` + + ServingEndpointSpec *AppManifestAppResourceServingEndpointSpec `json:"serving_endpoint_spec,omitempty"` + + SqlWarehouseSpec *AppManifestAppResourceSqlWarehouseSpec `json:"sql_warehouse_spec,omitempty"` + + UcSecurableSpec *AppManifestAppResourceUcSecurableSpec `json:"uc_securable_spec,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AppManifestAppResourceSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AppManifestAppResourceSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type AppManifestAppResourceSqlWarehouseSpec struct { + // Permission to grant on the SQL warehouse. Supported permissions are: + // "CAN_MANAGE", "CAN_USE", "IS_OWNER". + Permission AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission `json:"permission"` +} + +type AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission string + +const AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionCanManage AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission = `CAN_MANAGE` + +const AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionCanUse AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission = `CAN_USE` + +const AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionIsOwner AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission = `IS_OWNER` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission) Set(v string) error { + switch v { + case `CAN_MANAGE`, `CAN_USE`, `IS_OWNER`: + *f = AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CAN_MANAGE", "CAN_USE", "IS_OWNER"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission) Values() []AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission { + return []AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission{ + AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionCanManage, + AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionCanUse, + AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionIsOwner, + } +} + +// Type always returns AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission) Type() string { + return "AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission" +} + +type AppManifestAppResourceUcSecurableSpec struct { + Permission AppManifestAppResourceUcSecurableSpecUcSecurablePermission `json:"permission"` + + SecurableType AppManifestAppResourceUcSecurableSpecUcSecurableType `json:"securable_type"` +} + +type AppManifestAppResourceUcSecurableSpecUcSecurablePermission string + +const AppManifestAppResourceUcSecurableSpecUcSecurablePermissionManage AppManifestAppResourceUcSecurableSpecUcSecurablePermission = `MANAGE` + +const AppManifestAppResourceUcSecurableSpecUcSecurablePermissionReadVolume AppManifestAppResourceUcSecurableSpecUcSecurablePermission = `READ_VOLUME` + +const AppManifestAppResourceUcSecurableSpecUcSecurablePermissionWriteVolume AppManifestAppResourceUcSecurableSpecUcSecurablePermission = `WRITE_VOLUME` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceUcSecurableSpecUcSecurablePermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceUcSecurableSpecUcSecurablePermission) Set(v string) error { + switch v { + case `MANAGE`, `READ_VOLUME`, `WRITE_VOLUME`: + *f = AppManifestAppResourceUcSecurableSpecUcSecurablePermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "MANAGE", "READ_VOLUME", "WRITE_VOLUME"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceUcSecurableSpecUcSecurablePermission. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceUcSecurableSpecUcSecurablePermission) Values() []AppManifestAppResourceUcSecurableSpecUcSecurablePermission { + return []AppManifestAppResourceUcSecurableSpecUcSecurablePermission{ + AppManifestAppResourceUcSecurableSpecUcSecurablePermissionManage, + AppManifestAppResourceUcSecurableSpecUcSecurablePermissionReadVolume, + AppManifestAppResourceUcSecurableSpecUcSecurablePermissionWriteVolume, + } +} + +// Type always returns AppManifestAppResourceUcSecurableSpecUcSecurablePermission to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceUcSecurableSpecUcSecurablePermission) Type() string { + return "AppManifestAppResourceUcSecurableSpecUcSecurablePermission" +} + +type AppManifestAppResourceUcSecurableSpecUcSecurableType string + +const AppManifestAppResourceUcSecurableSpecUcSecurableTypeVolume AppManifestAppResourceUcSecurableSpecUcSecurableType = `VOLUME` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceUcSecurableSpecUcSecurableType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceUcSecurableSpecUcSecurableType) Set(v string) error { + switch v { + case `VOLUME`: + *f = AppManifestAppResourceUcSecurableSpecUcSecurableType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "VOLUME"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceUcSecurableSpecUcSecurableType. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceUcSecurableSpecUcSecurableType) Values() []AppManifestAppResourceUcSecurableSpecUcSecurableType { + return []AppManifestAppResourceUcSecurableSpecUcSecurableType{ + AppManifestAppResourceUcSecurableSpecUcSecurableTypeVolume, + } +} + +// Type always returns AppManifestAppResourceUcSecurableSpecUcSecurableType to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceUcSecurableSpecUcSecurableType) Type() string { + return "AppManifestAppResourceUcSecurableSpecUcSecurableType" +} + type AppPermission struct { Inherited bool `json:"inherited,omitempty"` @@ -860,11 +1184,49 @@ func (s CreateAppRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateCustomTemplateRequest struct { + Template CustomTemplate `json:"template"` +} + +type CustomTemplate struct { + Creator string `json:"creator,omitempty"` + // The description of the template. + Description string `json:"description,omitempty"` + // The Git provider of the template. + GitProvider string `json:"git_provider"` + // The Git repository URL that the template resides in. + GitRepo string `json:"git_repo"` + // The manifest of the template. It defines fields and default values when + // installing the template. + Manifest AppManifest `json:"manifest"` + // The name of the template. It must contain only alphanumeric characters, + // hyphens, underscores, and whitespaces. It must be unique within the + // workspace. + Name string `json:"name"` + // The path to the template within the Git repository. + Path string `json:"path"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CustomTemplate) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CustomTemplate) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type DeleteAppRequest struct { // The name of the app. Name string `json:"-" url:"-"` } +type DeleteCustomTemplateRequest struct { + // The name of the custom template. + Name string `json:"-" url:"-"` +} + type GetAppDeploymentRequest struct { // The name of the app. AppName string `json:"-" url:"-"` @@ -892,6 +1254,11 @@ type GetAppRequest struct { Name string `json:"-" url:"-"` } +type GetCustomTemplateRequest struct { + // The name of the custom template. + Name string `json:"-" url:"-"` +} + type ListAppDeploymentsRequest struct { // The name of the app. AppName string `json:"-" url:"-"` @@ -963,6 +1330,41 @@ func (s ListAppsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListCustomTemplatesRequest struct { + // Upper bound for items returned. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page of custom templates. Requests + // first page if absent. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListCustomTemplatesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListCustomTemplatesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListCustomTemplatesResponse struct { + // Pagination token to request the next page of custom templates. + NextPageToken string `json:"next_page_token,omitempty"` + + Templates []CustomTemplate `json:"templates,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListCustomTemplatesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListCustomTemplatesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type StartAppRequest struct { // The name of the app. Name string `json:"-" url:"-"` @@ -979,3 +1381,12 @@ type UpdateAppRequest struct { // characters and hyphens. It must be unique within the workspace. Name string `json:"-" url:"-"` } + +type UpdateCustomTemplateRequest struct { + // The name of the template. It must contain only alphanumeric characters, + // hyphens, underscores, and whitespaces. It must be unique within the + // workspace. + Name string `json:"-" url:"-"` + + Template CustomTemplate `json:"template"` +} diff --git a/service/billing/impl.go b/service/billing/impl.go index b4f232bee..87443851a 100755 --- a/service/billing/impl.go +++ b/service/billing/impl.go @@ -109,6 +109,7 @@ func (a *budgetPolicyImpl) Update(ctx context.Context, request UpdateBudgetPolic var budgetPolicy BudgetPolicy path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) queryParams := make(map[string]any) + if request.LimitConfig != nil { queryParams["limit_config"] = request.LimitConfig } diff --git a/service/catalog/api.go b/service/catalog/api.go index e887d9891..7ed747a68 100755 --- a/service/catalog/api.go +++ b/service/catalog/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Account Metastore Assignments, Account Metastores, Account Storage Credentials, Artifact Allowlists, Catalogs, Connections, Credentials, External Lineage, External Locations, External Metadata, Functions, Grants, Metastores, Model Versions, Online Tables, Policies, Quality Monitors, Registered Models, Resource Quotas, Schemas, Storage Credentials, System Schemas, Table Constraints, Tables, Temporary Path Credentials, Temporary Table Credentials, Volumes, Workspace Bindings, etc. +// These APIs allow you to manage Account Metastore Assignments, Account Metastores, Account Storage Credentials, Artifact Allowlists, Catalogs, Connections, Credentials, Entity Tag Assignments, External Lineage, External Locations, External Metadata, Functions, Grants, Metastores, Model Versions, Online Tables, Policies, Quality Monitors, Registered Models, Resource Quotas, Rfa, Schemas, Storage Credentials, System Schemas, Table Constraints, Tables, Temporary Path Credentials, Temporary Table Credentials, Volumes, Workspace Bindings, etc. package catalog import ( @@ -596,6 +596,78 @@ func (a *CredentialsAPI) GetCredentialByNameArg(ctx context.Context, nameArg str }) } +type EntityTagAssignmentsInterface interface { + + // Creates a tag assignment for an Unity Catalog entity. + // + // To add tags to Unity Catalog entities, you must own the entity or have the + // following privileges: - **APPLY TAG** on the entity - **USE SCHEMA** on the + // entity's parent schema - **USE CATALOG** on the entity's parent catalog + // + // To add a governed tag to Unity Catalog entities, you must also have the + // **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy + // permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Create(ctx context.Context, request CreateEntityTagAssignmentRequest) (*EntityTagAssignment, error) + + // Deletes a tag assignment for an Unity Catalog entity by its key. + // + // To delete tags from Unity Catalog entities, you must own the entity or have + // the following privileges: - **APPLY TAG** on the entity - **USE_SCHEMA** on + // the entity's parent schema - **USE_CATALOG** on the entity's parent catalog + // + // To delete a governed tag from Unity Catalog entities, you must also have the + // **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy + // permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Delete(ctx context.Context, request DeleteEntityTagAssignmentRequest) error + + // Gets a tag assignment for an Unity Catalog entity by tag key. + Get(ctx context.Context, request GetEntityTagAssignmentRequest) (*EntityTagAssignment, error) + + // List tag assignments for an Unity Catalog entity + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context, request ListEntityTagAssignmentsRequest) listing.Iterator[EntityTagAssignment] + + // List tag assignments for an Unity Catalog entity + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context, request ListEntityTagAssignmentsRequest) ([]EntityTagAssignment, error) + + // Updates an existing tag assignment for an Unity Catalog entity. + // + // To update tags to Unity Catalog entities, you must own the entity or have the + // following privileges: - **APPLY TAG** on the entity - **USE SCHEMA** on the + // entity's parent schema - **USE CATALOG** on the entity's parent catalog + // + // To update a governed tag to Unity Catalog entities, you must also have the + // **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy + // permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Update(ctx context.Context, request UpdateEntityTagAssignmentRequest) (*EntityTagAssignment, error) +} + +func NewEntityTagAssignments(client *client.DatabricksClient) *EntityTagAssignmentsAPI { + return &EntityTagAssignmentsAPI{ + entityTagAssignmentsImpl: entityTagAssignmentsImpl{ + client: client, + }, + } +} + +// Tags are attributes that include keys and optional values that you can use to +// organize and categorize entities in Unity Catalog. Entity tagging is +// currently supported on catalogs, schemas, tables (including views), columns, +// volumes. With these APIs, users can create, update, delete, and list tag +// assignments across Unity Catalog entities +type EntityTagAssignmentsAPI struct { + entityTagAssignmentsImpl +} + type ExternalLineageInterface interface { // Creates an external lineage relationship between a Databricks or external @@ -2002,6 +2074,63 @@ type ResourceQuotasAPI struct { resourceQuotasImpl } +type RfaInterface interface { + + // Creates access requests for Unity Catalog permissions for a specified + // principal on a securable object. This Batch API can take in multiple + // principals, securable objects, and permissions as the input and returns the + // access request destinations for each. Principals must be unique across the + // API call. + // + // The supported securable types are: "metastore", "catalog", "schema", "table", + // "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + BatchCreateAccessRequests(ctx context.Context, request BatchCreateAccessRequestsRequest) (*BatchCreateAccessRequestsResponse, error) + + // Gets an array of access request destinations for the specified securable. Any + // caller can see URL destinations or the destinations on the metastore. + // Otherwise, only those with **BROWSE** permissions on the securable can see + // destinations. + // + // The supported securable types are: "metastore", "catalog", "schema", "table", + // "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + GetAccessRequestDestinations(ctx context.Context, request GetAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) + + // Updates the access request destinations for the given securable. The caller + // must be a metastore admin, the owner of the securable, or a user that has the + // **MANAGE** privilege on the securable in order to assign destinations. + // Destinations cannot be updated for securables underneath schemas (tables, + // volumes, functions, and models). For these securable types, destinations are + // inherited from the parent securable. A maximum of 5 emails and 5 external + // notification destinations (Slack, Microsoft Teams, and Generic Webhook + // destinations) can be assigned to a securable. If a URL destination is + // assigned, no other destinations can be set. + // + // The supported securable types are: "metastore", "catalog", "schema", "table", + // "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + UpdateAccessRequestDestinations(ctx context.Context, request UpdateAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) +} + +func NewRfa(client *client.DatabricksClient) *RfaAPI { + return &RfaAPI{ + rfaImpl: rfaImpl{ + client: client, + }, + } +} + +// Request for Access enables customers to request access to and manage access +// request destinations for Unity Catalog securables. +// +// These APIs provide a standardized way to update, get, and request to access +// request destinations. Fine-grained authorization ensures that only users with +// appropriate permissions can manage access request destinations. +type RfaAPI struct { + rfaImpl +} + type SchemasInterface interface { // Creates a new schema for catalog in the Metastore. The caller must be a diff --git a/service/catalog/impl.go b/service/catalog/impl.go index 22a7067cb..c62c2c01b 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -586,6 +586,97 @@ func (a *credentialsImpl) ValidateCredential(ctx context.Context, request Valida return &validateCredentialResponse, err } +// unexported type that holds implementations of just EntityTagAssignments API methods +type entityTagAssignmentsImpl struct { + client *client.DatabricksClient +} + +func (a *entityTagAssignmentsImpl) Create(ctx context.Context, request CreateEntityTagAssignmentRequest) (*EntityTagAssignment, error) { + var entityTagAssignment EntityTagAssignment + path := "/api/2.1/unity-catalog/entity-tag-assignments" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.TagAssignment, &entityTagAssignment) + return &entityTagAssignment, err +} + +func (a *entityTagAssignmentsImpl) Delete(ctx context.Context, request DeleteEntityTagAssignmentRequest) error { + path := fmt.Sprintf("/api/2.1/unity-catalog/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityName, request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *entityTagAssignmentsImpl) Get(ctx context.Context, request GetEntityTagAssignmentRequest) (*EntityTagAssignment, error) { + var entityTagAssignment EntityTagAssignment + path := fmt.Sprintf("/api/2.1/unity-catalog/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityName, request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &entityTagAssignment) + return &entityTagAssignment, err +} + +// List tag assignments for an Unity Catalog entity +func (a *entityTagAssignmentsImpl) List(ctx context.Context, request ListEntityTagAssignmentsRequest) listing.Iterator[EntityTagAssignment] { + + getNextPage := func(ctx context.Context, req ListEntityTagAssignmentsRequest) (*ListEntityTagAssignmentsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListEntityTagAssignmentsResponse) []EntityTagAssignment { + return resp.TagAssignments + } + getNextReq := func(resp *ListEntityTagAssignmentsResponse) *ListEntityTagAssignmentsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List tag assignments for an Unity Catalog entity +func (a *entityTagAssignmentsImpl) ListAll(ctx context.Context, request ListEntityTagAssignmentsRequest) ([]EntityTagAssignment, error) { + iterator := a.List(ctx, request) + return listing.ToSlice[EntityTagAssignment](ctx, iterator) +} + +func (a *entityTagAssignmentsImpl) internalList(ctx context.Context, request ListEntityTagAssignmentsRequest) (*ListEntityTagAssignmentsResponse, error) { + var listEntityTagAssignmentsResponse ListEntityTagAssignmentsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/entity-tag-assignments/%v/%v/tags", request.EntityType, request.EntityName) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listEntityTagAssignmentsResponse) + return &listEntityTagAssignmentsResponse, err +} + +func (a *entityTagAssignmentsImpl) Update(ctx context.Context, request UpdateEntityTagAssignmentRequest) (*EntityTagAssignment, error) { + var entityTagAssignment EntityTagAssignment + path := fmt.Sprintf("/api/2.1/unity-catalog/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityName, request.TagKey) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.TagAssignment, &entityTagAssignment) + return &entityTagAssignment, err +} + // unexported type that holds implementations of just ExternalLineage API methods type externalLineageImpl struct { client *client.DatabricksClient @@ -658,6 +749,7 @@ func (a *externalLineageImpl) UpdateExternalLineageRelationship(ctx context.Cont var externalLineageRelationship ExternalLineageRelationship path := "/api/2.0/lineage-tracking/external-lineage" queryParams := make(map[string]any) + if request.UpdateMask != "" { queryParams["update_mask"] = request.UpdateMask } @@ -851,6 +943,7 @@ func (a *externalMetadataImpl) UpdateExternalMetadata(ctx context.Context, reque var externalMetadata ExternalMetadata path := fmt.Sprintf("/api/2.0/lineage-tracking/external-metadata/%v", request.Name) queryParams := make(map[string]any) + if request.UpdateMask != "" { queryParams["update_mask"] = request.UpdateMask } @@ -1363,6 +1456,7 @@ func (a *policiesImpl) UpdatePolicy(ctx context.Context, request UpdatePolicyReq var policyInfo PolicyInfo path := fmt.Sprintf("/api/2.1/unity-catalog/policies/%v/%v/%v", request.OnSecurableType, request.OnSecurableFullname, request.Name) queryParams := make(map[string]any) + if request.UpdateMask != "" || slices.Contains(request.ForceSendFields, "UpdateMask") { queryParams["update_mask"] = request.UpdateMask } @@ -1657,6 +1751,47 @@ func (a *resourceQuotasImpl) internalListQuotas(ctx context.Context, request Lis return &listQuotasResponse, err } +// unexported type that holds implementations of just Rfa API methods +type rfaImpl struct { + client *client.DatabricksClient +} + +func (a *rfaImpl) BatchCreateAccessRequests(ctx context.Context, request BatchCreateAccessRequestsRequest) (*BatchCreateAccessRequestsResponse, error) { + var batchCreateAccessRequestsResponse BatchCreateAccessRequestsResponse + path := "/api/3.0/rfa/requests" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &batchCreateAccessRequestsResponse) + return &batchCreateAccessRequestsResponse, err +} + +func (a *rfaImpl) GetAccessRequestDestinations(ctx context.Context, request GetAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) { + var accessRequestDestinations AccessRequestDestinations + path := fmt.Sprintf("/api/3.0/rfa/destinations/%v/%v", request.SecurableType, request.FullName) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accessRequestDestinations) + return &accessRequestDestinations, err +} + +func (a *rfaImpl) UpdateAccessRequestDestinations(ctx context.Context, request UpdateAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) { + var accessRequestDestinations AccessRequestDestinations + path := "/api/3.0/rfa/destinations" + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.AccessRequestDestinations, &accessRequestDestinations) + return &accessRequestDestinations, err +} + // unexported type that holds implementations of just Schemas API methods type schemasImpl struct { client *client.DatabricksClient diff --git a/service/catalog/interface.go b/service/catalog/interface.go index 9a30b3763..811572c6d 100755 --- a/service/catalog/interface.go +++ b/service/catalog/interface.go @@ -251,6 +251,64 @@ type CredentialsService interface { ValidateCredential(ctx context.Context, request ValidateCredentialRequest) (*ValidateCredentialResponse, error) } +// Tags are attributes that include keys and optional values that you can use to +// organize and categorize entities in Unity Catalog. Entity tagging is +// currently supported on catalogs, schemas, tables (including views), columns, +// volumes. With these APIs, users can create, update, delete, and list tag +// assignments across Unity Catalog entities +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type EntityTagAssignmentsService interface { + + // Creates a tag assignment for an Unity Catalog entity. + // + // To add tags to Unity Catalog entities, you must own the entity or have + // the following privileges: - **APPLY TAG** on the entity - **USE SCHEMA** + // on the entity's parent schema - **USE CATALOG** on the entity's parent + // catalog + // + // To add a governed tag to Unity Catalog entities, you must also have the + // **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag + // policy permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Create(ctx context.Context, request CreateEntityTagAssignmentRequest) (*EntityTagAssignment, error) + + // Deletes a tag assignment for an Unity Catalog entity by its key. + // + // To delete tags from Unity Catalog entities, you must own the entity or + // have the following privileges: - **APPLY TAG** on the entity - + // **USE_SCHEMA** on the entity's parent schema - **USE_CATALOG** on the + // entity's parent catalog + // + // To delete a governed tag from Unity Catalog entities, you must also have + // the **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage + // tag policy permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Delete(ctx context.Context, request DeleteEntityTagAssignmentRequest) error + + // Gets a tag assignment for an Unity Catalog entity by tag key. + Get(ctx context.Context, request GetEntityTagAssignmentRequest) (*EntityTagAssignment, error) + + // List tag assignments for an Unity Catalog entity + List(ctx context.Context, request ListEntityTagAssignmentsRequest) (*ListEntityTagAssignmentsResponse, error) + + // Updates an existing tag assignment for an Unity Catalog entity. + // + // To update tags to Unity Catalog entities, you must own the entity or have + // the following privileges: - **APPLY TAG** on the entity - **USE SCHEMA** + // on the entity's parent schema - **USE CATALOG** on the entity's parent + // catalog + // + // To update a governed tag to Unity Catalog entities, you must also have + // the **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage + // tag policy permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Update(ctx context.Context, request UpdateEntityTagAssignmentRequest) (*EntityTagAssignment, error) +} + // External Lineage APIs enable defining and managing lineage relationships // between Databricks objects and external systems. These APIs allow users to // capture data flows connecting Databricks tables, models, and file paths with @@ -886,6 +944,53 @@ type ResourceQuotasService interface { ListQuotas(ctx context.Context, request ListQuotasRequest) (*ListQuotasResponse, error) } +// Request for Access enables customers to request access to and manage access +// request destinations for Unity Catalog securables. +// +// These APIs provide a standardized way to update, get, and request to access +// request destinations. Fine-grained authorization ensures that only users with +// appropriate permissions can manage access request destinations. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type RfaService interface { + + // Creates access requests for Unity Catalog permissions for a specified + // principal on a securable object. This Batch API can take in multiple + // principals, securable objects, and permissions as the input and returns + // the access request destinations for each. Principals must be unique + // across the API call. + // + // The supported securable types are: "metastore", "catalog", "schema", + // "table", "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + BatchCreateAccessRequests(ctx context.Context, request BatchCreateAccessRequestsRequest) (*BatchCreateAccessRequestsResponse, error) + + // Gets an array of access request destinations for the specified securable. + // Any caller can see URL destinations or the destinations on the metastore. + // Otherwise, only those with **BROWSE** permissions on the securable can + // see destinations. + // + // The supported securable types are: "metastore", "catalog", "schema", + // "table", "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + GetAccessRequestDestinations(ctx context.Context, request GetAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) + + // Updates the access request destinations for the given securable. The + // caller must be a metastore admin, the owner of the securable, or a user + // that has the **MANAGE** privilege on the securable in order to assign + // destinations. Destinations cannot be updated for securables underneath + // schemas (tables, volumes, functions, and models). For these securable + // types, destinations are inherited from the parent securable. A maximum of + // 5 emails and 5 external notification destinations (Slack, Microsoft + // Teams, and Generic Webhook destinations) can be assigned to a securable. + // If a URL destination is assigned, no other destinations can be set. + // + // The supported securable types are: "metastore", "catalog", "schema", + // "table", "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + UpdateAccessRequestDestinations(ctx context.Context, request UpdateAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) +} + // A schema (also called a database) is the second layer of Unity Catalog’s // three-level namespace. A schema organizes tables, views and functions. To // access (or list) a table or view in a schema, users must have the USE_SCHEMA diff --git a/service/catalog/model.go b/service/catalog/model.go index cd1050a43..ac1e13360 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -8,6 +8,28 @@ import ( "github.com/databricks/databricks-sdk-go/marshal" ) +type AccessRequestDestinations struct { + // Indicates whether any destinations are hidden from the caller due to a + // lack of permissions. This value is true if the caller does not have + // permission to see all destinations. + AreAnyDestinationsHidden bool `json:"are_any_destinations_hidden,omitempty"` + // The access request destinations for the securable. + Destinations []NotificationDestination `json:"destinations"` + // The securable for which the access request destinations are being + // retrieved. + Securable Securable `json:"securable"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AccessRequestDestinations) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AccessRequestDestinations) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type AccountsCreateMetastore struct { MetastoreInfo *CreateMetastore `json:"metastore_info,omitempty"` } @@ -383,6 +405,21 @@ func (s AzureUserDelegationSas) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type BatchCreateAccessRequestsRequest struct { + // A list of individual access requests, where each request corresponds to a + // set of permissions being requested on a list of securables for a + // specified principal. + // + // At most 30 requests per API call. + Requests []CreateAccessRequest `json:"requests,omitempty"` +} + +type BatchCreateAccessRequestsResponse struct { + // The access request destinations for each securable object the principal + // requested. + Responses []CreateAccessRequestResponse `json:"responses,omitempty"` +} + type CancelRefreshRequest struct { RefreshId int64 `json:"-" url:"-"` // UC table name in format `catalog.schema.table_name`. table_name is case @@ -401,10 +438,14 @@ type CatalogInfo struct { Comment string `json:"comment,omitempty"` // The name of the connection to an external data source. ConnectionName string `json:"connection_name,omitempty"` + // Status of conversion of FOREIGN catalog to UC Native catalog. + ConversionInfo *ConversionInfo `json:"conversion_info,omitempty"` // Time at which this catalog was created, in epoch milliseconds. CreatedAt int64 `json:"created_at,omitempty"` // Username of catalog creator. CreatedBy string `json:"created_by,omitempty"` + // Disaster Recovery replication state snapshot. + DrReplicationInfo *DrReplicationInfo `json:"dr_replication_info,omitempty"` EffectivePredictiveOptimizationFlag *EffectivePredictiveOptimizationFlag `json:"effective_predictive_optimization_flag,omitempty"` // Whether predictive optimization should be enabled for this object and @@ -932,11 +973,94 @@ func (s ContinuousUpdateStatus) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Status of conversion of FOREIGN entity into UC Native entity. +type ConversionInfo struct { + // The conversion state of the resource. + State ConversionInfoState `json:"state,omitempty"` +} + +type ConversionInfoState string + +const ConversionInfoStateCompleted ConversionInfoState = `COMPLETED` + +const ConversionInfoStateInProgress ConversionInfoState = `IN_PROGRESS` + +// String representation for [fmt.Print] +func (f *ConversionInfoState) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ConversionInfoState) Set(v string) error { + switch v { + case `COMPLETED`, `IN_PROGRESS`: + *f = ConversionInfoState(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "COMPLETED", "IN_PROGRESS"`, v) + } +} + +// Values returns all possible values for ConversionInfoState. +// +// There is no guarantee on the order of the values in the slice. +func (f *ConversionInfoState) Values() []ConversionInfoState { + return []ConversionInfoState{ + ConversionInfoStateCompleted, + ConversionInfoStateInProgress, + } +} + +// Type always returns ConversionInfoState to satisfy [pflag.Value] interface +func (f *ConversionInfoState) Type() string { + return "ConversionInfoState" +} + +type CreateAccessRequest struct { + // Optional. The principal this request is for. Empty `behalf_of` defaults + // to the requester's identity. + // + // Principals must be unique across the API call. + BehalfOf *Principal `json:"behalf_of,omitempty"` + // Optional. Comment associated with the request. + // + // At most 200 characters, can only contain lowercase/uppercase letters + // (a-z, A-Z), numbers (0-9), punctuation, and spaces. + Comment string `json:"comment,omitempty"` + // List of securables and their corresponding requested UC privileges. + // + // At most 30 securables can be requested for a principal per batched call. + // Each securable can only be requested once per principal. + SecurablePermissions []SecurablePermissions `json:"securable_permissions,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateAccessRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateAccessRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateAccessRequestResponse struct { + // The principal the request was made on behalf of. + BehalfOf *Principal `json:"behalf_of,omitempty"` + // The access request destinations for all the securables the principal + // requested. + RequestDestinations []AccessRequestDestinations `json:"request_destinations,omitempty"` +} + type CreateCatalog struct { // User-provided free-form text description. Comment string `json:"comment,omitempty"` // The name of the connection to an external data source. ConnectionName string `json:"connection_name,omitempty"` + // Status of conversion of FOREIGN catalog to UC Native catalog. + ConversionInfo *ConversionInfo `json:"conversion_info,omitempty"` + // Disaster Recovery replication state snapshot. + DrReplicationInfo *DrReplicationInfo `json:"dr_replication_info,omitempty"` // Name of catalog. Name string `json:"name"` // A map of key-value properties attached to the securable. @@ -1026,6 +1150,10 @@ func (s CreateCredentialRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateEntityTagAssignmentRequest struct { + TagAssignment EntityTagAssignment `json:"tag_assignment"` +} + type CreateExternalLineageRelationshipRequest struct { ExternalLineageRelationship CreateRequestExternalLineage `json:"external_lineage_relationship"` } @@ -1043,7 +1171,8 @@ type CreateExternalLocation struct { // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. Fallback bool `json:"fallback,omitempty"` - // File event queue settings. + // File event queue settings. If `enable_file_events` is `true`, must be + // defined and have exactly one of the documented properties. FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` // Name of the external location. Name string `json:"name"` @@ -1991,6 +2120,16 @@ func (s DeleteCredentialRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type DeleteEntityTagAssignmentRequest struct { + // The fully qualified name of the entity to which the tag is assigned + EntityName string `json:"-" url:"-"` + // The type of the entity to which the tag is assigned. Allowed values are: + // catalogs, schemas, tables, columns, volumes. + EntityType string `json:"-" url:"-"` + // Required. The key of the tag to delete + TagKey string `json:"-" url:"-"` +} + type DeleteExternalLineageRelationshipRequest struct { ExternalLineageRelationship DeleteRequestExternalLineage `json:"-" url:"external_lineage_relationship"` } @@ -2229,6 +2368,52 @@ type DependencyList struct { Dependencies []Dependency `json:"dependencies,omitempty"` } +type DestinationType string + +const DestinationTypeEmail DestinationType = `EMAIL` + +const DestinationTypeGenericWebhook DestinationType = `GENERIC_WEBHOOK` + +const DestinationTypeMicrosoftTeams DestinationType = `MICROSOFT_TEAMS` + +const DestinationTypeSlack DestinationType = `SLACK` + +const DestinationTypeUrl DestinationType = `URL` + +// String representation for [fmt.Print] +func (f *DestinationType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DestinationType) Set(v string) error { + switch v { + case `EMAIL`, `GENERIC_WEBHOOK`, `MICROSOFT_TEAMS`, `SLACK`, `URL`: + *f = DestinationType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "EMAIL", "GENERIC_WEBHOOK", "MICROSOFT_TEAMS", "SLACK", "URL"`, v) + } +} + +// Values returns all possible values for DestinationType. +// +// There is no guarantee on the order of the values in the slice. +func (f *DestinationType) Values() []DestinationType { + return []DestinationType{ + DestinationTypeEmail, + DestinationTypeGenericWebhook, + DestinationTypeMicrosoftTeams, + DestinationTypeSlack, + DestinationTypeUrl, + } +} + +// Type always returns DestinationType to satisfy [pflag.Value] interface +func (f *DestinationType) Type() string { + return "DestinationType" +} + type DisableRequest struct { // The metastore ID under which the system schema lives. MetastoreId string `json:"-" url:"-"` @@ -2236,6 +2421,48 @@ type DisableRequest struct { SchemaName string `json:"-" url:"-"` } +// Metadata related to Disaster Recovery. +type DrReplicationInfo struct { + Status DrReplicationStatus `json:"status,omitempty"` +} + +type DrReplicationStatus string + +const DrReplicationStatusDrReplicationStatusPrimary DrReplicationStatus = `DR_REPLICATION_STATUS_PRIMARY` + +const DrReplicationStatusDrReplicationStatusSecondary DrReplicationStatus = `DR_REPLICATION_STATUS_SECONDARY` + +// String representation for [fmt.Print] +func (f *DrReplicationStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DrReplicationStatus) Set(v string) error { + switch v { + case `DR_REPLICATION_STATUS_PRIMARY`, `DR_REPLICATION_STATUS_SECONDARY`: + *f = DrReplicationStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DR_REPLICATION_STATUS_PRIMARY", "DR_REPLICATION_STATUS_SECONDARY"`, v) + } +} + +// Values returns all possible values for DrReplicationStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *DrReplicationStatus) Values() []DrReplicationStatus { + return []DrReplicationStatus{ + DrReplicationStatusDrReplicationStatusPrimary, + DrReplicationStatusDrReplicationStatusSecondary, + } +} + +// Type always returns DrReplicationStatus to satisfy [pflag.Value] interface +func (f *DrReplicationStatus) Type() string { + return "DrReplicationStatus" +} + type EffectivePermissionsList struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next @@ -2423,6 +2650,29 @@ type EncryptionDetails struct { SseEncryptionDetails *SseEncryptionDetails `json:"sse_encryption_details,omitempty"` } +// Represents a tag assignment to an entity +type EntityTagAssignment struct { + // The fully qualified name of the entity to which the tag is assigned + EntityName string `json:"entity_name"` + // The type of the entity to which the tag is assigned. Allowed values are: + // catalogs, schemas, tables, columns, volumes. + EntityType string `json:"entity_type"` + // The key of the tag + TagKey string `json:"tag_key"` + // The value of the tag + TagValue string `json:"tag_value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *EntityTagAssignment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s EntityTagAssignment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type EnvironmentSettings struct { EnvironmentVersion string `json:"environment_version,omitempty"` @@ -2683,7 +2933,8 @@ type ExternalLocationInfo struct { // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. Fallback bool `json:"fallback,omitempty"` - // File event queue settings. + // File event queue settings. If `enable_file_events` is `true`, must be + // defined and have exactly one of the documented properties. FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` IsolationMode IsolationMode `json:"isolation_mode,omitempty"` @@ -3344,6 +3595,13 @@ func (s GenerateTemporaryTableCredentialResponse) MarshalJSON() ([]byte, error) return marshal.Marshal(s) } +type GetAccessRequestDestinationsRequest struct { + // The full name of the securable. + FullName string `json:"-" url:"-"` + // The type of the securable. + SecurableType string `json:"-" url:"-"` +} + type GetAccountMetastoreAssignmentRequest struct { // Workspace ID. WorkspaceId int64 `json:"-" url:"-"` @@ -3481,6 +3739,16 @@ func (s GetEffectiveRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type GetEntityTagAssignmentRequest struct { + // The fully qualified name of the entity to which the tag is assigned + EntityName string `json:"-" url:"-"` + // The type of the entity to which the tag is assigned. Allowed values are: + // catalogs, schemas, tables, columns, volumes. + EntityType string `json:"-" url:"-"` + // Required. The key of the tag + TagKey string `json:"-" url:"-"` +} + type GetExternalLocationRequest struct { // Whether to include external locations in the response for which the // principal can only access selective metadata for @@ -3525,6 +3793,9 @@ func (s GetFunctionRequest) MarshalJSON() ([]byte, error) { type GetGrantRequest struct { // Full name of securable. FullName string `json:"-" url:"-"` + // Optional. If true, also return privilege assignments whose principals + // have been deleted. + IncludeDeletedPrincipals bool `json:"-" url:"include_deleted_principals,omitempty"` // Specifies the maximum number of privileges to return (page length). Every // PrivilegeAssignment present in a single page response is guaranteed to // contain all the privileges granted on the requested Securable for the @@ -4015,6 +4286,45 @@ func (s ListCredentialsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListEntityTagAssignmentsRequest struct { + // The fully qualified name of the entity to which the tag is assigned + EntityName string `json:"-" url:"-"` + // The type of the entity to which the tag is assigned. Allowed values are: + // catalogs, schemas, tables, columns, volumes. + EntityType string `json:"-" url:"-"` + // Optional. Maximum number of tag assignments to return in a single page + MaxResults int `json:"-" url:"max_results,omitempty"` + // Optional. Pagination token to retrieve the next page of results + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListEntityTagAssignmentsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListEntityTagAssignmentsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListEntityTagAssignmentsResponse struct { + // Optional. Pagination token for retrieving the next page of results + NextPageToken string `json:"next_page_token,omitempty"` + // The list of tag assignments + TagAssignments []EntityTagAssignment `json:"tag_assignments,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListEntityTagAssignmentsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListEntityTagAssignmentsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListExternalLineageRelationshipsRequest struct { // The lineage direction to filter on. LineageDirection LineageDirection `json:"-" url:"lineage_direction"` @@ -5434,6 +5744,33 @@ type NamedTableConstraint struct { Name string `json:"name"` } +type NotificationDestination struct { + // The identifier for the destination. This is the email address for EMAIL + // destinations, the URL for URL destinations, or the unique Databricks + // notification destination ID for all other external destinations. + DestinationId string `json:"destination_id,omitempty"` + // The type of the destination. + DestinationType DestinationType `json:"destination_type,omitempty"` + // This field is used to denote whether the destination is the email of the + // owner of the securable object. The special destination cannot be assigned + // to a securable and only represents the default destination of the + // securable. The securable types that support default special destinations + // are: "catalog", "external_location", "connection", "credential", and + // "metastore". The **destination_type** of a **special_destination** is + // always EMAIL. + SpecialDestination SpecialDestination `json:"special_destination,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *NotificationDestination) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s NotificationDestination) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Online Table information. type OnlineTable struct { // Full three-part (catalog, schema, table) name of the table. @@ -5792,6 +6129,16 @@ type PermissionsChange struct { // The principal whose privileges we are changing. Only one of principal or // principal_id should be specified, never both at the same time. Principal string `json:"principal,omitempty"` + // An opaque internal ID that identifies the principal whose privileges + // should be removed. + // + // This field is intended for removing privileges associated with a deleted + // user. When set, only the entries specified in the remove field are + // processed; any entries in the add field will be rejected. + // + // Only one of principal or principal_id should be specified, never both at + // the same time. + PrincipalId int64 `json:"principal_id,omitempty"` // The set of privileges to remove. Remove []Privilege `json:"remove,omitempty"` @@ -5847,24 +6194,24 @@ type PolicyInfo struct { // Optional list of user or group names that should be excluded from the // policy. ExceptPrincipals []string `json:"except_principals,omitempty"` - // Type of securables that the policy should take effect on. Only `table` is + // Type of securables that the policy should take effect on. Only `TABLE` is // supported at this moment. Required on create and optional on update. ForSecurableType SecurableType `json:"for_securable_type"` // Unique identifier of the policy. This field is output only and is // generated by the system. Id string `json:"id,omitempty"` // Optional list of condition expressions used to match table columns. Only - // valid when `for_securable_type` is `table`. When specified, the policy + // valid when `for_securable_type` is `TABLE`. When specified, the policy // only applies to tables whose columns satisfy all match conditions. MatchColumns []MatchColumn `json:"match_columns,omitempty"` - // Name of the policy. Required on create and ignored on update. To update - // the name, use the `new_name` field. + // Name of the policy. Required on create and optional on update. To rename + // the policy, set `name` to a different value on update. Name string `json:"name,omitempty"` // Full name of the securable on which the policy is defined. Required on // create and ignored on update. OnSecurableFullname string `json:"on_securable_fullname,omitempty"` - // Type of the securable on which the policy is defined. Only `catalog`, - // `schema` and `table` are supported at this moment. Required on create and + // Type of the securable on which the policy is defined. Only `CATALOG`, + // `SCHEMA` and `TABLE` are supported at this moment. Required on create and // ignored on update. OnSecurableType SecurableType `json:"on_securable_type,omitempty"` // Type of the policy. Required on create and ignored on update. @@ -5954,6 +6301,63 @@ func (s PrimaryKeyConstraint) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type Principal struct { + // Databricks user, group or service principal ID. + Id string `json:"id,omitempty"` + + PrincipalType PrincipalType `json:"principal_type,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Principal) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Principal) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type PrincipalType string + +const PrincipalTypeGroupPrincipal PrincipalType = `GROUP_PRINCIPAL` + +const PrincipalTypeServicePrincipal PrincipalType = `SERVICE_PRINCIPAL` + +const PrincipalTypeUserPrincipal PrincipalType = `USER_PRINCIPAL` + +// String representation for [fmt.Print] +func (f *PrincipalType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *PrincipalType) Set(v string) error { + switch v { + case `GROUP_PRINCIPAL`, `SERVICE_PRINCIPAL`, `USER_PRINCIPAL`: + *f = PrincipalType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "GROUP_PRINCIPAL", "SERVICE_PRINCIPAL", "USER_PRINCIPAL"`, v) + } +} + +// Values returns all possible values for PrincipalType. +// +// There is no guarantee on the order of the values in the slice. +func (f *PrincipalType) Values() []PrincipalType { + return []PrincipalType{ + PrincipalTypeGroupPrincipal, + PrincipalTypeServicePrincipal, + PrincipalTypeUserPrincipal, + } +} + +// Type always returns PrincipalType to satisfy [pflag.Value] interface +func (f *PrincipalType) Type() string { + return "PrincipalType" +} + type Privilege string const PrivilegeAccess Privilege = `ACCESS` @@ -6136,6 +6540,9 @@ type PrivilegeAssignment struct { // The principal (user email address or group name). For deleted principals, // `principal` is empty while `principal_id` is populated. Principal string `json:"principal,omitempty"` + // Unique identifier of the principal. For active principals, both + // `principal` and `principal_id` are present. + PrincipalId int64 `json:"principal_id,omitempty"` // The privileges assigned to the principal. Privileges []Privilege `json:"privileges,omitempty"` @@ -6448,6 +6855,30 @@ func (s SchemaInfo) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Generic definition of a securable, which is uniquely defined in a metastore +// by its type and full name. +type Securable struct { + // Required. The full name of the catalog/schema/table. Optional if + // resource_name is present. + FullName string `json:"full_name,omitempty"` + // Optional. The name of the Share object that contains the securable when + // the securable is getting shared in D2D Delta Sharing. + ProviderShare string `json:"provider_share,omitempty"` + // Required. The type of securable (catalog/schema/table). Optional if + // resource_name is present. + Type SecurableType `json:"type,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Securable) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Securable) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type SecurableKind string const SecurableKindTableDbStorage SecurableKind = `TABLE_DB_STORAGE` @@ -6468,6 +6899,8 @@ const SecurableKindTableDeltaUniformHudiExternal SecurableKind = `TABLE_DELTA_UN const SecurableKindTableDeltaUniformIcebergExternal SecurableKind = `TABLE_DELTA_UNIFORM_ICEBERG_EXTERNAL` +const SecurableKindTableDeltaUniformIcebergForeignDeltasharing SecurableKind = `TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_DELTASHARING` + const SecurableKindTableDeltaUniformIcebergForeignHiveMetastoreExternal SecurableKind = `TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_HIVE_METASTORE_EXTERNAL` const SecurableKindTableDeltaUniformIcebergForeignHiveMetastoreManaged SecurableKind = `TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_HIVE_METASTORE_MANAGED` @@ -6578,11 +7011,11 @@ func (f *SecurableKind) String() string { // Set raw string value and validate it against allowed values func (f *SecurableKind) Set(v string) error { switch v { - case `TABLE_DB_STORAGE`, `TABLE_DELTA`, `TABLE_DELTASHARING`, `TABLE_DELTASHARING_MUTABLE`, `TABLE_DELTA_EXTERNAL`, `TABLE_DELTA_ICEBERG_DELTASHARING`, `TABLE_DELTA_ICEBERG_MANAGED`, `TABLE_DELTA_UNIFORM_HUDI_EXTERNAL`, `TABLE_DELTA_UNIFORM_ICEBERG_EXTERNAL`, `TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_HIVE_METASTORE_EXTERNAL`, `TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_HIVE_METASTORE_MANAGED`, `TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_SNOWFLAKE`, `TABLE_EXTERNAL`, `TABLE_FEATURE_STORE`, `TABLE_FEATURE_STORE_EXTERNAL`, `TABLE_FOREIGN_BIGQUERY`, `TABLE_FOREIGN_DATABRICKS`, `TABLE_FOREIGN_DELTASHARING`, `TABLE_FOREIGN_HIVE_METASTORE`, `TABLE_FOREIGN_HIVE_METASTORE_DBFS_EXTERNAL`, `TABLE_FOREIGN_HIVE_METASTORE_DBFS_MANAGED`, `TABLE_FOREIGN_HIVE_METASTORE_DBFS_SHALLOW_CLONE_EXTERNAL`, `TABLE_FOREIGN_HIVE_METASTORE_DBFS_SHALLOW_CLONE_MANAGED`, `TABLE_FOREIGN_HIVE_METASTORE_DBFS_VIEW`, `TABLE_FOREIGN_HIVE_METASTORE_EXTERNAL`, `TABLE_FOREIGN_HIVE_METASTORE_MANAGED`, `TABLE_FOREIGN_HIVE_METASTORE_SHALLOW_CLONE_EXTERNAL`, `TABLE_FOREIGN_HIVE_METASTORE_SHALLOW_CLONE_MANAGED`, `TABLE_FOREIGN_HIVE_METASTORE_VIEW`, `TABLE_FOREIGN_MONGODB`, `TABLE_FOREIGN_MYSQL`, `TABLE_FOREIGN_NETSUITE`, `TABLE_FOREIGN_ORACLE`, `TABLE_FOREIGN_POSTGRESQL`, `TABLE_FOREIGN_REDSHIFT`, `TABLE_FOREIGN_SALESFORCE`, `TABLE_FOREIGN_SALESFORCE_DATA_CLOUD`, `TABLE_FOREIGN_SALESFORCE_DATA_CLOUD_FILE_SHARING`, `TABLE_FOREIGN_SALESFORCE_DATA_CLOUD_FILE_SHARING_VIEW`, `TABLE_FOREIGN_SNOWFLAKE`, `TABLE_FOREIGN_SQLDW`, `TABLE_FOREIGN_SQLSERVER`, `TABLE_FOREIGN_TERADATA`, `TABLE_FOREIGN_WORKDAY_RAAS`, `TABLE_ICEBERG_UNIFORM_MANAGED`, `TABLE_INTERNAL`, `TABLE_MANAGED_POSTGRESQL`, `TABLE_MATERIALIZED_VIEW`, `TABLE_MATERIALIZED_VIEW_DELTASHARING`, `TABLE_METRIC_VIEW`, `TABLE_ONLINE_VECTOR_INDEX_DIRECT`, `TABLE_ONLINE_VECTOR_INDEX_REPLICA`, `TABLE_ONLINE_VIEW`, `TABLE_STANDARD`, `TABLE_STREAMING_LIVE_TABLE`, `TABLE_STREAMING_LIVE_TABLE_DELTASHARING`, `TABLE_SYSTEM`, `TABLE_SYSTEM_DELTASHARING`, `TABLE_VIEW`, `TABLE_VIEW_DELTASHARING`: + case `TABLE_DB_STORAGE`, `TABLE_DELTA`, `TABLE_DELTASHARING`, `TABLE_DELTASHARING_MUTABLE`, `TABLE_DELTA_EXTERNAL`, `TABLE_DELTA_ICEBERG_DELTASHARING`, `TABLE_DELTA_ICEBERG_MANAGED`, `TABLE_DELTA_UNIFORM_HUDI_EXTERNAL`, `TABLE_DELTA_UNIFORM_ICEBERG_EXTERNAL`, `TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_DELTASHARING`, `TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_HIVE_METASTORE_EXTERNAL`, `TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_HIVE_METASTORE_MANAGED`, `TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_SNOWFLAKE`, `TABLE_EXTERNAL`, `TABLE_FEATURE_STORE`, `TABLE_FEATURE_STORE_EXTERNAL`, `TABLE_FOREIGN_BIGQUERY`, `TABLE_FOREIGN_DATABRICKS`, `TABLE_FOREIGN_DELTASHARING`, `TABLE_FOREIGN_HIVE_METASTORE`, `TABLE_FOREIGN_HIVE_METASTORE_DBFS_EXTERNAL`, `TABLE_FOREIGN_HIVE_METASTORE_DBFS_MANAGED`, `TABLE_FOREIGN_HIVE_METASTORE_DBFS_SHALLOW_CLONE_EXTERNAL`, `TABLE_FOREIGN_HIVE_METASTORE_DBFS_SHALLOW_CLONE_MANAGED`, `TABLE_FOREIGN_HIVE_METASTORE_DBFS_VIEW`, `TABLE_FOREIGN_HIVE_METASTORE_EXTERNAL`, `TABLE_FOREIGN_HIVE_METASTORE_MANAGED`, `TABLE_FOREIGN_HIVE_METASTORE_SHALLOW_CLONE_EXTERNAL`, `TABLE_FOREIGN_HIVE_METASTORE_SHALLOW_CLONE_MANAGED`, `TABLE_FOREIGN_HIVE_METASTORE_VIEW`, `TABLE_FOREIGN_MONGODB`, `TABLE_FOREIGN_MYSQL`, `TABLE_FOREIGN_NETSUITE`, `TABLE_FOREIGN_ORACLE`, `TABLE_FOREIGN_POSTGRESQL`, `TABLE_FOREIGN_REDSHIFT`, `TABLE_FOREIGN_SALESFORCE`, `TABLE_FOREIGN_SALESFORCE_DATA_CLOUD`, `TABLE_FOREIGN_SALESFORCE_DATA_CLOUD_FILE_SHARING`, `TABLE_FOREIGN_SALESFORCE_DATA_CLOUD_FILE_SHARING_VIEW`, `TABLE_FOREIGN_SNOWFLAKE`, `TABLE_FOREIGN_SQLDW`, `TABLE_FOREIGN_SQLSERVER`, `TABLE_FOREIGN_TERADATA`, `TABLE_FOREIGN_WORKDAY_RAAS`, `TABLE_ICEBERG_UNIFORM_MANAGED`, `TABLE_INTERNAL`, `TABLE_MANAGED_POSTGRESQL`, `TABLE_MATERIALIZED_VIEW`, `TABLE_MATERIALIZED_VIEW_DELTASHARING`, `TABLE_METRIC_VIEW`, `TABLE_ONLINE_VECTOR_INDEX_DIRECT`, `TABLE_ONLINE_VECTOR_INDEX_REPLICA`, `TABLE_ONLINE_VIEW`, `TABLE_STANDARD`, `TABLE_STREAMING_LIVE_TABLE`, `TABLE_STREAMING_LIVE_TABLE_DELTASHARING`, `TABLE_SYSTEM`, `TABLE_SYSTEM_DELTASHARING`, `TABLE_VIEW`, `TABLE_VIEW_DELTASHARING`: *f = SecurableKind(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "TABLE_DB_STORAGE", "TABLE_DELTA", "TABLE_DELTASHARING", "TABLE_DELTASHARING_MUTABLE", "TABLE_DELTA_EXTERNAL", "TABLE_DELTA_ICEBERG_DELTASHARING", "TABLE_DELTA_ICEBERG_MANAGED", "TABLE_DELTA_UNIFORM_HUDI_EXTERNAL", "TABLE_DELTA_UNIFORM_ICEBERG_EXTERNAL", "TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_HIVE_METASTORE_EXTERNAL", "TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_HIVE_METASTORE_MANAGED", "TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_SNOWFLAKE", "TABLE_EXTERNAL", "TABLE_FEATURE_STORE", "TABLE_FEATURE_STORE_EXTERNAL", "TABLE_FOREIGN_BIGQUERY", "TABLE_FOREIGN_DATABRICKS", "TABLE_FOREIGN_DELTASHARING", "TABLE_FOREIGN_HIVE_METASTORE", "TABLE_FOREIGN_HIVE_METASTORE_DBFS_EXTERNAL", "TABLE_FOREIGN_HIVE_METASTORE_DBFS_MANAGED", "TABLE_FOREIGN_HIVE_METASTORE_DBFS_SHALLOW_CLONE_EXTERNAL", "TABLE_FOREIGN_HIVE_METASTORE_DBFS_SHALLOW_CLONE_MANAGED", "TABLE_FOREIGN_HIVE_METASTORE_DBFS_VIEW", "TABLE_FOREIGN_HIVE_METASTORE_EXTERNAL", "TABLE_FOREIGN_HIVE_METASTORE_MANAGED", "TABLE_FOREIGN_HIVE_METASTORE_SHALLOW_CLONE_EXTERNAL", "TABLE_FOREIGN_HIVE_METASTORE_SHALLOW_CLONE_MANAGED", "TABLE_FOREIGN_HIVE_METASTORE_VIEW", "TABLE_FOREIGN_MONGODB", "TABLE_FOREIGN_MYSQL", "TABLE_FOREIGN_NETSUITE", "TABLE_FOREIGN_ORACLE", "TABLE_FOREIGN_POSTGRESQL", "TABLE_FOREIGN_REDSHIFT", "TABLE_FOREIGN_SALESFORCE", "TABLE_FOREIGN_SALESFORCE_DATA_CLOUD", "TABLE_FOREIGN_SALESFORCE_DATA_CLOUD_FILE_SHARING", "TABLE_FOREIGN_SALESFORCE_DATA_CLOUD_FILE_SHARING_VIEW", "TABLE_FOREIGN_SNOWFLAKE", "TABLE_FOREIGN_SQLDW", "TABLE_FOREIGN_SQLSERVER", "TABLE_FOREIGN_TERADATA", "TABLE_FOREIGN_WORKDAY_RAAS", "TABLE_ICEBERG_UNIFORM_MANAGED", "TABLE_INTERNAL", "TABLE_MANAGED_POSTGRESQL", "TABLE_MATERIALIZED_VIEW", "TABLE_MATERIALIZED_VIEW_DELTASHARING", "TABLE_METRIC_VIEW", "TABLE_ONLINE_VECTOR_INDEX_DIRECT", "TABLE_ONLINE_VECTOR_INDEX_REPLICA", "TABLE_ONLINE_VIEW", "TABLE_STANDARD", "TABLE_STREAMING_LIVE_TABLE", "TABLE_STREAMING_LIVE_TABLE_DELTASHARING", "TABLE_SYSTEM", "TABLE_SYSTEM_DELTASHARING", "TABLE_VIEW", "TABLE_VIEW_DELTASHARING"`, v) + return fmt.Errorf(`value "%s" is not one of "TABLE_DB_STORAGE", "TABLE_DELTA", "TABLE_DELTASHARING", "TABLE_DELTASHARING_MUTABLE", "TABLE_DELTA_EXTERNAL", "TABLE_DELTA_ICEBERG_DELTASHARING", "TABLE_DELTA_ICEBERG_MANAGED", "TABLE_DELTA_UNIFORM_HUDI_EXTERNAL", "TABLE_DELTA_UNIFORM_ICEBERG_EXTERNAL", "TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_DELTASHARING", "TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_HIVE_METASTORE_EXTERNAL", "TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_HIVE_METASTORE_MANAGED", "TABLE_DELTA_UNIFORM_ICEBERG_FOREIGN_SNOWFLAKE", "TABLE_EXTERNAL", "TABLE_FEATURE_STORE", "TABLE_FEATURE_STORE_EXTERNAL", "TABLE_FOREIGN_BIGQUERY", "TABLE_FOREIGN_DATABRICKS", "TABLE_FOREIGN_DELTASHARING", "TABLE_FOREIGN_HIVE_METASTORE", "TABLE_FOREIGN_HIVE_METASTORE_DBFS_EXTERNAL", "TABLE_FOREIGN_HIVE_METASTORE_DBFS_MANAGED", "TABLE_FOREIGN_HIVE_METASTORE_DBFS_SHALLOW_CLONE_EXTERNAL", "TABLE_FOREIGN_HIVE_METASTORE_DBFS_SHALLOW_CLONE_MANAGED", "TABLE_FOREIGN_HIVE_METASTORE_DBFS_VIEW", "TABLE_FOREIGN_HIVE_METASTORE_EXTERNAL", "TABLE_FOREIGN_HIVE_METASTORE_MANAGED", "TABLE_FOREIGN_HIVE_METASTORE_SHALLOW_CLONE_EXTERNAL", "TABLE_FOREIGN_HIVE_METASTORE_SHALLOW_CLONE_MANAGED", "TABLE_FOREIGN_HIVE_METASTORE_VIEW", "TABLE_FOREIGN_MONGODB", "TABLE_FOREIGN_MYSQL", "TABLE_FOREIGN_NETSUITE", "TABLE_FOREIGN_ORACLE", "TABLE_FOREIGN_POSTGRESQL", "TABLE_FOREIGN_REDSHIFT", "TABLE_FOREIGN_SALESFORCE", "TABLE_FOREIGN_SALESFORCE_DATA_CLOUD", "TABLE_FOREIGN_SALESFORCE_DATA_CLOUD_FILE_SHARING", "TABLE_FOREIGN_SALESFORCE_DATA_CLOUD_FILE_SHARING_VIEW", "TABLE_FOREIGN_SNOWFLAKE", "TABLE_FOREIGN_SQLDW", "TABLE_FOREIGN_SQLSERVER", "TABLE_FOREIGN_TERADATA", "TABLE_FOREIGN_WORKDAY_RAAS", "TABLE_ICEBERG_UNIFORM_MANAGED", "TABLE_INTERNAL", "TABLE_MANAGED_POSTGRESQL", "TABLE_MATERIALIZED_VIEW", "TABLE_MATERIALIZED_VIEW_DELTASHARING", "TABLE_METRIC_VIEW", "TABLE_ONLINE_VECTOR_INDEX_DIRECT", "TABLE_ONLINE_VECTOR_INDEX_REPLICA", "TABLE_ONLINE_VIEW", "TABLE_STANDARD", "TABLE_STREAMING_LIVE_TABLE", "TABLE_STREAMING_LIVE_TABLE_DELTASHARING", "TABLE_SYSTEM", "TABLE_SYSTEM_DELTASHARING", "TABLE_VIEW", "TABLE_VIEW_DELTASHARING"`, v) } } @@ -6600,6 +7033,7 @@ func (f *SecurableKind) Values() []SecurableKind { SecurableKindTableDeltaIcebergManaged, SecurableKindTableDeltaUniformHudiExternal, SecurableKindTableDeltaUniformIcebergExternal, + SecurableKindTableDeltaUniformIcebergForeignDeltasharing, SecurableKindTableDeltaUniformIcebergForeignHiveMetastoreExternal, SecurableKindTableDeltaUniformIcebergForeignHiveMetastoreManaged, SecurableKindTableDeltaUniformIcebergForeignSnowflake, @@ -6673,6 +7107,14 @@ type SecurableKindManifest struct { SecurableType SecurableType `json:"securable_type,omitempty"` } +type SecurablePermissions struct { + // List of requested Unity Catalog permissions. + Permissions []string `json:"permissions,omitempty"` + // The securable for which the access request destinations are being + // requested. + Securable *Securable `json:"securable,omitempty"` +} + // The type of Unity Catalog securable. type SecurableType string @@ -6788,6 +7230,52 @@ type SetRegisteredModelAliasRequest struct { VersionNum int `json:"version_num"` } +type SpecialDestination string + +const SpecialDestinationSpecialDestinationCatalogOwner SpecialDestination = `SPECIAL_DESTINATION_CATALOG_OWNER` + +const SpecialDestinationSpecialDestinationConnectionOwner SpecialDestination = `SPECIAL_DESTINATION_CONNECTION_OWNER` + +const SpecialDestinationSpecialDestinationCredentialOwner SpecialDestination = `SPECIAL_DESTINATION_CREDENTIAL_OWNER` + +const SpecialDestinationSpecialDestinationExternalLocationOwner SpecialDestination = `SPECIAL_DESTINATION_EXTERNAL_LOCATION_OWNER` + +const SpecialDestinationSpecialDestinationMetastoreOwner SpecialDestination = `SPECIAL_DESTINATION_METASTORE_OWNER` + +// String representation for [fmt.Print] +func (f *SpecialDestination) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *SpecialDestination) Set(v string) error { + switch v { + case `SPECIAL_DESTINATION_CATALOG_OWNER`, `SPECIAL_DESTINATION_CONNECTION_OWNER`, `SPECIAL_DESTINATION_CREDENTIAL_OWNER`, `SPECIAL_DESTINATION_EXTERNAL_LOCATION_OWNER`, `SPECIAL_DESTINATION_METASTORE_OWNER`: + *f = SpecialDestination(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "SPECIAL_DESTINATION_CATALOG_OWNER", "SPECIAL_DESTINATION_CONNECTION_OWNER", "SPECIAL_DESTINATION_CREDENTIAL_OWNER", "SPECIAL_DESTINATION_EXTERNAL_LOCATION_OWNER", "SPECIAL_DESTINATION_METASTORE_OWNER"`, v) + } +} + +// Values returns all possible values for SpecialDestination. +// +// There is no guarantee on the order of the values in the slice. +func (f *SpecialDestination) Values() []SpecialDestination { + return []SpecialDestination{ + SpecialDestinationSpecialDestinationCatalogOwner, + SpecialDestinationSpecialDestinationConnectionOwner, + SpecialDestinationSpecialDestinationCredentialOwner, + SpecialDestinationSpecialDestinationExternalLocationOwner, + SpecialDestinationSpecialDestinationMetastoreOwner, + } +} + +// Type always returns SpecialDestination to satisfy [pflag.Value] interface +func (f *SpecialDestination) Type() string { + return "SpecialDestination" +} + // Server-Side Encryption properties for clients communicating with AWS s3. type SseEncryptionDetails struct { // Sets the value of the 'x-amz-server-side-encryption' header in S3 @@ -7322,9 +7810,32 @@ type UnassignRequest struct { WorkspaceId int64 `json:"-" url:"-"` } +type UpdateAccessRequestDestinationsRequest struct { + // The access request destinations to assign to the securable. For each + // destination, a **destination_id** and **destination_type** must be + // defined. + AccessRequestDestinations AccessRequestDestinations `json:"access_request_destinations"` + // The field mask must be a single string, with multiple fields separated by + // commas (no spaces). The field path is relative to the resource object, + // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). + // Specification of elements in sequence or map fields is not allowed, as + // only the entire collection field can be specified. Field names must + // exactly match the resource field names. + // + // A field mask of `*` indicates full replacement. It’s recommended to + // always explicitly list the fields being updated and avoid using `*` + // wildcards, as it can lead to unintended results if the API changes in the + // future. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateCatalog struct { // User-provided free-form text description. Comment string `json:"comment,omitempty"` + // Status of conversion of FOREIGN catalog to UC Native catalog. + ConversionInfo *ConversionInfo `json:"conversion_info,omitempty"` + // Disaster Recovery replication state snapshot. + DrReplicationInfo *DrReplicationInfo `json:"dr_replication_info,omitempty"` // Whether predictive optimization should be enabled for this object and // objects under it. EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` @@ -7424,6 +7935,30 @@ func (s UpdateCredentialRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateEntityTagAssignmentRequest struct { + // The fully qualified name of the entity to which the tag is assigned + EntityName string `json:"-" url:"-"` + // The type of the entity to which the tag is assigned. Allowed values are: + // catalogs, schemas, tables, columns, volumes. + EntityType string `json:"-" url:"-"` + + TagAssignment EntityTagAssignment `json:"tag_assignment"` + // The key of the tag + TagKey string `json:"-" url:"-"` + // The field mask must be a single string, with multiple fields separated by + // commas (no spaces). The field path is relative to the resource object, + // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). + // Specification of elements in sequence or map fields is not allowed, as + // only the entire collection field can be specified. Field names must + // exactly match the resource field names. + // + // A field mask of `*` indicates full replacement. It’s recommended to + // always explicitly list the fields being updated and avoid using `*` + // wildcards, as it can lead to unintended results if the API changes in the + // future. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateExternalLineageRelationshipRequest struct { ExternalLineageRelationship UpdateRequestExternalLineage `json:"external_lineage_relationship"` // The field mask must be a single string, with multiple fields separated by @@ -7453,7 +7988,8 @@ type UpdateExternalLocation struct { // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. Fallback bool `json:"fallback,omitempty"` - // File event queue settings. + // File event queue settings. If `enable_file_events` is `true`, must be + // defined and have exactly one of the documented properties. FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` // Force update even if changing url invalidates dependent external tables // or mounts. diff --git a/service/cleanrooms/model.go b/service/cleanrooms/model.go index 3edb63d7c..042dc7f71 100755 --- a/service/cleanrooms/model.go +++ b/service/cleanrooms/model.go @@ -32,7 +32,7 @@ type CleanRoom struct { // catalog is manipulated using the separate CreateCleanRoomOutputCatalog // API. OutputCatalog *CleanRoomOutputCatalog `json:"output_catalog,omitempty"` - // This is Databricks username of the owner of the local clean room + // This is the Databricks username of the owner of the local clean room // securable for permission management. Owner string `json:"owner,omitempty"` // Central clean room details. During creation, users need to specify @@ -217,7 +217,7 @@ type CleanRoomAssetNotebook struct { ReviewState CleanRoomNotebookReviewNotebookReviewState `json:"review_state,omitempty"` // All existing approvals or rejections Reviews []CleanRoomNotebookReview `json:"reviews,omitempty"` - // collaborators that can run the notebook + // Aliases of collaborators that can run the notebook. RunnerCollaboratorAliases []string `json:"runner_collaborator_aliases,omitempty"` ForceSendFields []string `json:"-" url:"-"` @@ -379,7 +379,7 @@ type CleanRoomCollaborator struct { // rooms, it is the organization name of the metastore. It is not restricted // to these values and could change in the future DisplayName string `json:"display_name,omitempty"` - // The global Unity Catalog metastore id of the collaborator. The identifier + // The global Unity Catalog metastore ID of the collaborator. The identifier // is of format cloud:region:metastore-uuid. GlobalMetastoreId string `json:"global_metastore_id,omitempty"` // Email of the user who is receiving the clean room "invitation". It should @@ -733,14 +733,14 @@ type CreateCleanRoomAssetRequest struct { } type CreateCleanRoomAssetReviewRequest struct { - // Asset type. Can only be NOTEBOOK_FILE. + // Asset type. Can either be NOTEBOOK_FILE or JAR_ANALYSIS. AssetType CleanRoomAssetAssetType `json:"-" url:"-"` // Name of the clean room CleanRoomName string `json:"-" url:"-"` // Name of the asset Name string `json:"-" url:"-"` - NotebookReview NotebookVersionReview `json:"notebook_review"` + NotebookReview *NotebookVersionReview `json:"notebook_review,omitempty"` } type CreateCleanRoomAssetReviewResponse struct { diff --git a/service/compute/api.go b/service/compute/api.go index ec56e450a..57a2714d4 100755 --- a/service/compute/api.go +++ b/service/compute/api.go @@ -1999,14 +1999,64 @@ type LibrariesInterface interface { // particular order, are returned last. ClusterStatusByClusterId(ctx context.Context, clusterId string) (*ClusterLibraryStatuses, error) + // Create a default base environment within workspaces to define the environment + // version and a list of dependencies to be used in serverless notebooks and + // jobs. This process will asynchronously generate a cache to optimize + // dependency resolution. + CreateDefaultBaseEnvironment(ctx context.Context, request CreateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Delete the default base environment given an ID. The default base environment + // may be used by downstream workloads. Please ensure that the deletion is + // intentional. + DeleteDefaultBaseEnvironment(ctx context.Context, request DeleteDefaultBaseEnvironmentRequest) error + + // Delete the default base environment given an ID. The default base environment + // may be used by downstream workloads. Please ensure that the deletion is + // intentional. + DeleteDefaultBaseEnvironmentById(ctx context.Context, id string) error + + // Return the default base environment details for a given ID. + GetDefaultBaseEnvironment(ctx context.Context, request GetDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + // Add libraries to install on a cluster. The installation is asynchronous; it // happens in the background after the completion of this request. Install(ctx context.Context, request InstallLibraries) error + // List default base environments defined in the workspaces for the requested + // user. + // + // This method is generated by Databricks SDK Code Generator. + ListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) listing.Iterator[DefaultBaseEnvironment] + + // List default base environments defined in the workspaces for the requested + // user. + // + // This method is generated by Databricks SDK Code Generator. + ListDefaultBaseEnvironmentsAll(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) ([]DefaultBaseEnvironment, error) + + // Refresh the cached default base environments for the given IDs. This process + // will asynchronously regenerate the caches. The existing caches remains + // available until it expires. + RefreshDefaultBaseEnvironments(ctx context.Context, request RefreshDefaultBaseEnvironmentsRequest) error + + // Refresh the cached default base environments for the given IDs. This process + // will asynchronously regenerate the caches. The existing caches remains + // available until it expires. + RefreshDefaultBaseEnvironmentsByIds(ctx context.Context, ids []string) error + // Set libraries to uninstall from a cluster. The libraries won't be uninstalled // until the cluster is restarted. A request to uninstall a library that is not // currently installed is ignored. Uninstall(ctx context.Context, request UninstallLibraries) error + + // Update the default base environment for the given ID. This process will + // asynchronously regenerate the cache. The existing cache remains available + // until it expires. + UpdateDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Set the default base environment for the workspace. This marks the specified + // DBE as the workspace default. + UpdateDefaultDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) } func NewLibraries(client *client.DatabricksClient) *LibrariesAPI { @@ -2050,6 +2100,24 @@ func (a *LibrariesAPI) ClusterStatusByClusterId(ctx context.Context, clusterId s }) } +// Delete the default base environment given an ID. The default base environment +// may be used by downstream workloads. Please ensure that the deletion is +// intentional. +func (a *LibrariesAPI) DeleteDefaultBaseEnvironmentById(ctx context.Context, id string) error { + return a.librariesImpl.DeleteDefaultBaseEnvironment(ctx, DeleteDefaultBaseEnvironmentRequest{ + Id: id, + }) +} + +// Refresh the cached default base environments for the given IDs. This process +// will asynchronously regenerate the caches. The existing caches remains +// available until it expires. +func (a *LibrariesAPI) RefreshDefaultBaseEnvironmentsByIds(ctx context.Context, ids []string) error { + return a.librariesImpl.RefreshDefaultBaseEnvironments(ctx, RefreshDefaultBaseEnvironmentsRequest{ + Ids: ids, + }) +} + type PolicyComplianceForClustersInterface interface { // Updates a cluster to be compliant with the current version of its policy. A diff --git a/service/compute/impl.go b/service/compute/impl.go index d41f7f64c..dec3c151d 100755 --- a/service/compute/impl.go +++ b/service/compute/impl.go @@ -869,6 +869,36 @@ func (a *librariesImpl) internalClusterStatus(ctx context.Context, request Clust return &clusterLibraryStatuses, err } +func (a *librariesImpl) CreateDefaultBaseEnvironment(ctx context.Context, request CreateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + path := "/api/2.0/default-base-environments" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + +func (a *librariesImpl) DeleteDefaultBaseEnvironment(ctx context.Context, request DeleteDefaultBaseEnvironmentRequest) error { + path := fmt.Sprintf("/api/2.0/default-base-environments/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *librariesImpl) GetDefaultBaseEnvironment(ctx context.Context, request GetDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + path := "/api/2.0/default-base-environments:getDefaultBaseEnvironment" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + func (a *librariesImpl) Install(ctx context.Context, request InstallLibraries) error { path := "/api/2.0/libraries/install" queryParams := make(map[string]any) @@ -879,6 +909,59 @@ func (a *librariesImpl) Install(ctx context.Context, request InstallLibraries) e return err } +// List default base environments defined in the workspaces for the requested +// user. +func (a *librariesImpl) ListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) listing.Iterator[DefaultBaseEnvironment] { + + getNextPage := func(ctx context.Context, req ListDefaultBaseEnvironmentsRequest) (*ListDefaultBaseEnvironmentsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListDefaultBaseEnvironments(ctx, req) + } + getItems := func(resp *ListDefaultBaseEnvironmentsResponse) []DefaultBaseEnvironment { + return resp.DefaultBaseEnvironments + } + getNextReq := func(resp *ListDefaultBaseEnvironmentsResponse) *ListDefaultBaseEnvironmentsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List default base environments defined in the workspaces for the requested +// user. +func (a *librariesImpl) ListDefaultBaseEnvironmentsAll(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) ([]DefaultBaseEnvironment, error) { + iterator := a.ListDefaultBaseEnvironments(ctx, request) + return listing.ToSlice[DefaultBaseEnvironment](ctx, iterator) +} + +func (a *librariesImpl) internalListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) (*ListDefaultBaseEnvironmentsResponse, error) { + var listDefaultBaseEnvironmentsResponse ListDefaultBaseEnvironmentsResponse + path := "/api/2.0/default-base-environments" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDefaultBaseEnvironmentsResponse) + return &listDefaultBaseEnvironmentsResponse, err +} + +func (a *librariesImpl) RefreshDefaultBaseEnvironments(ctx context.Context, request RefreshDefaultBaseEnvironmentsRequest) error { + path := "/api/2.0/default-base-environments/refresh" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) + return err +} + func (a *librariesImpl) Uninstall(ctx context.Context, request UninstallLibraries) error { path := "/api/2.0/libraries/uninstall" queryParams := make(map[string]any) @@ -889,6 +972,28 @@ func (a *librariesImpl) Uninstall(ctx context.Context, request UninstallLibrarie return err } +func (a *librariesImpl) UpdateDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + path := fmt.Sprintf("/api/2.0/default-base-environments/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + +func (a *librariesImpl) UpdateDefaultDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + path := "/api/2.0/default-base-environments:setDefault" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + // unexported type that holds implementations of just PolicyComplianceForClusters API methods type policyComplianceForClustersImpl struct { client *client.DatabricksClient diff --git a/service/compute/interface.go b/service/compute/interface.go index 71a8405b4..aec7ea425 100755 --- a/service/compute/interface.go +++ b/service/compute/interface.go @@ -442,14 +442,46 @@ type LibrariesService interface { // removal, in no particular order, are returned last. ClusterStatus(ctx context.Context, request ClusterStatus) (*ClusterLibraryStatuses, error) + // Create a default base environment within workspaces to define the + // environment version and a list of dependencies to be used in serverless + // notebooks and jobs. This process will asynchronously generate a cache to + // optimize dependency resolution. + CreateDefaultBaseEnvironment(ctx context.Context, request CreateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Delete the default base environment given an ID. The default base + // environment may be used by downstream workloads. Please ensure that the + // deletion is intentional. + DeleteDefaultBaseEnvironment(ctx context.Context, request DeleteDefaultBaseEnvironmentRequest) error + + // Return the default base environment details for a given ID. + GetDefaultBaseEnvironment(ctx context.Context, request GetDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + // Add libraries to install on a cluster. The installation is asynchronous; // it happens in the background after the completion of this request. Install(ctx context.Context, request InstallLibraries) error + // List default base environments defined in the workspaces for the + // requested user. + ListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) (*ListDefaultBaseEnvironmentsResponse, error) + + // Refresh the cached default base environments for the given IDs. This + // process will asynchronously regenerate the caches. The existing caches + // remains available until it expires. + RefreshDefaultBaseEnvironments(ctx context.Context, request RefreshDefaultBaseEnvironmentsRequest) error + // Set libraries to uninstall from a cluster. The libraries won't be // uninstalled until the cluster is restarted. A request to uninstall a // library that is not currently installed is ignored. Uninstall(ctx context.Context, request UninstallLibraries) error + + // Update the default base environment for the given ID. This process will + // asynchronously regenerate the cache. The existing cache remains available + // until it expires. + UpdateDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Set the default base environment for the workspace. This marks the + // specified DBE as the workspace default. + UpdateDefaultDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) } // The policy compliance APIs allow you to view and manage the policy compliance diff --git a/service/compute/model.go b/service/compute/model.go index 113acaa74..f505d57fe 100755 --- a/service/compute/model.go +++ b/service/compute/model.go @@ -287,6 +287,45 @@ func (f *AzureAvailability) Type() string { return "AzureAvailability" } +// If changed, also update +// estore/namespaces/defaultbaseenvironments/latest.proto +type BaseEnvironmentType string + +const BaseEnvironmentTypeCpu BaseEnvironmentType = `CPU` + +const BaseEnvironmentTypeGpu BaseEnvironmentType = `GPU` + +// String representation for [fmt.Print] +func (f *BaseEnvironmentType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *BaseEnvironmentType) Set(v string) error { + switch v { + case `CPU`, `GPU`: + *f = BaseEnvironmentType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CPU", "GPU"`, v) + } +} + +// Values returns all possible values for BaseEnvironmentType. +// +// There is no guarantee on the order of the values in the slice. +func (f *BaseEnvironmentType) Values() []BaseEnvironmentType { + return []BaseEnvironmentType{ + BaseEnvironmentTypeCpu, + BaseEnvironmentTypeGpu, + } +} + +// Type always returns BaseEnvironmentType to satisfy [pflag.Value] interface +func (f *BaseEnvironmentType) Type() string { + return "BaseEnvironmentType" +} + type CancelCommand struct { ClusterId string `json:"clusterId,omitempty"` @@ -1762,6 +1801,23 @@ func (s CreateContext) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateDefaultBaseEnvironmentRequest struct { + DefaultBaseEnvironment DefaultBaseEnvironment `json:"default_base_environment"` + // A unique identifier for this request. A random UUID is recommended. This + // request is only idempotent if a `request_id` is provided. + RequestId string `json:"request_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateDefaultBaseEnvironmentRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateDefaultBaseEnvironmentRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type CreateInstancePool struct { // Attributes related to instance pools running on Amazon Web Services. If // not specified at pool creation, a set of default values will be used. @@ -1778,6 +1834,10 @@ type CreateInstancePool struct { // Defines the specification of the disks that will be attached to all spark // containers. DiskSpec *DiskSpec `json:"disk_spec,omitempty"` + // For pools with node type flexibility (Fleet-V2), whether auto generated + // alternate node type ids are enabled. This field should not be true if + // node_type_flexibility is set. + EnableAutoAlternateNodeTypes bool `json:"enable_auto_alternate_node_types,omitempty"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS @@ -1804,6 +1864,11 @@ type CreateInstancePool struct { MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool MinIdleInstances int `json:"min_idle_instances,omitempty"` + // For pools with node type flexibility (Fleet-V2), this object contains the + // information about the alternate node type ids to use when attempting to + // launch a cluster if the node type id is not available. This field should + // not be set if enable_auto_alternate_node_types is true. + NodeTypeFlexibility *NodeTypeFlexibility `json:"node_type_flexibility,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -2131,11 +2196,125 @@ type DbfsStorageInfo struct { Destination string `json:"destination"` } +type DefaultBaseEnvironment struct { + BaseEnvironmentCache []DefaultBaseEnvironmentCache `json:"base_environment_cache,omitempty"` + + BaseEnvironmentType BaseEnvironmentType `json:"base_environment_type,omitempty"` + + CreatedTimestamp int64 `json:"created_timestamp,omitempty"` + + CreatorUserId int64 `json:"creator_user_id,omitempty"` + // Note: we made `environment` non-internal because we need to expose its + // `client` field. All other fields should be treated as internal. + Environment *Environment `json:"environment,omitempty"` + + Filepath string `json:"filepath,omitempty"` + + Id string `json:"id,omitempty"` + + IsDefault bool `json:"is_default,omitempty"` + + LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` + + LastUpdatedUserId int64 `json:"last_updated_user_id,omitempty"` + + Message string `json:"message,omitempty"` + + Name string `json:"name,omitempty"` + + PrincipalIds []int64 `json:"principal_ids,omitempty"` + + Status DefaultBaseEnvironmentCacheStatus `json:"status,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DefaultBaseEnvironment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DefaultBaseEnvironment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DefaultBaseEnvironmentCache struct { + IndefiniteMaterializedEnvironment *MaterializedEnvironment `json:"indefinite_materialized_environment,omitempty"` + + MaterializedEnvironment *MaterializedEnvironment `json:"materialized_environment,omitempty"` + + Message string `json:"message,omitempty"` + + Status DefaultBaseEnvironmentCacheStatus `json:"status,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DefaultBaseEnvironmentCache) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DefaultBaseEnvironmentCache) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DefaultBaseEnvironmentCacheStatus string + +const DefaultBaseEnvironmentCacheStatusCreated DefaultBaseEnvironmentCacheStatus = `CREATED` + +const DefaultBaseEnvironmentCacheStatusExpired DefaultBaseEnvironmentCacheStatus = `EXPIRED` + +const DefaultBaseEnvironmentCacheStatusFailed DefaultBaseEnvironmentCacheStatus = `FAILED` + +const DefaultBaseEnvironmentCacheStatusInvalid DefaultBaseEnvironmentCacheStatus = `INVALID` + +const DefaultBaseEnvironmentCacheStatusPending DefaultBaseEnvironmentCacheStatus = `PENDING` + +const DefaultBaseEnvironmentCacheStatusRefreshing DefaultBaseEnvironmentCacheStatus = `REFRESHING` + +// String representation for [fmt.Print] +func (f *DefaultBaseEnvironmentCacheStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DefaultBaseEnvironmentCacheStatus) Set(v string) error { + switch v { + case `CREATED`, `EXPIRED`, `FAILED`, `INVALID`, `PENDING`, `REFRESHING`: + *f = DefaultBaseEnvironmentCacheStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CREATED", "EXPIRED", "FAILED", "INVALID", "PENDING", "REFRESHING"`, v) + } +} + +// Values returns all possible values for DefaultBaseEnvironmentCacheStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *DefaultBaseEnvironmentCacheStatus) Values() []DefaultBaseEnvironmentCacheStatus { + return []DefaultBaseEnvironmentCacheStatus{ + DefaultBaseEnvironmentCacheStatusCreated, + DefaultBaseEnvironmentCacheStatusExpired, + DefaultBaseEnvironmentCacheStatusFailed, + DefaultBaseEnvironmentCacheStatusInvalid, + DefaultBaseEnvironmentCacheStatusPending, + DefaultBaseEnvironmentCacheStatusRefreshing, + } +} + +// Type always returns DefaultBaseEnvironmentCacheStatus to satisfy [pflag.Value] interface +func (f *DefaultBaseEnvironmentCacheStatus) Type() string { + return "DefaultBaseEnvironmentCacheStatus" +} + type DeleteCluster struct { // The cluster to be terminated. ClusterId string `json:"cluster_id"` } +type DeleteDefaultBaseEnvironmentRequest struct { + Id string `json:"-" url:"-"` +} + type DeleteGlobalInitScriptRequest struct { // The ID of the global init script. ScriptId string `json:"-" url:"-"` @@ -2541,6 +2720,10 @@ type EditInstancePool struct { // // - Currently, Databricks allows at most 45 custom tags CustomTags map[string]string `json:"custom_tags,omitempty"` + // For pools with node type flexibility (Fleet-V2), whether auto generated + // alternate node type ids are enabled. This field should not be true if + // node_type_flexibility is set. + EnableAutoAlternateNodeTypes bool `json:"enable_auto_alternate_node_types,omitempty"` // Automatically terminates the extra instances in the pool cache after they // are inactive for this time in minutes if min_idle_instances requirement // is already met. If not set, the extra pool instances will be @@ -2560,6 +2743,11 @@ type EditInstancePool struct { MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool MinIdleInstances int `json:"min_idle_instances,omitempty"` + // For pools with node type flexibility (Fleet-V2), this object contains the + // information about the alternate node type ids to use when attempting to + // launch a cluster if the node type id is not available. This field should + // not be set if enable_auto_alternate_node_types is true. + NodeTypeFlexibility *NodeTypeFlexibility `json:"node_type_flexibility,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -2687,9 +2875,11 @@ type Environment struct { // with a specific Python version and a set of Python packages. The version // is a string, consisting of an integer. EnvironmentVersion string `json:"environment_version,omitempty"` + // Use `java_dependencies` instead. + JarDependencies []string `json:"jar_dependencies,omitempty"` // List of jar dependencies, should be string representing volume paths. For // example: `/Volumes/path/to/test.jar`. - JarDependencies []string `json:"jar_dependencies,omitempty"` + JavaDependencies []string `json:"java_dependencies,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -3099,6 +3289,10 @@ type GetClusterRequest struct { ClusterId string `json:"-" url:"cluster_id"` } +type GetDefaultBaseEnvironmentRequest struct { + Id string `json:"-" url:"id"` +} + type GetEvents struct { // The ID of the cluster to retrieve events about. ClusterId string `json:"cluster_id"` @@ -3247,6 +3441,10 @@ type GetInstancePool struct { // Defines the specification of the disks that will be attached to all spark // containers. DiskSpec *DiskSpec `json:"disk_spec,omitempty"` + // For pools with node type flexibility (Fleet-V2), whether auto generated + // alternate node type ids are enabled. This field should not be true if + // node_type_flexibility is set. + EnableAutoAlternateNodeTypes bool `json:"enable_auto_alternate_node_types,omitempty"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS @@ -3275,6 +3473,11 @@ type GetInstancePool struct { MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool MinIdleInstances int `json:"min_idle_instances,omitempty"` + // For pools with node type flexibility (Fleet-V2), this object contains the + // information about the alternate node type ids to use when attempting to + // launch a cluster if the node type id is not available. This field should + // not be set if enable_auto_alternate_node_types is true. + NodeTypeFlexibility *NodeTypeFlexibility `json:"node_type_flexibility,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -3714,6 +3917,10 @@ type InstancePoolAndStats struct { // Defines the specification of the disks that will be attached to all spark // containers. DiskSpec *DiskSpec `json:"disk_spec,omitempty"` + // For pools with node type flexibility (Fleet-V2), whether auto generated + // alternate node type ids are enabled. This field should not be true if + // node_type_flexibility is set. + EnableAutoAlternateNodeTypes bool `json:"enable_auto_alternate_node_types,omitempty"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS @@ -3742,6 +3949,11 @@ type InstancePoolAndStats struct { MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool MinIdleInstances int `json:"min_idle_instances,omitempty"` + // For pools with node type flexibility (Fleet-V2), this object contains the + // information about the alternate node type ids to use when attempting to + // launch a cluster if the node type id is not available. This field should + // not be set if enable_auto_alternate_node_types is true. + NodeTypeFlexibility *NodeTypeFlexibility `json:"node_type_flexibility,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -3784,6 +3996,17 @@ func (s InstancePoolAndStats) MarshalJSON() ([]byte, error) { type InstancePoolAwsAttributes struct { // Availability type used for the spot nodes. Availability InstancePoolAwsAttributesAvailability `json:"availability,omitempty"` + // All AWS instances belonging to the instance pool will have this instance + // profile. If omitted, instances will initially be launched with the + // workspace's default instance profile. If defined, clusters that use the + // pool will inherit the instance profile, and must not specify their own + // instance profile on cluster creation or update. If the pool does not + // specify an instance profile, clusters using the pool may specify any + // instance profile. The instance profile must have previously been added to + // the Databricks environment by an account administrator. + // + // This feature may only be available to certain customer plans. + InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // Calculates the bid price for AWS spot instances, as a percentage of the // corresponding instance type's on-demand price. For example, if this field // is set to 50, and the cluster needs a new `r3.xlarge` spot instance, then @@ -4603,6 +4826,38 @@ func (f *ListClustersSortByField) Type() string { return "ListClustersSortByField" } +type ListDefaultBaseEnvironmentsRequest struct { + PageSize int `json:"-" url:"page_size,omitempty"` + + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDefaultBaseEnvironmentsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDefaultBaseEnvironmentsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListDefaultBaseEnvironmentsResponse struct { + DefaultBaseEnvironments []DefaultBaseEnvironment `json:"default_base_environments,omitempty"` + + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDefaultBaseEnvironmentsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDefaultBaseEnvironmentsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListGlobalInitScriptsResponse struct { Scripts []GlobalInitScriptDetails `json:"scripts,omitempty"` } @@ -4778,6 +5033,36 @@ func (s LogSyncStatus) MarshalJSON() ([]byte, error) { type MapAny map[string]any +// Materialized Environment information enables environment sharing and reuse +// via Environment Caching during library installations. Currently this feature +// is only supported for Python libraries. +// +// - If the env cache entry in LMv2 DB doesn't exist or invalid, library +// installations and environment materialization will occur. A new Materialized +// Environment metadata will be sent from DP upon successful library +// installations and env materialization, and is persisted into database by +// LMv2. - If the env cache entry in LMv2 DB is valid, the Materialized +// Environment will be sent to DP by LMv2, and DP will restore the cached +// environment from a store instead of reinstalling libraries from scratch. +// +// If changed, also update +// estore/namespaces/defaultbaseenvironments/latest.proto with new version +type MaterializedEnvironment struct { + // The timestamp (in epoch milliseconds) when the materialized env is + // updated. + LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *MaterializedEnvironment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s MaterializedEnvironment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type MavenLibrary struct { // Gradle-style maven coordinates. For example: "org.jsoup:jsoup:1.7.2". Coordinates string `json:"coordinates"` @@ -4894,6 +5179,12 @@ func (s NodeType) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// For Fleet-V2 using classic clusters, this object contains the information +// about the alternate node type ids to use when attempting to launch a cluster. +// It can be used with both the driver and worker node types. +type NodeTypeFlexibility struct { +} + // Error message of a failed pending instances type PendingInstanceError struct { InstanceId string `json:"instance_id,omitempty"` @@ -5041,6 +5332,10 @@ func (s RCranLibrary) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type RefreshDefaultBaseEnvironmentsRequest struct { + Ids []string `json:"ids"` +} + type RemoveInstanceProfile struct { // The ARN of the instance profile to remove. This field is required. InstanceProfileArn string `json:"instance_profile_arn"` @@ -5666,6 +5961,8 @@ const TerminationReasonCodeNetworkConfigurationFailure TerminationReasonCode = ` const TerminationReasonCodeNfsMountFailure TerminationReasonCode = `NFS_MOUNT_FAILURE` +const TerminationReasonCodeNoActivatedK8s TerminationReasonCode = `NO_ACTIVATED_K8S` + const TerminationReasonCodeNoMatchedK8s TerminationReasonCode = `NO_MATCHED_K8S` const TerminationReasonCodeNoMatchedK8sTestingTag TerminationReasonCode = `NO_MATCHED_K8S_TESTING_TAG` @@ -5742,6 +6039,8 @@ const TerminationReasonCodeUnsupportedInstanceType TerminationReasonCode = `UNSU const TerminationReasonCodeUpdateInstanceProfileFailure TerminationReasonCode = `UPDATE_INSTANCE_PROFILE_FAILURE` +const TerminationReasonCodeUsagePolicyEntitlementDenied TerminationReasonCode = `USAGE_POLICY_ENTITLEMENT_DENIED` + const TerminationReasonCodeUserInitiatedVmTermination TerminationReasonCode = `USER_INITIATED_VM_TERMINATION` const TerminationReasonCodeUserRequest TerminationReasonCode = `USER_REQUEST` @@ -5762,11 +6061,11 @@ func (f *TerminationReasonCode) String() string { // Set raw string value and validate it against allowed values func (f *TerminationReasonCode) Set(v string) error { switch v { - case `ABUSE_DETECTED`, `ACCESS_TOKEN_FAILURE`, `ALLOCATION_TIMEOUT`, `ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY`, `ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_READY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS`, `ATTACH_PROJECT_FAILURE`, `AWS_AUTHORIZATION_FAILURE`, `AWS_INACCESSIBLE_KMS_KEY_FAILURE`, `AWS_INSTANCE_PROFILE_UPDATE_FAILURE`, `AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE`, `AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE`, `AWS_INVALID_KEY_PAIR`, `AWS_INVALID_KMS_KEY_STATE`, `AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE`, `AWS_REQUEST_LIMIT_EXCEEDED`, `AWS_RESOURCE_QUOTA_EXCEEDED`, `AWS_UNSUPPORTED_FAILURE`, `AZURE_BYOK_KEY_PERMISSION_FAILURE`, `AZURE_EPHEMERAL_DISK_FAILURE`, `AZURE_INVALID_DEPLOYMENT_TEMPLATE`, `AZURE_OPERATION_NOT_ALLOWED_EXCEPTION`, `AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE`, `AZURE_QUOTA_EXCEEDED_EXCEPTION`, `AZURE_RESOURCE_MANAGER_THROTTLING`, `AZURE_RESOURCE_PROVIDER_THROTTLING`, `AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE`, `AZURE_VM_EXTENSION_FAILURE`, `AZURE_VNET_CONFIGURATION_FAILURE`, `BOOTSTRAP_TIMEOUT`, `BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION`, `BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG`, `BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED`, `BUDGET_POLICY_RESOLUTION_FAILURE`, `CLOUD_ACCOUNT_SETUP_FAILURE`, `CLOUD_OPERATION_CANCELLED`, `CLOUD_PROVIDER_DISK_SETUP_FAILURE`, `CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED`, `CLOUD_PROVIDER_LAUNCH_FAILURE`, `CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_SHUTDOWN`, `CLUSTER_OPERATION_THROTTLED`, `CLUSTER_OPERATION_TIMEOUT`, `COMMUNICATION_LOST`, `CONTAINER_LAUNCH_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG`, `DATABASE_CONNECTION_FAILURE`, `DATA_ACCESS_CONFIG_CHANGED`, `DBFS_COMPONENT_UNHEALTHY`, `DISASTER_RECOVERY_REPLICATION`, `DNS_RESOLUTION_ERROR`, `DOCKER_CONTAINER_CREATION_EXCEPTION`, `DOCKER_IMAGE_PULL_FAILURE`, `DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION`, `DOCKER_INVALID_OS_EXCEPTION`, `DRIVER_DNS_RESOLUTION_FAILURE`, `DRIVER_EVICTION`, `DRIVER_LAUNCH_TIMEOUT`, `DRIVER_NODE_UNREACHABLE`, `DRIVER_OUT_OF_DISK`, `DRIVER_OUT_OF_MEMORY`, `DRIVER_POD_CREATION_FAILURE`, `DRIVER_UNEXPECTED_FAILURE`, `DRIVER_UNHEALTHY`, `DRIVER_UNREACHABLE`, `DRIVER_UNRESPONSIVE`, `DYNAMIC_SPARK_CONF_SIZE_EXCEEDED`, `EOS_SPARK_IMAGE`, `EXECUTION_COMPONENT_UNHEALTHY`, `EXECUTOR_POD_UNSCHEDULED`, `GCP_API_RATE_QUOTA_EXCEEDED`, `GCP_DENIED_BY_ORG_POLICY`, `GCP_FORBIDDEN`, `GCP_IAM_TIMEOUT`, `GCP_INACCESSIBLE_KMS_KEY_FAILURE`, `GCP_INSUFFICIENT_CAPACITY`, `GCP_IP_SPACE_EXHAUSTED`, `GCP_KMS_KEY_PERMISSION_DENIED`, `GCP_NOT_FOUND`, `GCP_QUOTA_EXCEEDED`, `GCP_RESOURCE_QUOTA_EXCEEDED`, `GCP_SERVICE_ACCOUNT_ACCESS_DENIED`, `GCP_SERVICE_ACCOUNT_DELETED`, `GCP_SERVICE_ACCOUNT_NOT_FOUND`, `GCP_SUBNET_NOT_READY`, `GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED`, `GKE_BASED_CLUSTER_TERMINATION`, `GLOBAL_INIT_SCRIPT_FAILURE`, `HIVE_METASTORE_PROVISIONING_FAILURE`, `IMAGE_PULL_PERMISSION_DENIED`, `INACTIVITY`, `INIT_CONTAINER_NOT_FINISHED`, `INIT_SCRIPT_FAILURE`, `INSTANCE_POOL_CLUSTER_FAILURE`, `INSTANCE_POOL_MAX_CAPACITY_REACHED`, `INSTANCE_POOL_NOT_FOUND`, `INSTANCE_UNREACHABLE`, `INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG`, `INTERNAL_CAPACITY_FAILURE`, `INTERNAL_ERROR`, `INVALID_ARGUMENT`, `INVALID_AWS_PARAMETER`, `INVALID_INSTANCE_PLACEMENT_PROTOCOL`, `INVALID_SPARK_IMAGE`, `INVALID_WORKER_IMAGE_FAILURE`, `IN_PENALTY_BOX`, `IP_EXHAUSTION_FAILURE`, `JOB_FINISHED`, `K8S_AUTOSCALING_FAILURE`, `K8S_DBR_CLUSTER_LAUNCH_TIMEOUT`, `LAZY_ALLOCATION_TIMEOUT`, `MAINTENANCE_MODE`, `METASTORE_COMPONENT_UNHEALTHY`, `NEPHOS_RESOURCE_MANAGEMENT`, `NETVISOR_SETUP_TIMEOUT`, `NETWORK_CHECK_CONTROL_PLANE_FAILURE`, `NETWORK_CHECK_DNS_SERVER_FAILURE`, `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE`, `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE`, `NETWORK_CHECK_NIC_FAILURE`, `NETWORK_CHECK_STORAGE_FAILURE`, `NETWORK_CONFIGURATION_FAILURE`, `NFS_MOUNT_FAILURE`, `NO_MATCHED_K8S`, `NO_MATCHED_K8S_TESTING_TAG`, `NPIP_TUNNEL_SETUP_FAILURE`, `NPIP_TUNNEL_TOKEN_FAILURE`, `POD_ASSIGNMENT_FAILURE`, `POD_SCHEDULING_FAILURE`, `REQUEST_REJECTED`, `REQUEST_THROTTLED`, `RESOURCE_USAGE_BLOCKED`, `SECRET_CREATION_FAILURE`, `SECRET_PERMISSION_DENIED`, `SECRET_RESOLUTION_ERROR`, `SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION`, `SECURITY_DAEMON_REGISTRATION_EXCEPTION`, `SELF_BOOTSTRAP_FAILURE`, `SERVERLESS_LONG_RUNNING_TERMINATED`, `SKIPPED_SLOW_NODES`, `SLOW_IMAGE_DOWNLOAD`, `SPARK_ERROR`, `SPARK_IMAGE_DOWNLOAD_FAILURE`, `SPARK_IMAGE_DOWNLOAD_THROTTLED`, `SPARK_IMAGE_NOT_FOUND`, `SPARK_STARTUP_FAILURE`, `SPOT_INSTANCE_TERMINATION`, `SSH_BOOTSTRAP_FAILURE`, `STORAGE_DOWNLOAD_FAILURE`, `STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG`, `STORAGE_DOWNLOAD_FAILURE_SLOW`, `STORAGE_DOWNLOAD_FAILURE_THROTTLED`, `STS_CLIENT_SETUP_FAILURE`, `SUBNET_EXHAUSTED_FAILURE`, `TEMPORARILY_UNAVAILABLE`, `TRIAL_EXPIRED`, `UNEXPECTED_LAUNCH_FAILURE`, `UNEXPECTED_POD_RECREATION`, `UNKNOWN`, `UNSUPPORTED_INSTANCE_TYPE`, `UPDATE_INSTANCE_PROFILE_FAILURE`, `USER_INITIATED_VM_TERMINATION`, `USER_REQUEST`, `WORKER_SETUP_FAILURE`, `WORKSPACE_CANCELLED_ERROR`, `WORKSPACE_CONFIGURATION_ERROR`, `WORKSPACE_UPDATE`: + case `ABUSE_DETECTED`, `ACCESS_TOKEN_FAILURE`, `ALLOCATION_TIMEOUT`, `ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY`, `ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_READY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS`, `ATTACH_PROJECT_FAILURE`, `AWS_AUTHORIZATION_FAILURE`, `AWS_INACCESSIBLE_KMS_KEY_FAILURE`, `AWS_INSTANCE_PROFILE_UPDATE_FAILURE`, `AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE`, `AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE`, `AWS_INVALID_KEY_PAIR`, `AWS_INVALID_KMS_KEY_STATE`, `AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE`, `AWS_REQUEST_LIMIT_EXCEEDED`, `AWS_RESOURCE_QUOTA_EXCEEDED`, `AWS_UNSUPPORTED_FAILURE`, `AZURE_BYOK_KEY_PERMISSION_FAILURE`, `AZURE_EPHEMERAL_DISK_FAILURE`, `AZURE_INVALID_DEPLOYMENT_TEMPLATE`, `AZURE_OPERATION_NOT_ALLOWED_EXCEPTION`, `AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE`, `AZURE_QUOTA_EXCEEDED_EXCEPTION`, `AZURE_RESOURCE_MANAGER_THROTTLING`, `AZURE_RESOURCE_PROVIDER_THROTTLING`, `AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE`, `AZURE_VM_EXTENSION_FAILURE`, `AZURE_VNET_CONFIGURATION_FAILURE`, `BOOTSTRAP_TIMEOUT`, `BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION`, `BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG`, `BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED`, `BUDGET_POLICY_RESOLUTION_FAILURE`, `CLOUD_ACCOUNT_SETUP_FAILURE`, `CLOUD_OPERATION_CANCELLED`, `CLOUD_PROVIDER_DISK_SETUP_FAILURE`, `CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED`, `CLOUD_PROVIDER_LAUNCH_FAILURE`, `CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_SHUTDOWN`, `CLUSTER_OPERATION_THROTTLED`, `CLUSTER_OPERATION_TIMEOUT`, `COMMUNICATION_LOST`, `CONTAINER_LAUNCH_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG`, `DATABASE_CONNECTION_FAILURE`, `DATA_ACCESS_CONFIG_CHANGED`, `DBFS_COMPONENT_UNHEALTHY`, `DISASTER_RECOVERY_REPLICATION`, `DNS_RESOLUTION_ERROR`, `DOCKER_CONTAINER_CREATION_EXCEPTION`, `DOCKER_IMAGE_PULL_FAILURE`, `DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION`, `DOCKER_INVALID_OS_EXCEPTION`, `DRIVER_DNS_RESOLUTION_FAILURE`, `DRIVER_EVICTION`, `DRIVER_LAUNCH_TIMEOUT`, `DRIVER_NODE_UNREACHABLE`, `DRIVER_OUT_OF_DISK`, `DRIVER_OUT_OF_MEMORY`, `DRIVER_POD_CREATION_FAILURE`, `DRIVER_UNEXPECTED_FAILURE`, `DRIVER_UNHEALTHY`, `DRIVER_UNREACHABLE`, `DRIVER_UNRESPONSIVE`, `DYNAMIC_SPARK_CONF_SIZE_EXCEEDED`, `EOS_SPARK_IMAGE`, `EXECUTION_COMPONENT_UNHEALTHY`, `EXECUTOR_POD_UNSCHEDULED`, `GCP_API_RATE_QUOTA_EXCEEDED`, `GCP_DENIED_BY_ORG_POLICY`, `GCP_FORBIDDEN`, `GCP_IAM_TIMEOUT`, `GCP_INACCESSIBLE_KMS_KEY_FAILURE`, `GCP_INSUFFICIENT_CAPACITY`, `GCP_IP_SPACE_EXHAUSTED`, `GCP_KMS_KEY_PERMISSION_DENIED`, `GCP_NOT_FOUND`, `GCP_QUOTA_EXCEEDED`, `GCP_RESOURCE_QUOTA_EXCEEDED`, `GCP_SERVICE_ACCOUNT_ACCESS_DENIED`, `GCP_SERVICE_ACCOUNT_DELETED`, `GCP_SERVICE_ACCOUNT_NOT_FOUND`, `GCP_SUBNET_NOT_READY`, `GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED`, `GKE_BASED_CLUSTER_TERMINATION`, `GLOBAL_INIT_SCRIPT_FAILURE`, `HIVE_METASTORE_PROVISIONING_FAILURE`, `IMAGE_PULL_PERMISSION_DENIED`, `INACTIVITY`, `INIT_CONTAINER_NOT_FINISHED`, `INIT_SCRIPT_FAILURE`, `INSTANCE_POOL_CLUSTER_FAILURE`, `INSTANCE_POOL_MAX_CAPACITY_REACHED`, `INSTANCE_POOL_NOT_FOUND`, `INSTANCE_UNREACHABLE`, `INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG`, `INTERNAL_CAPACITY_FAILURE`, `INTERNAL_ERROR`, `INVALID_ARGUMENT`, `INVALID_AWS_PARAMETER`, `INVALID_INSTANCE_PLACEMENT_PROTOCOL`, `INVALID_SPARK_IMAGE`, `INVALID_WORKER_IMAGE_FAILURE`, `IN_PENALTY_BOX`, `IP_EXHAUSTION_FAILURE`, `JOB_FINISHED`, `K8S_AUTOSCALING_FAILURE`, `K8S_DBR_CLUSTER_LAUNCH_TIMEOUT`, `LAZY_ALLOCATION_TIMEOUT`, `MAINTENANCE_MODE`, `METASTORE_COMPONENT_UNHEALTHY`, `NEPHOS_RESOURCE_MANAGEMENT`, `NETVISOR_SETUP_TIMEOUT`, `NETWORK_CHECK_CONTROL_PLANE_FAILURE`, `NETWORK_CHECK_DNS_SERVER_FAILURE`, `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE`, `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE`, `NETWORK_CHECK_NIC_FAILURE`, `NETWORK_CHECK_STORAGE_FAILURE`, `NETWORK_CONFIGURATION_FAILURE`, `NFS_MOUNT_FAILURE`, `NO_ACTIVATED_K8S`, `NO_MATCHED_K8S`, `NO_MATCHED_K8S_TESTING_TAG`, `NPIP_TUNNEL_SETUP_FAILURE`, `NPIP_TUNNEL_TOKEN_FAILURE`, `POD_ASSIGNMENT_FAILURE`, `POD_SCHEDULING_FAILURE`, `REQUEST_REJECTED`, `REQUEST_THROTTLED`, `RESOURCE_USAGE_BLOCKED`, `SECRET_CREATION_FAILURE`, `SECRET_PERMISSION_DENIED`, `SECRET_RESOLUTION_ERROR`, `SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION`, `SECURITY_DAEMON_REGISTRATION_EXCEPTION`, `SELF_BOOTSTRAP_FAILURE`, `SERVERLESS_LONG_RUNNING_TERMINATED`, `SKIPPED_SLOW_NODES`, `SLOW_IMAGE_DOWNLOAD`, `SPARK_ERROR`, `SPARK_IMAGE_DOWNLOAD_FAILURE`, `SPARK_IMAGE_DOWNLOAD_THROTTLED`, `SPARK_IMAGE_NOT_FOUND`, `SPARK_STARTUP_FAILURE`, `SPOT_INSTANCE_TERMINATION`, `SSH_BOOTSTRAP_FAILURE`, `STORAGE_DOWNLOAD_FAILURE`, `STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG`, `STORAGE_DOWNLOAD_FAILURE_SLOW`, `STORAGE_DOWNLOAD_FAILURE_THROTTLED`, `STS_CLIENT_SETUP_FAILURE`, `SUBNET_EXHAUSTED_FAILURE`, `TEMPORARILY_UNAVAILABLE`, `TRIAL_EXPIRED`, `UNEXPECTED_LAUNCH_FAILURE`, `UNEXPECTED_POD_RECREATION`, `UNKNOWN`, `UNSUPPORTED_INSTANCE_TYPE`, `UPDATE_INSTANCE_PROFILE_FAILURE`, `USAGE_POLICY_ENTITLEMENT_DENIED`, `USER_INITIATED_VM_TERMINATION`, `USER_REQUEST`, `WORKER_SETUP_FAILURE`, `WORKSPACE_CANCELLED_ERROR`, `WORKSPACE_CONFIGURATION_ERROR`, `WORKSPACE_UPDATE`: *f = TerminationReasonCode(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "ABUSE_DETECTED", "ACCESS_TOKEN_FAILURE", "ALLOCATION_TIMEOUT", "ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY", "ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS", "ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_READY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS", "ATTACH_PROJECT_FAILURE", "AWS_AUTHORIZATION_FAILURE", "AWS_INACCESSIBLE_KMS_KEY_FAILURE", "AWS_INSTANCE_PROFILE_UPDATE_FAILURE", "AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE", "AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE", "AWS_INVALID_KEY_PAIR", "AWS_INVALID_KMS_KEY_STATE", "AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE", "AWS_REQUEST_LIMIT_EXCEEDED", "AWS_RESOURCE_QUOTA_EXCEEDED", "AWS_UNSUPPORTED_FAILURE", "AZURE_BYOK_KEY_PERMISSION_FAILURE", "AZURE_EPHEMERAL_DISK_FAILURE", "AZURE_INVALID_DEPLOYMENT_TEMPLATE", "AZURE_OPERATION_NOT_ALLOWED_EXCEPTION", "AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE", "AZURE_QUOTA_EXCEEDED_EXCEPTION", "AZURE_RESOURCE_MANAGER_THROTTLING", "AZURE_RESOURCE_PROVIDER_THROTTLING", "AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE", "AZURE_VM_EXTENSION_FAILURE", "AZURE_VNET_CONFIGURATION_FAILURE", "BOOTSTRAP_TIMEOUT", "BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION", "BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG", "BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED", "BUDGET_POLICY_RESOLUTION_FAILURE", "CLOUD_ACCOUNT_SETUP_FAILURE", "CLOUD_OPERATION_CANCELLED", "CLOUD_PROVIDER_DISK_SETUP_FAILURE", "CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED", "CLOUD_PROVIDER_LAUNCH_FAILURE", "CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_RESOURCE_STOCKOUT", "CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_SHUTDOWN", "CLUSTER_OPERATION_THROTTLED", "CLUSTER_OPERATION_TIMEOUT", "COMMUNICATION_LOST", "CONTAINER_LAUNCH_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG", "DATABASE_CONNECTION_FAILURE", "DATA_ACCESS_CONFIG_CHANGED", "DBFS_COMPONENT_UNHEALTHY", "DISASTER_RECOVERY_REPLICATION", "DNS_RESOLUTION_ERROR", "DOCKER_CONTAINER_CREATION_EXCEPTION", "DOCKER_IMAGE_PULL_FAILURE", "DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION", "DOCKER_INVALID_OS_EXCEPTION", "DRIVER_DNS_RESOLUTION_FAILURE", "DRIVER_EVICTION", "DRIVER_LAUNCH_TIMEOUT", "DRIVER_NODE_UNREACHABLE", "DRIVER_OUT_OF_DISK", "DRIVER_OUT_OF_MEMORY", "DRIVER_POD_CREATION_FAILURE", "DRIVER_UNEXPECTED_FAILURE", "DRIVER_UNHEALTHY", "DRIVER_UNREACHABLE", "DRIVER_UNRESPONSIVE", "DYNAMIC_SPARK_CONF_SIZE_EXCEEDED", "EOS_SPARK_IMAGE", "EXECUTION_COMPONENT_UNHEALTHY", "EXECUTOR_POD_UNSCHEDULED", "GCP_API_RATE_QUOTA_EXCEEDED", "GCP_DENIED_BY_ORG_POLICY", "GCP_FORBIDDEN", "GCP_IAM_TIMEOUT", "GCP_INACCESSIBLE_KMS_KEY_FAILURE", "GCP_INSUFFICIENT_CAPACITY", "GCP_IP_SPACE_EXHAUSTED", "GCP_KMS_KEY_PERMISSION_DENIED", "GCP_NOT_FOUND", "GCP_QUOTA_EXCEEDED", "GCP_RESOURCE_QUOTA_EXCEEDED", "GCP_SERVICE_ACCOUNT_ACCESS_DENIED", "GCP_SERVICE_ACCOUNT_DELETED", "GCP_SERVICE_ACCOUNT_NOT_FOUND", "GCP_SUBNET_NOT_READY", "GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED", "GKE_BASED_CLUSTER_TERMINATION", "GLOBAL_INIT_SCRIPT_FAILURE", "HIVE_METASTORE_PROVISIONING_FAILURE", "IMAGE_PULL_PERMISSION_DENIED", "INACTIVITY", "INIT_CONTAINER_NOT_FINISHED", "INIT_SCRIPT_FAILURE", "INSTANCE_POOL_CLUSTER_FAILURE", "INSTANCE_POOL_MAX_CAPACITY_REACHED", "INSTANCE_POOL_NOT_FOUND", "INSTANCE_UNREACHABLE", "INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG", "INTERNAL_CAPACITY_FAILURE", "INTERNAL_ERROR", "INVALID_ARGUMENT", "INVALID_AWS_PARAMETER", "INVALID_INSTANCE_PLACEMENT_PROTOCOL", "INVALID_SPARK_IMAGE", "INVALID_WORKER_IMAGE_FAILURE", "IN_PENALTY_BOX", "IP_EXHAUSTION_FAILURE", "JOB_FINISHED", "K8S_AUTOSCALING_FAILURE", "K8S_DBR_CLUSTER_LAUNCH_TIMEOUT", "LAZY_ALLOCATION_TIMEOUT", "MAINTENANCE_MODE", "METASTORE_COMPONENT_UNHEALTHY", "NEPHOS_RESOURCE_MANAGEMENT", "NETVISOR_SETUP_TIMEOUT", "NETWORK_CHECK_CONTROL_PLANE_FAILURE", "NETWORK_CHECK_DNS_SERVER_FAILURE", "NETWORK_CHECK_METADATA_ENDPOINT_FAILURE", "NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE", "NETWORK_CHECK_NIC_FAILURE", "NETWORK_CHECK_STORAGE_FAILURE", "NETWORK_CONFIGURATION_FAILURE", "NFS_MOUNT_FAILURE", "NO_MATCHED_K8S", "NO_MATCHED_K8S_TESTING_TAG", "NPIP_TUNNEL_SETUP_FAILURE", "NPIP_TUNNEL_TOKEN_FAILURE", "POD_ASSIGNMENT_FAILURE", "POD_SCHEDULING_FAILURE", "REQUEST_REJECTED", "REQUEST_THROTTLED", "RESOURCE_USAGE_BLOCKED", "SECRET_CREATION_FAILURE", "SECRET_PERMISSION_DENIED", "SECRET_RESOLUTION_ERROR", "SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION", "SECURITY_DAEMON_REGISTRATION_EXCEPTION", "SELF_BOOTSTRAP_FAILURE", "SERVERLESS_LONG_RUNNING_TERMINATED", "SKIPPED_SLOW_NODES", "SLOW_IMAGE_DOWNLOAD", "SPARK_ERROR", "SPARK_IMAGE_DOWNLOAD_FAILURE", "SPARK_IMAGE_DOWNLOAD_THROTTLED", "SPARK_IMAGE_NOT_FOUND", "SPARK_STARTUP_FAILURE", "SPOT_INSTANCE_TERMINATION", "SSH_BOOTSTRAP_FAILURE", "STORAGE_DOWNLOAD_FAILURE", "STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG", "STORAGE_DOWNLOAD_FAILURE_SLOW", "STORAGE_DOWNLOAD_FAILURE_THROTTLED", "STS_CLIENT_SETUP_FAILURE", "SUBNET_EXHAUSTED_FAILURE", "TEMPORARILY_UNAVAILABLE", "TRIAL_EXPIRED", "UNEXPECTED_LAUNCH_FAILURE", "UNEXPECTED_POD_RECREATION", "UNKNOWN", "UNSUPPORTED_INSTANCE_TYPE", "UPDATE_INSTANCE_PROFILE_FAILURE", "USER_INITIATED_VM_TERMINATION", "USER_REQUEST", "WORKER_SETUP_FAILURE", "WORKSPACE_CANCELLED_ERROR", "WORKSPACE_CONFIGURATION_ERROR", "WORKSPACE_UPDATE"`, v) + return fmt.Errorf(`value "%s" is not one of "ABUSE_DETECTED", "ACCESS_TOKEN_FAILURE", "ALLOCATION_TIMEOUT", "ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY", "ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS", "ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_READY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS", "ATTACH_PROJECT_FAILURE", "AWS_AUTHORIZATION_FAILURE", "AWS_INACCESSIBLE_KMS_KEY_FAILURE", "AWS_INSTANCE_PROFILE_UPDATE_FAILURE", "AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE", "AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE", "AWS_INVALID_KEY_PAIR", "AWS_INVALID_KMS_KEY_STATE", "AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE", "AWS_REQUEST_LIMIT_EXCEEDED", "AWS_RESOURCE_QUOTA_EXCEEDED", "AWS_UNSUPPORTED_FAILURE", "AZURE_BYOK_KEY_PERMISSION_FAILURE", "AZURE_EPHEMERAL_DISK_FAILURE", "AZURE_INVALID_DEPLOYMENT_TEMPLATE", "AZURE_OPERATION_NOT_ALLOWED_EXCEPTION", "AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE", "AZURE_QUOTA_EXCEEDED_EXCEPTION", "AZURE_RESOURCE_MANAGER_THROTTLING", "AZURE_RESOURCE_PROVIDER_THROTTLING", "AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE", "AZURE_VM_EXTENSION_FAILURE", "AZURE_VNET_CONFIGURATION_FAILURE", "BOOTSTRAP_TIMEOUT", "BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION", "BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG", "BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED", "BUDGET_POLICY_RESOLUTION_FAILURE", "CLOUD_ACCOUNT_SETUP_FAILURE", "CLOUD_OPERATION_CANCELLED", "CLOUD_PROVIDER_DISK_SETUP_FAILURE", "CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED", "CLOUD_PROVIDER_LAUNCH_FAILURE", "CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_RESOURCE_STOCKOUT", "CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_SHUTDOWN", "CLUSTER_OPERATION_THROTTLED", "CLUSTER_OPERATION_TIMEOUT", "COMMUNICATION_LOST", "CONTAINER_LAUNCH_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG", "DATABASE_CONNECTION_FAILURE", "DATA_ACCESS_CONFIG_CHANGED", "DBFS_COMPONENT_UNHEALTHY", "DISASTER_RECOVERY_REPLICATION", "DNS_RESOLUTION_ERROR", "DOCKER_CONTAINER_CREATION_EXCEPTION", "DOCKER_IMAGE_PULL_FAILURE", "DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION", "DOCKER_INVALID_OS_EXCEPTION", "DRIVER_DNS_RESOLUTION_FAILURE", "DRIVER_EVICTION", "DRIVER_LAUNCH_TIMEOUT", "DRIVER_NODE_UNREACHABLE", "DRIVER_OUT_OF_DISK", "DRIVER_OUT_OF_MEMORY", "DRIVER_POD_CREATION_FAILURE", "DRIVER_UNEXPECTED_FAILURE", "DRIVER_UNHEALTHY", "DRIVER_UNREACHABLE", "DRIVER_UNRESPONSIVE", "DYNAMIC_SPARK_CONF_SIZE_EXCEEDED", "EOS_SPARK_IMAGE", "EXECUTION_COMPONENT_UNHEALTHY", "EXECUTOR_POD_UNSCHEDULED", "GCP_API_RATE_QUOTA_EXCEEDED", "GCP_DENIED_BY_ORG_POLICY", "GCP_FORBIDDEN", "GCP_IAM_TIMEOUT", "GCP_INACCESSIBLE_KMS_KEY_FAILURE", "GCP_INSUFFICIENT_CAPACITY", "GCP_IP_SPACE_EXHAUSTED", "GCP_KMS_KEY_PERMISSION_DENIED", "GCP_NOT_FOUND", "GCP_QUOTA_EXCEEDED", "GCP_RESOURCE_QUOTA_EXCEEDED", "GCP_SERVICE_ACCOUNT_ACCESS_DENIED", "GCP_SERVICE_ACCOUNT_DELETED", "GCP_SERVICE_ACCOUNT_NOT_FOUND", "GCP_SUBNET_NOT_READY", "GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED", "GKE_BASED_CLUSTER_TERMINATION", "GLOBAL_INIT_SCRIPT_FAILURE", "HIVE_METASTORE_PROVISIONING_FAILURE", "IMAGE_PULL_PERMISSION_DENIED", "INACTIVITY", "INIT_CONTAINER_NOT_FINISHED", "INIT_SCRIPT_FAILURE", "INSTANCE_POOL_CLUSTER_FAILURE", "INSTANCE_POOL_MAX_CAPACITY_REACHED", "INSTANCE_POOL_NOT_FOUND", "INSTANCE_UNREACHABLE", "INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG", "INTERNAL_CAPACITY_FAILURE", "INTERNAL_ERROR", "INVALID_ARGUMENT", "INVALID_AWS_PARAMETER", "INVALID_INSTANCE_PLACEMENT_PROTOCOL", "INVALID_SPARK_IMAGE", "INVALID_WORKER_IMAGE_FAILURE", "IN_PENALTY_BOX", "IP_EXHAUSTION_FAILURE", "JOB_FINISHED", "K8S_AUTOSCALING_FAILURE", "K8S_DBR_CLUSTER_LAUNCH_TIMEOUT", "LAZY_ALLOCATION_TIMEOUT", "MAINTENANCE_MODE", "METASTORE_COMPONENT_UNHEALTHY", "NEPHOS_RESOURCE_MANAGEMENT", "NETVISOR_SETUP_TIMEOUT", "NETWORK_CHECK_CONTROL_PLANE_FAILURE", "NETWORK_CHECK_DNS_SERVER_FAILURE", "NETWORK_CHECK_METADATA_ENDPOINT_FAILURE", "NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE", "NETWORK_CHECK_NIC_FAILURE", "NETWORK_CHECK_STORAGE_FAILURE", "NETWORK_CONFIGURATION_FAILURE", "NFS_MOUNT_FAILURE", "NO_ACTIVATED_K8S", "NO_MATCHED_K8S", "NO_MATCHED_K8S_TESTING_TAG", "NPIP_TUNNEL_SETUP_FAILURE", "NPIP_TUNNEL_TOKEN_FAILURE", "POD_ASSIGNMENT_FAILURE", "POD_SCHEDULING_FAILURE", "REQUEST_REJECTED", "REQUEST_THROTTLED", "RESOURCE_USAGE_BLOCKED", "SECRET_CREATION_FAILURE", "SECRET_PERMISSION_DENIED", "SECRET_RESOLUTION_ERROR", "SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION", "SECURITY_DAEMON_REGISTRATION_EXCEPTION", "SELF_BOOTSTRAP_FAILURE", "SERVERLESS_LONG_RUNNING_TERMINATED", "SKIPPED_SLOW_NODES", "SLOW_IMAGE_DOWNLOAD", "SPARK_ERROR", "SPARK_IMAGE_DOWNLOAD_FAILURE", "SPARK_IMAGE_DOWNLOAD_THROTTLED", "SPARK_IMAGE_NOT_FOUND", "SPARK_STARTUP_FAILURE", "SPOT_INSTANCE_TERMINATION", "SSH_BOOTSTRAP_FAILURE", "STORAGE_DOWNLOAD_FAILURE", "STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG", "STORAGE_DOWNLOAD_FAILURE_SLOW", "STORAGE_DOWNLOAD_FAILURE_THROTTLED", "STS_CLIENT_SETUP_FAILURE", "SUBNET_EXHAUSTED_FAILURE", "TEMPORARILY_UNAVAILABLE", "TRIAL_EXPIRED", "UNEXPECTED_LAUNCH_FAILURE", "UNEXPECTED_POD_RECREATION", "UNKNOWN", "UNSUPPORTED_INSTANCE_TYPE", "UPDATE_INSTANCE_PROFILE_FAILURE", "USAGE_POLICY_ENTITLEMENT_DENIED", "USER_INITIATED_VM_TERMINATION", "USER_REQUEST", "WORKER_SETUP_FAILURE", "WORKSPACE_CANCELLED_ERROR", "WORKSPACE_CONFIGURATION_ERROR", "WORKSPACE_UPDATE"`, v) } } @@ -5905,6 +6204,7 @@ func (f *TerminationReasonCode) Values() []TerminationReasonCode { TerminationReasonCodeNetworkCheckStorageFailure, TerminationReasonCodeNetworkConfigurationFailure, TerminationReasonCodeNfsMountFailure, + TerminationReasonCodeNoActivatedK8s, TerminationReasonCodeNoMatchedK8s, TerminationReasonCodeNoMatchedK8sTestingTag, TerminationReasonCodeNpipTunnelSetupFailure, @@ -5943,6 +6243,7 @@ func (f *TerminationReasonCode) Values() []TerminationReasonCode { TerminationReasonCodeUnknown, TerminationReasonCodeUnsupportedInstanceType, TerminationReasonCodeUpdateInstanceProfileFailure, + TerminationReasonCodeUsagePolicyEntitlementDenied, TerminationReasonCodeUserInitiatedVmTermination, TerminationReasonCodeUserRequest, TerminationReasonCodeWorkerSetupFailure, @@ -6198,6 +6499,28 @@ func (s UpdateClusterResource) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateDefaultBaseEnvironmentRequest struct { + DefaultBaseEnvironment DefaultBaseEnvironment `json:"default_base_environment"` + + Id string `json:"-" url:"-"` +} + +type UpdateDefaultDefaultBaseEnvironmentRequest struct { + BaseEnvironmentType BaseEnvironmentType `json:"base_environment_type,omitempty"` + + Id string `json:"id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateDefaultDefaultBaseEnvironmentRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateDefaultDefaultBaseEnvironmentRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // A storage location back by UC Volumes. type VolumesStorageInfo struct { // UC Volumes destination, e.g. diff --git a/service/dashboards/api.go b/service/dashboards/api.go index ba977b176..1254d1629 100755 --- a/service/dashboards/api.go +++ b/service/dashboards/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Genie, Lakeview, Lakeview Embedded, etc. +// These APIs allow you to manage Genie, Lakeview, Lakeview Embedded, Query Execution, etc. package dashboards import ( @@ -33,19 +33,59 @@ type GenieInterface interface { // Deprecated: use [GenieAPIInterface.CreateMessage].Get() or [GenieAPIInterface.WaitGetMessageGenieCompleted] CreateMessageAndWait(ctx context.Context, genieCreateConversationMessageRequest GenieCreateConversationMessageRequest, options ...retries.Option[GenieMessage]) (*GenieMessage, error) + // Creates a Genie space from a serialized payload. + CreateSpace(ctx context.Context, request GenieCreateSpaceRequest) (*GenieSpace, error) + // Delete a conversation. DeleteConversation(ctx context.Context, request GenieDeleteConversationRequest) error // Delete a conversation. DeleteConversationBySpaceIdAndConversationId(ctx context.Context, spaceId string, conversationId string) error + // Delete a conversation message. + DeleteConversationMessage(ctx context.Context, request GenieDeleteConversationMessageRequest) error + // Execute the SQL for a message query attachment. Use this API when the query // attachment has expired and needs to be re-executed. ExecuteMessageAttachmentQuery(ctx context.Context, request GenieExecuteMessageAttachmentQueryRequest) (*GenieGetMessageQueryResultResponse, error) - // Execute the SQL query in the message. + // DEPRECATED: Use [Execute Message Attachment + // Query](:method:genie/executemessageattachmentquery) instead. ExecuteMessageQuery(ctx context.Context, request GenieExecuteMessageQueryRequest) (*GenieGetMessageQueryResultResponse, error) + // Initiates a new SQL execution and returns a `download_id` that you can use to + // track the progress of the download. The query result is stored in an external + // link and can be retrieved using the [Get Download Full Query + // Result](:method:genie/getdownloadfullqueryresult) API. Warning: Databricks + // strongly recommends that you protect the URLs that are returned by the + // `EXTERNAL_LINKS` disposition. See [Execute + // Statement](:method:statementexecution/executestatement) for more details. + GenerateDownloadFullQueryResult(ctx context.Context, request GenieGenerateDownloadFullQueryResultRequest) (*GenieGenerateDownloadFullQueryResultResponse, error) + + // After [Generating a Full Query Result + // Download](:method:genie/getdownloadfullqueryresult) and successfully + // receiving a `download_id`, use this API to poll the download progress. When + // the download is complete, the API returns one or more external links to the + // query result files. Warning: Databricks strongly recommends that you protect + // the URLs that are returned by the `EXTERNAL_LINKS` disposition. You must not + // set an Authorization header in download requests. When using the + // `EXTERNAL_LINKS` disposition, Databricks returns presigned URLs that grant + // temporary access to data. See [Execute + // Statement](:method:statementexecution/executestatement) for more details. + GetDownloadFullQueryResult(ctx context.Context, request GenieGetDownloadFullQueryResultRequest) (*GenieGetDownloadFullQueryResultResponse, error) + + // After [Generating a Full Query Result + // Download](:method:genie/getdownloadfullqueryresult) and successfully + // receiving a `download_id`, use this API to poll the download progress. When + // the download is complete, the API returns one or more external links to the + // query result files. Warning: Databricks strongly recommends that you protect + // the URLs that are returned by the `EXTERNAL_LINKS` disposition. You must not + // set an Authorization header in download requests. When using the + // `EXTERNAL_LINKS` disposition, Databricks returns presigned URLs that grant + // temporary access to data. See [Execute + // Statement](:method:statementexecution/executestatement) for more details. + GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string, downloadId string) (*GenieGetDownloadFullQueryResultResponse, error) + // Get message from conversation. GetMessage(ctx context.Context, request GenieGetConversationMessageRequest) (*GenieMessage, error) @@ -62,24 +102,20 @@ type GenieInterface interface { // `EXECUTING_QUERY` OR `COMPLETED`. GetMessageAttachmentQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This is - // only available if a message has a query attachment and the message status is - // `EXECUTING_QUERY`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResult(ctx context.Context, request GenieGetMessageQueryResultRequest) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This is - // only available if a message has a query attachment and the message status is - // `EXECUTING_QUERY`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResultBySpaceIdAndConversationIdAndMessageId(ctx context.Context, spaceId string, conversationId string, messageId string) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This is - // only available if a message has a query attachment and the message status is - // `EXECUTING_QUERY` OR `COMPLETED`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResultByAttachment(ctx context.Context, request GenieGetQueryResultByAttachmentRequest) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This is - // only available if a message has a query attachment and the message status is - // `EXECUTING_QUERY` OR `COMPLETED`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResultByAttachmentBySpaceIdAndConversationIdAndMessageIdAndAttachmentId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string) (*GenieGetMessageQueryResultResponse, error) // Get details of a Genie Space. @@ -88,6 +124,9 @@ type GenieInterface interface { // Get details of a Genie Space. GetSpaceBySpaceId(ctx context.Context, spaceId string) (*GenieSpace, error) + // List messages in a conversation + ListConversationMessages(ctx context.Context, request GenieListConversationMessagesRequest) (*GenieListConversationMessagesResponse, error) + // Get a list of conversations in a Genie Space. ListConversations(ctx context.Context, request GenieListConversationsRequest) (*GenieListConversationsResponse, error) @@ -97,6 +136,9 @@ type GenieInterface interface { // Get list of Genie Spaces. ListSpaces(ctx context.Context, request GenieListSpacesRequest) (*GenieListSpacesResponse, error) + // Send feedback for a message. + SendMessageFeedback(ctx context.Context, request GenieSendMessageFeedbackRequest) error + // Start a new conversation. StartConversation(ctx context.Context, genieStartConversationMessageRequest GenieStartConversationMessageRequest) (*WaitGetMessageGenieCompleted[GenieStartConversationResponse], error) @@ -113,6 +155,9 @@ type GenieInterface interface { // Move a Genie Space to the trash. TrashSpaceBySpaceId(ctx context.Context, spaceId string) error + + // Updates a Genie space with a serialized payload. + UpdateSpace(ctx context.Context, request GenieUpdateSpaceRequest) (*GenieSpace, error) } func NewGenie(client *client.DatabricksClient) *GenieAPI { @@ -246,6 +291,26 @@ func (a *GenieAPI) DeleteConversationBySpaceIdAndConversationId(ctx context.Cont }) } +// After [Generating a Full Query Result +// Download](:method:genie/getdownloadfullqueryresult) and successfully +// receiving a `download_id`, use this API to poll the download progress. When +// the download is complete, the API returns one or more external links to the +// query result files. Warning: Databricks strongly recommends that you protect +// the URLs that are returned by the `EXTERNAL_LINKS` disposition. You must not +// set an Authorization header in download requests. When using the +// `EXTERNAL_LINKS` disposition, Databricks returns presigned URLs that grant +// temporary access to data. See [Execute +// Statement](:method:statementexecution/executestatement) for more details. +func (a *GenieAPI) GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string, downloadId string) (*GenieGetDownloadFullQueryResultResponse, error) { + return a.genieImpl.GetDownloadFullQueryResult(ctx, GenieGetDownloadFullQueryResultRequest{ + SpaceId: spaceId, + ConversationId: conversationId, + MessageId: messageId, + AttachmentId: attachmentId, + DownloadId: downloadId, + }) +} + // Get message from conversation. func (a *GenieAPI) GetMessageBySpaceIdAndConversationIdAndMessageId(ctx context.Context, spaceId string, conversationId string, messageId string) (*GenieMessage, error) { return a.genieImpl.GetMessage(ctx, GenieGetConversationMessageRequest{ @@ -267,9 +332,8 @@ func (a *GenieAPI) GetMessageAttachmentQueryResultBySpaceIdAndConversationIdAndM }) } -// Get the result of SQL query if the message has a query attachment. This is -// only available if a message has a query attachment and the message status is -// `EXECUTING_QUERY`. +// DEPRECATED: Use [Get Message Attachment Query +// Result](:method:genie/getmessageattachmentqueryresult) instead. func (a *GenieAPI) GetMessageQueryResultBySpaceIdAndConversationIdAndMessageId(ctx context.Context, spaceId string, conversationId string, messageId string) (*GenieGetMessageQueryResultResponse, error) { return a.genieImpl.GetMessageQueryResult(ctx, GenieGetMessageQueryResultRequest{ SpaceId: spaceId, @@ -278,9 +342,8 @@ func (a *GenieAPI) GetMessageQueryResultBySpaceIdAndConversationIdAndMessageId(c }) } -// Get the result of SQL query if the message has a query attachment. This is -// only available if a message has a query attachment and the message status is -// `EXECUTING_QUERY` OR `COMPLETED`. +// DEPRECATED: Use [Get Message Attachment Query +// Result](:method:genie/getmessageattachmentqueryresult) instead. func (a *GenieAPI) GetMessageQueryResultByAttachmentBySpaceIdAndConversationIdAndMessageIdAndAttachmentId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string) (*GenieGetMessageQueryResultResponse, error) { return a.genieImpl.GetMessageQueryResultByAttachment(ctx, GenieGetQueryResultByAttachmentRequest{ SpaceId: spaceId, @@ -559,6 +622,12 @@ func (a *LakeviewAPI) UnpublishByDashboardId(ctx context.Context, dashboardId st type LakeviewEmbeddedInterface interface { + // Get the current published dashboard within an embedded context. + GetPublishedDashboardEmbedded(ctx context.Context, request GetPublishedDashboardEmbeddedRequest) error + + // Get the current published dashboard within an embedded context. + GetPublishedDashboardEmbeddedByDashboardId(ctx context.Context, dashboardId string) error + // Get a required authorization details and scopes of a published dashboard to // mint an OAuth token. GetPublishedDashboardTokenInfo(ctx context.Context, request GetPublishedDashboardTokenInfoRequest) (*GetPublishedDashboardTokenInfoResponse, error) @@ -581,6 +650,13 @@ type LakeviewEmbeddedAPI struct { lakeviewEmbeddedImpl } +// Get the current published dashboard within an embedded context. +func (a *LakeviewEmbeddedAPI) GetPublishedDashboardEmbeddedByDashboardId(ctx context.Context, dashboardId string) error { + return a.lakeviewEmbeddedImpl.GetPublishedDashboardEmbedded(ctx, GetPublishedDashboardEmbeddedRequest{ + DashboardId: dashboardId, + }) +} + // Get a required authorization details and scopes of a published dashboard to // mint an OAuth token. func (a *LakeviewEmbeddedAPI) GetPublishedDashboardTokenInfoByDashboardId(ctx context.Context, dashboardId string) (*GetPublishedDashboardTokenInfoResponse, error) { @@ -588,3 +664,28 @@ func (a *LakeviewEmbeddedAPI) GetPublishedDashboardTokenInfoByDashboardId(ctx co DashboardId: dashboardId, }) } + +type QueryExecutionInterface interface { + + // Cancel the results for the a query for a published, embedded dashboard. + CancelPublishedQueryExecution(ctx context.Context, request CancelPublishedQueryExecutionRequest) (*CancelQueryExecutionResponse, error) + + // Execute a query for a published dashboard. + ExecutePublishedDashboardQuery(ctx context.Context, request ExecutePublishedDashboardQueryRequest) error + + // Poll the results for the a query for a published, embedded dashboard. + PollPublishedQueryStatus(ctx context.Context, request PollPublishedQueryStatusRequest) (*PollQueryStatusResponse, error) +} + +func NewQueryExecution(client *client.DatabricksClient) *QueryExecutionAPI { + return &QueryExecutionAPI{ + queryExecutionImpl: queryExecutionImpl{ + client: client, + }, + } +} + +// Query execution APIs for AI / BI Dashboards +type QueryExecutionAPI struct { + queryExecutionImpl +} diff --git a/service/dashboards/impl.go b/service/dashboards/impl.go index 06e76e49e..42635847d 100755 --- a/service/dashboards/impl.go +++ b/service/dashboards/impl.go @@ -28,6 +28,17 @@ func (a *genieImpl) CreateMessage(ctx context.Context, request GenieCreateConver return &genieMessage, err } +func (a *genieImpl) CreateSpace(ctx context.Context, request GenieCreateSpaceRequest) (*GenieSpace, error) { + var genieSpace GenieSpace + path := "/api/2.0/genie/spaces" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &genieSpace) + return &genieSpace, err +} + func (a *genieImpl) DeleteConversation(ctx context.Context, request GenieDeleteConversationRequest) error { path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v", request.SpaceId, request.ConversationId) queryParams := make(map[string]any) @@ -37,6 +48,15 @@ func (a *genieImpl) DeleteConversation(ctx context.Context, request GenieDeleteC return err } +func (a *genieImpl) DeleteConversationMessage(ctx context.Context, request GenieDeleteConversationMessageRequest) error { + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v", request.SpaceId, request.ConversationId, request.MessageId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + func (a *genieImpl) ExecuteMessageAttachmentQuery(ctx context.Context, request GenieExecuteMessageAttachmentQueryRequest) (*GenieGetMessageQueryResultResponse, error) { var genieGetMessageQueryResultResponse GenieGetMessageQueryResultResponse path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/execute-query", request.SpaceId, request.ConversationId, request.MessageId, request.AttachmentId) @@ -57,6 +77,26 @@ func (a *genieImpl) ExecuteMessageQuery(ctx context.Context, request GenieExecut return &genieGetMessageQueryResultResponse, err } +func (a *genieImpl) GenerateDownloadFullQueryResult(ctx context.Context, request GenieGenerateDownloadFullQueryResultRequest) (*GenieGenerateDownloadFullQueryResultResponse, error) { + var genieGenerateDownloadFullQueryResultResponse GenieGenerateDownloadFullQueryResultResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/downloads", request.SpaceId, request.ConversationId, request.MessageId, request.AttachmentId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &genieGenerateDownloadFullQueryResultResponse) + return &genieGenerateDownloadFullQueryResultResponse, err +} + +func (a *genieImpl) GetDownloadFullQueryResult(ctx context.Context, request GenieGetDownloadFullQueryResultRequest) (*GenieGetDownloadFullQueryResultResponse, error) { + var genieGetDownloadFullQueryResultResponse GenieGetDownloadFullQueryResultResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/downloads/%v", request.SpaceId, request.ConversationId, request.MessageId, request.AttachmentId, request.DownloadId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieGetDownloadFullQueryResultResponse) + return &genieGetDownloadFullQueryResultResponse, err +} + func (a *genieImpl) GetMessage(ctx context.Context, request GenieGetConversationMessageRequest) (*GenieMessage, error) { var genieMessage GenieMessage path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v", request.SpaceId, request.ConversationId, request.MessageId) @@ -107,6 +147,16 @@ func (a *genieImpl) GetSpace(ctx context.Context, request GenieGetSpaceRequest) return &genieSpace, err } +func (a *genieImpl) ListConversationMessages(ctx context.Context, request GenieListConversationMessagesRequest) (*GenieListConversationMessagesResponse, error) { + var genieListConversationMessagesResponse GenieListConversationMessagesResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages", request.SpaceId, request.ConversationId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieListConversationMessagesResponse) + return &genieListConversationMessagesResponse, err +} + func (a *genieImpl) ListConversations(ctx context.Context, request GenieListConversationsRequest) (*GenieListConversationsResponse, error) { var genieListConversationsResponse GenieListConversationsResponse path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations", request.SpaceId) @@ -127,6 +177,16 @@ func (a *genieImpl) ListSpaces(ctx context.Context, request GenieListSpacesReque return &genieListSpacesResponse, err } +func (a *genieImpl) SendMessageFeedback(ctx context.Context, request GenieSendMessageFeedbackRequest) error { + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/feedback", request.SpaceId, request.ConversationId, request.MessageId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) + return err +} + func (a *genieImpl) StartConversation(ctx context.Context, request GenieStartConversationMessageRequest) (*GenieStartConversationResponse, error) { var genieStartConversationResponse GenieStartConversationResponse path := fmt.Sprintf("/api/2.0/genie/spaces/%v/start-conversation", request.SpaceId) @@ -147,6 +207,17 @@ func (a *genieImpl) TrashSpace(ctx context.Context, request GenieTrashSpaceReque return err } +func (a *genieImpl) UpdateSpace(ctx context.Context, request GenieUpdateSpaceRequest) (*GenieSpace, error) { + var genieSpace GenieSpace + path := fmt.Sprintf("/api/2.0/genie/spaces/%v", request.SpaceId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &genieSpace) + return &genieSpace, err +} + // unexported type that holds implementations of just Lakeview API methods type lakeviewImpl struct { client *client.DatabricksClient @@ -433,6 +504,15 @@ type lakeviewEmbeddedImpl struct { client *client.DatabricksClient } +func (a *lakeviewEmbeddedImpl) GetPublishedDashboardEmbedded(ctx context.Context, request GetPublishedDashboardEmbeddedRequest) error { + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published/embedded", request.DashboardId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, nil) + return err +} + func (a *lakeviewEmbeddedImpl) GetPublishedDashboardTokenInfo(ctx context.Context, request GetPublishedDashboardTokenInfoRequest) (*GetPublishedDashboardTokenInfoResponse, error) { var getPublishedDashboardTokenInfoResponse GetPublishedDashboardTokenInfoResponse path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published/tokeninfo", request.DashboardId) @@ -442,3 +522,38 @@ func (a *lakeviewEmbeddedImpl) GetPublishedDashboardTokenInfo(ctx context.Contex err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPublishedDashboardTokenInfoResponse) return &getPublishedDashboardTokenInfoResponse, err } + +// unexported type that holds implementations of just QueryExecution API methods +type queryExecutionImpl struct { + client *client.DatabricksClient +} + +func (a *queryExecutionImpl) CancelPublishedQueryExecution(ctx context.Context, request CancelPublishedQueryExecutionRequest) (*CancelQueryExecutionResponse, error) { + var cancelQueryExecutionResponse CancelQueryExecutionResponse + path := "/api/2.0/lakeview-query/query/published" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &cancelQueryExecutionResponse) + return &cancelQueryExecutionResponse, err +} + +func (a *queryExecutionImpl) ExecutePublishedDashboardQuery(ctx context.Context, request ExecutePublishedDashboardQueryRequest) error { + path := "/api/2.0/lakeview-query/query/published" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) + return err +} + +func (a *queryExecutionImpl) PollPublishedQueryStatus(ctx context.Context, request PollPublishedQueryStatusRequest) (*PollQueryStatusResponse, error) { + var pollQueryStatusResponse PollQueryStatusResponse + path := "/api/2.0/lakeview-query/query/published" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &pollQueryStatusResponse) + return &pollQueryStatusResponse, err +} diff --git a/service/dashboards/interface.go b/service/dashboards/interface.go index 8abc6f1e0..1faa37374 100755 --- a/service/dashboards/interface.go +++ b/service/dashboards/interface.go @@ -20,16 +20,44 @@ type GenieService interface { // to respond. CreateMessage(ctx context.Context, request GenieCreateConversationMessageRequest) (*GenieMessage, error) + // Creates a Genie space from a serialized payload. + CreateSpace(ctx context.Context, request GenieCreateSpaceRequest) (*GenieSpace, error) + // Delete a conversation. DeleteConversation(ctx context.Context, request GenieDeleteConversationRequest) error + // Delete a conversation message. + DeleteConversationMessage(ctx context.Context, request GenieDeleteConversationMessageRequest) error + // Execute the SQL for a message query attachment. Use this API when the // query attachment has expired and needs to be re-executed. ExecuteMessageAttachmentQuery(ctx context.Context, request GenieExecuteMessageAttachmentQueryRequest) (*GenieGetMessageQueryResultResponse, error) - // Execute the SQL query in the message. + // DEPRECATED: Use [Execute Message Attachment + // Query](:method:genie/executemessageattachmentquery) instead. ExecuteMessageQuery(ctx context.Context, request GenieExecuteMessageQueryRequest) (*GenieGetMessageQueryResultResponse, error) + // Initiates a new SQL execution and returns a `download_id` that you can + // use to track the progress of the download. The query result is stored in + // an external link and can be retrieved using the [Get Download Full Query + // Result](:method:genie/getdownloadfullqueryresult) API. Warning: + // Databricks strongly recommends that you protect the URLs that are + // returned by the `EXTERNAL_LINKS` disposition. See [Execute + // Statement](:method:statementexecution/executestatement) for more details. + GenerateDownloadFullQueryResult(ctx context.Context, request GenieGenerateDownloadFullQueryResultRequest) (*GenieGenerateDownloadFullQueryResultResponse, error) + + // After [Generating a Full Query Result + // Download](:method:genie/getdownloadfullqueryresult) and successfully + // receiving a `download_id`, use this API to poll the download progress. + // When the download is complete, the API returns one or more external links + // to the query result files. Warning: Databricks strongly recommends that + // you protect the URLs that are returned by the `EXTERNAL_LINKS` + // disposition. You must not set an Authorization header in download + // requests. When using the `EXTERNAL_LINKS` disposition, Databricks returns + // presigned URLs that grant temporary access to data. See [Execute + // Statement](:method:statementexecution/executestatement) for more details. + GetDownloadFullQueryResult(ctx context.Context, request GenieGetDownloadFullQueryResultRequest) (*GenieGetDownloadFullQueryResultResponse, error) + // Get message from conversation. GetMessage(ctx context.Context, request GenieGetConversationMessageRequest) (*GenieMessage, error) @@ -38,30 +66,37 @@ type GenieService interface { // status is `EXECUTING_QUERY` OR `COMPLETED`. GetMessageAttachmentQueryResult(ctx context.Context, request GenieGetMessageAttachmentQueryResultRequest) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This - // is only available if a message has a query attachment and the message - // status is `EXECUTING_QUERY`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResult(ctx context.Context, request GenieGetMessageQueryResultRequest) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This - // is only available if a message has a query attachment and the message - // status is `EXECUTING_QUERY` OR `COMPLETED`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResultByAttachment(ctx context.Context, request GenieGetQueryResultByAttachmentRequest) (*GenieGetMessageQueryResultResponse, error) // Get details of a Genie Space. GetSpace(ctx context.Context, request GenieGetSpaceRequest) (*GenieSpace, error) + // List messages in a conversation + ListConversationMessages(ctx context.Context, request GenieListConversationMessagesRequest) (*GenieListConversationMessagesResponse, error) + // Get a list of conversations in a Genie Space. ListConversations(ctx context.Context, request GenieListConversationsRequest) (*GenieListConversationsResponse, error) // Get list of Genie Spaces. ListSpaces(ctx context.Context, request GenieListSpacesRequest) (*GenieListSpacesResponse, error) + // Send feedback for a message. + SendMessageFeedback(ctx context.Context, request GenieSendMessageFeedbackRequest) error + // Start a new conversation. StartConversation(ctx context.Context, request GenieStartConversationMessageRequest) (*GenieStartConversationResponse, error) // Move a Genie Space to the trash. TrashSpace(ctx context.Context, request GenieTrashSpaceRequest) error + + // Updates a Genie space with a serialized payload. + UpdateSpace(ctx context.Context, request GenieUpdateSpaceRequest) (*GenieSpace, error) } // These APIs provide specific management operations for Lakeview dashboards. @@ -131,7 +166,25 @@ type LakeviewService interface { // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. type LakeviewEmbeddedService interface { + // Get the current published dashboard within an embedded context. + GetPublishedDashboardEmbedded(ctx context.Context, request GetPublishedDashboardEmbeddedRequest) error + // Get a required authorization details and scopes of a published dashboard // to mint an OAuth token. GetPublishedDashboardTokenInfo(ctx context.Context, request GetPublishedDashboardTokenInfoRequest) (*GetPublishedDashboardTokenInfoResponse, error) } + +// Query execution APIs for AI / BI Dashboards +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type QueryExecutionService interface { + + // Cancel the results for the a query for a published, embedded dashboard. + CancelPublishedQueryExecution(ctx context.Context, request CancelPublishedQueryExecutionRequest) (*CancelQueryExecutionResponse, error) + + // Execute a query for a published dashboard. + ExecutePublishedDashboardQuery(ctx context.Context, request ExecutePublishedDashboardQueryRequest) error + + // Poll the results for the a query for a published, embedded dashboard. + PollPublishedQueryStatus(ctx context.Context, request PollPublishedQueryStatusRequest) (*PollQueryStatusResponse, error) +} diff --git a/service/dashboards/model.go b/service/dashboards/model.go index fc9e03ee4..cfe87da41 100755 --- a/service/dashboards/model.go +++ b/service/dashboards/model.go @@ -51,6 +51,29 @@ func (s AuthorizationDetailsGrantRule) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CancelPublishedQueryExecutionRequest struct { + DashboardName string `json:"-" url:"dashboard_name"` + + DashboardRevisionId string `json:"-" url:"dashboard_revision_id"` + // Example: + // EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ + Tokens []string `json:"-" url:"tokens,omitempty"` +} + +type CancelQueryExecutionResponse struct { + Status []CancelQueryExecutionResponseStatus `json:"status,omitempty"` +} + +type CancelQueryExecutionResponseStatus struct { + // The token to poll for result asynchronously Example: + // EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ + DataToken string `json:"data_token"` + + Pending *Empty `json:"pending,omitempty"` + + Success *Empty `json:"success,omitempty"` +} + type CreateDashboardRequest struct { Dashboard Dashboard `json:"dashboard"` } @@ -206,10 +229,43 @@ func (s DeleteSubscriptionRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Represents an empty message, similar to google.protobuf.Empty, which is not +// available in the firm right now. +type Empty struct { +} + +// Execute query request for published Dashboards. Since published dashboards +// have the option of running as the publisher, the datasets, warehouse_id are +// excluded from the request and instead read from the source (lakeview-config) +// via the additional parameters (dashboardName and dashboardRevisionId) +type ExecutePublishedDashboardQueryRequest struct { + // Dashboard name and revision_id is required to retrieve + // PublishedDatasetDataModel which contains the list of datasets, + // warehouse_id, and embedded_credentials + DashboardName string `json:"dashboard_name"` + + DashboardRevisionId string `json:"dashboard_revision_id"` + // A dashboard schedule can override the warehouse used as compute for + // processing the published dashboard queries + OverrideWarehouseId string `json:"override_warehouse_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ExecutePublishedDashboardQueryRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ExecutePublishedDashboardQueryRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Genie AI Response type GenieAttachment struct { // Attachment ID AttachmentId string `json:"attachment_id,omitempty"` + // Follow-up questions suggested by Genie + FollowupQuestions *GenieFollowupQuestionsAttachment `json:"followup_questions,omitempty"` // Query Attachment if Genie responds with a SQL query Query *GenieQueryAttachment `json:"query,omitempty"` // Text Attachment if Genie responds with text @@ -270,6 +326,38 @@ type GenieCreateConversationMessageRequest struct { SpaceId string `json:"-" url:"-"` } +type GenieCreateSpaceRequest struct { + // Optional description + Description string `json:"description,omitempty"` + // Parent folder path where the space will be registered + ParentPath string `json:"parent_path,omitempty"` + // Serialized export model for the space contents + SerializedSpace string `json:"serialized_space"` + // Optional title override + Title string `json:"title,omitempty"` + // Warehouse to associate with the new space + WarehouseId string `json:"warehouse_id"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieCreateSpaceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieCreateSpaceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type GenieDeleteConversationMessageRequest struct { + // The ID associated with the conversation. + ConversationId string `json:"-" url:"-"` + // The ID associated with the message to delete. + MessageId string `json:"-" url:"-"` + // The ID associated with the Genie space where the message is located. + SpaceId string `json:"-" url:"-"` +} + type GenieDeleteConversationRequest struct { // The ID of the conversation to delete. ConversationId string `json:"-" url:"-"` @@ -297,6 +385,98 @@ type GenieExecuteMessageQueryRequest struct { SpaceId string `json:"-" url:"-"` } +// Feedback containing rating and optional comment +type GenieFeedback struct { + // Optional feedback comment text + Comment string `json:"comment,omitempty"` + // The feedback rating + Rating GenieFeedbackRating `json:"rating,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieFeedback) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieFeedback) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Feedback rating for Genie messages +type GenieFeedbackRating string + +const GenieFeedbackRatingNegative GenieFeedbackRating = `NEGATIVE` + +const GenieFeedbackRatingNone GenieFeedbackRating = `NONE` + +const GenieFeedbackRatingPositive GenieFeedbackRating = `POSITIVE` + +// String representation for [fmt.Print] +func (f *GenieFeedbackRating) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *GenieFeedbackRating) Set(v string) error { + switch v { + case `NEGATIVE`, `NONE`, `POSITIVE`: + *f = GenieFeedbackRating(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "NEGATIVE", "NONE", "POSITIVE"`, v) + } +} + +// Values returns all possible values for GenieFeedbackRating. +// +// There is no guarantee on the order of the values in the slice. +func (f *GenieFeedbackRating) Values() []GenieFeedbackRating { + return []GenieFeedbackRating{ + GenieFeedbackRatingNegative, + GenieFeedbackRatingNone, + GenieFeedbackRatingPositive, + } +} + +// Type always returns GenieFeedbackRating to satisfy [pflag.Value] interface +func (f *GenieFeedbackRating) Type() string { + return "GenieFeedbackRating" +} + +// Follow-up questions suggested by Genie +type GenieFollowupQuestionsAttachment struct { + // The suggested follow-up questions + Questions []string `json:"questions,omitempty"` +} + +type GenieGenerateDownloadFullQueryResultRequest struct { + // Attachment ID + AttachmentId string `json:"-" url:"-"` + // Conversation ID + ConversationId string `json:"-" url:"-"` + // Message ID + MessageId string `json:"-" url:"-"` + // Genie space ID + SpaceId string `json:"-" url:"-"` +} + +type GenieGenerateDownloadFullQueryResultResponse struct { + // Download ID. Use this ID to track the download request in subsequent + // polling calls + DownloadId string `json:"download_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieGenerateDownloadFullQueryResultResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieGenerateDownloadFullQueryResultResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GenieGetConversationMessageRequest struct { // The ID associated with the target conversation. ConversationId string `json:"-" url:"-"` @@ -308,6 +488,26 @@ type GenieGetConversationMessageRequest struct { SpaceId string `json:"-" url:"-"` } +type GenieGetDownloadFullQueryResultRequest struct { + // Attachment ID + AttachmentId string `json:"-" url:"-"` + // Conversation ID + ConversationId string `json:"-" url:"-"` + // Download ID. This ID is provided by the [Generate Download + // endpoint](:method:genie/generateDownloadFullQueryResult) + DownloadId string `json:"-" url:"-"` + // Message ID + MessageId string `json:"-" url:"-"` + // Genie space ID + SpaceId string `json:"-" url:"-"` +} + +type GenieGetDownloadFullQueryResultResponse struct { + // SQL Statement Execution response. See [Get status, manifest, and result + // first chunk](:method:statementexecution/getstatement) for more details. + StatementResponse *sql.StatementResponse `json:"statement_response,omitempty"` +} + type GenieGetMessageAttachmentQueryResultRequest struct { // Attachment ID AttachmentId string `json:"-" url:"-"` @@ -350,7 +550,48 @@ type GenieGetSpaceRequest struct { SpaceId string `json:"-" url:"-"` } +type GenieListConversationMessagesRequest struct { + // The ID of the conversation to list messages from + ConversationId string `json:"-" url:"-"` + // Maximum number of messages to return per page + PageSize int `json:"-" url:"page_size,omitempty"` + // Token to get the next page of results + PageToken string `json:"-" url:"page_token,omitempty"` + // The ID associated with the Genie space where the conversation is located + SpaceId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieListConversationMessagesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieListConversationMessagesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type GenieListConversationMessagesResponse struct { + // List of messages in the conversation. + Messages []GenieMessage `json:"messages,omitempty"` + // The token to use for retrieving the next page of results. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieListConversationMessagesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieListConversationMessagesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GenieListConversationsRequest struct { + // Include all conversations in the space across all users. Requires at + // least CAN MANAGE permission on the space. + IncludeAll bool `json:"-" url:"include_all,omitempty"` // Maximum number of conversations to return per page PageSize int `json:"-" url:"page_size,omitempty"` // Token to get the next page of results @@ -431,6 +672,8 @@ type GenieMessage struct { CreatedTimestamp int64 `json:"created_timestamp,omitempty"` // Error message if Genie failed to respond to the message Error *MessageError `json:"error,omitempty"` + // User feedback for the message if provided + Feedback *GenieFeedback `json:"feedback,omitempty"` // Message ID. Legacy identifier, use message_id instead Id string `json:"id"` // Timestamp when the message was last updated @@ -505,6 +748,29 @@ func (s GenieResultMetadata) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type GenieSendMessageFeedbackRequest struct { + // Optional text feedback that will be stored as a comment. + Comment string `json:"comment,omitempty"` + // The ID associated with the conversation. + ConversationId string `json:"-" url:"-"` + // The ID associated with the message to provide feedback for. + MessageId string `json:"-" url:"-"` + // The rating (POSITIVE, NEGATIVE, or NONE). + Rating GenieFeedbackRating `json:"rating"` + // The ID associated with the Genie space where the message is located. + SpaceId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieSendMessageFeedbackRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieSendMessageFeedbackRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GenieSpace struct { // Description of the Genie Space Description string `json:"description,omitempty"` @@ -547,11 +813,39 @@ type GenieTrashSpaceRequest struct { SpaceId string `json:"-" url:"-"` } +type GenieUpdateSpaceRequest struct { + // Optional description + Description string `json:"description,omitempty"` + // Serialized export model for the space contents (full replacement) + SerializedSpace string `json:"serialized_space,omitempty"` + // Genie space ID + SpaceId string `json:"-" url:"-"` + // Optional title override + Title string `json:"title,omitempty"` + // Optional warehouse override + WarehouseId string `json:"warehouse_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieUpdateSpaceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieUpdateSpaceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GetDashboardRequest struct { // UUID identifying the dashboard. DashboardId string `json:"-" url:"-"` } +type GetPublishedDashboardEmbeddedRequest struct { + // UUID identifying the published dashboard. + DashboardId string `json:"-" url:"-"` +} + type GetPublishedDashboardRequest struct { // UUID identifying the published dashboard. DashboardId string `json:"-" url:"-"` @@ -834,6 +1128,10 @@ const MessageErrorTypeGenericSqlExecApiCallException MessageErrorType = `GENERIC const MessageErrorTypeIllegalParameterDefinitionException MessageErrorType = `ILLEGAL_PARAMETER_DEFINITION_EXCEPTION` +const MessageErrorTypeInternalCatalogMissingUcPathException MessageErrorType = `INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION` + +const MessageErrorTypeInternalCatalogPathOverlapException MessageErrorType = `INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION` + const MessageErrorTypeInvalidCertifiedAnswerFunctionException MessageErrorType = `INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION` const MessageErrorTypeInvalidCertifiedAnswerIdentifierException MessageErrorType = `INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION` @@ -906,11 +1204,11 @@ func (f *MessageErrorType) String() string { // Set raw string value and validate it against allowed values func (f *MessageErrorType) Set(v string) error { switch v { - case `BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION`, `CHAT_COMPLETION_CLIENT_EXCEPTION`, `CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION`, `CHAT_COMPLETION_NETWORK_EXCEPTION`, `CONTENT_FILTER_EXCEPTION`, `CONTEXT_EXCEEDED_EXCEPTION`, `COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION`, `COULD_NOT_GET_UC_SCHEMA_EXCEPTION`, `DEPLOYMENT_NOT_FOUND_EXCEPTION`, `DESCRIBE_QUERY_INVALID_SQL_ERROR`, `DESCRIBE_QUERY_TIMEOUT`, `DESCRIBE_QUERY_UNEXPECTED_FAILURE`, `FUNCTIONS_NOT_AVAILABLE_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION`, `FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION`, `GENERATED_SQL_QUERY_TOO_LONG_EXCEPTION`, `GENERIC_CHAT_COMPLETION_EXCEPTION`, `GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION`, `GENERIC_SQL_EXEC_API_CALL_EXCEPTION`, `ILLEGAL_PARAMETER_DEFINITION_EXCEPTION`, `INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION`, `INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION`, `INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION`, `INVALID_CHAT_COMPLETION_JSON_EXCEPTION`, `INVALID_COMPLETION_REQUEST_EXCEPTION`, `INVALID_FUNCTION_CALL_EXCEPTION`, `INVALID_SQL_MULTIPLE_DATASET_REFERENCES_EXCEPTION`, `INVALID_SQL_MULTIPLE_STATEMENTS_EXCEPTION`, `INVALID_SQL_UNKNOWN_TABLE_EXCEPTION`, `INVALID_TABLE_IDENTIFIER_EXCEPTION`, `LOCAL_CONTEXT_EXCEEDED_EXCEPTION`, `MESSAGE_ATTACHMENT_TOO_LONG_ERROR`, `MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION`, `MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION`, `MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION`, `MISSING_SQL_QUERY_EXCEPTION`, `NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE`, `NO_QUERY_TO_VISUALIZE_EXCEPTION`, `NO_TABLES_TO_QUERY_EXCEPTION`, `RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION`, `RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION`, `REPLY_PROCESS_TIMEOUT_EXCEPTION`, `RETRYABLE_PROCESSING_EXCEPTION`, `SQL_EXECUTION_EXCEPTION`, `STOP_PROCESS_DUE_TO_AUTO_REGENERATE`, `TABLES_MISSING_EXCEPTION`, `TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION`, `TOO_MANY_TABLES_EXCEPTION`, `UNEXPECTED_REPLY_PROCESS_EXCEPTION`, `UNKNOWN_AI_MODEL`, `WAREHOUSE_ACCESS_MISSING_EXCEPTION`, `WAREHOUSE_NOT_FOUND_EXCEPTION`: + case `BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION`, `CHAT_COMPLETION_CLIENT_EXCEPTION`, `CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION`, `CHAT_COMPLETION_NETWORK_EXCEPTION`, `CONTENT_FILTER_EXCEPTION`, `CONTEXT_EXCEEDED_EXCEPTION`, `COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION`, `COULD_NOT_GET_UC_SCHEMA_EXCEPTION`, `DEPLOYMENT_NOT_FOUND_EXCEPTION`, `DESCRIBE_QUERY_INVALID_SQL_ERROR`, `DESCRIBE_QUERY_TIMEOUT`, `DESCRIBE_QUERY_UNEXPECTED_FAILURE`, `FUNCTIONS_NOT_AVAILABLE_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION`, `FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION`, `GENERATED_SQL_QUERY_TOO_LONG_EXCEPTION`, `GENERIC_CHAT_COMPLETION_EXCEPTION`, `GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION`, `GENERIC_SQL_EXEC_API_CALL_EXCEPTION`, `ILLEGAL_PARAMETER_DEFINITION_EXCEPTION`, `INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION`, `INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION`, `INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION`, `INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION`, `INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION`, `INVALID_CHAT_COMPLETION_JSON_EXCEPTION`, `INVALID_COMPLETION_REQUEST_EXCEPTION`, `INVALID_FUNCTION_CALL_EXCEPTION`, `INVALID_SQL_MULTIPLE_DATASET_REFERENCES_EXCEPTION`, `INVALID_SQL_MULTIPLE_STATEMENTS_EXCEPTION`, `INVALID_SQL_UNKNOWN_TABLE_EXCEPTION`, `INVALID_TABLE_IDENTIFIER_EXCEPTION`, `LOCAL_CONTEXT_EXCEEDED_EXCEPTION`, `MESSAGE_ATTACHMENT_TOO_LONG_ERROR`, `MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION`, `MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION`, `MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION`, `MISSING_SQL_QUERY_EXCEPTION`, `NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE`, `NO_QUERY_TO_VISUALIZE_EXCEPTION`, `NO_TABLES_TO_QUERY_EXCEPTION`, `RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION`, `RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION`, `REPLY_PROCESS_TIMEOUT_EXCEPTION`, `RETRYABLE_PROCESSING_EXCEPTION`, `SQL_EXECUTION_EXCEPTION`, `STOP_PROCESS_DUE_TO_AUTO_REGENERATE`, `TABLES_MISSING_EXCEPTION`, `TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION`, `TOO_MANY_TABLES_EXCEPTION`, `UNEXPECTED_REPLY_PROCESS_EXCEPTION`, `UNKNOWN_AI_MODEL`, `WAREHOUSE_ACCESS_MISSING_EXCEPTION`, `WAREHOUSE_NOT_FOUND_EXCEPTION`: *f = MessageErrorType(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION", "CHAT_COMPLETION_CLIENT_EXCEPTION", "CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION", "CHAT_COMPLETION_NETWORK_EXCEPTION", "CONTENT_FILTER_EXCEPTION", "CONTEXT_EXCEEDED_EXCEPTION", "COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION", "COULD_NOT_GET_UC_SCHEMA_EXCEPTION", "DEPLOYMENT_NOT_FOUND_EXCEPTION", "DESCRIBE_QUERY_INVALID_SQL_ERROR", "DESCRIBE_QUERY_TIMEOUT", "DESCRIBE_QUERY_UNEXPECTED_FAILURE", "FUNCTIONS_NOT_AVAILABLE_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION", "FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION", "GENERATED_SQL_QUERY_TOO_LONG_EXCEPTION", "GENERIC_CHAT_COMPLETION_EXCEPTION", "GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION", "GENERIC_SQL_EXEC_API_CALL_EXCEPTION", "ILLEGAL_PARAMETER_DEFINITION_EXCEPTION", "INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION", "INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION", "INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION", "INVALID_CHAT_COMPLETION_JSON_EXCEPTION", "INVALID_COMPLETION_REQUEST_EXCEPTION", "INVALID_FUNCTION_CALL_EXCEPTION", "INVALID_SQL_MULTIPLE_DATASET_REFERENCES_EXCEPTION", "INVALID_SQL_MULTIPLE_STATEMENTS_EXCEPTION", "INVALID_SQL_UNKNOWN_TABLE_EXCEPTION", "INVALID_TABLE_IDENTIFIER_EXCEPTION", "LOCAL_CONTEXT_EXCEEDED_EXCEPTION", "MESSAGE_ATTACHMENT_TOO_LONG_ERROR", "MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION", "MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION", "MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION", "MISSING_SQL_QUERY_EXCEPTION", "NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE", "NO_QUERY_TO_VISUALIZE_EXCEPTION", "NO_TABLES_TO_QUERY_EXCEPTION", "RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION", "RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION", "REPLY_PROCESS_TIMEOUT_EXCEPTION", "RETRYABLE_PROCESSING_EXCEPTION", "SQL_EXECUTION_EXCEPTION", "STOP_PROCESS_DUE_TO_AUTO_REGENERATE", "TABLES_MISSING_EXCEPTION", "TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION", "TOO_MANY_TABLES_EXCEPTION", "UNEXPECTED_REPLY_PROCESS_EXCEPTION", "UNKNOWN_AI_MODEL", "WAREHOUSE_ACCESS_MISSING_EXCEPTION", "WAREHOUSE_NOT_FOUND_EXCEPTION"`, v) + return fmt.Errorf(`value "%s" is not one of "BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION", "CHAT_COMPLETION_CLIENT_EXCEPTION", "CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION", "CHAT_COMPLETION_NETWORK_EXCEPTION", "CONTENT_FILTER_EXCEPTION", "CONTEXT_EXCEEDED_EXCEPTION", "COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION", "COULD_NOT_GET_UC_SCHEMA_EXCEPTION", "DEPLOYMENT_NOT_FOUND_EXCEPTION", "DESCRIBE_QUERY_INVALID_SQL_ERROR", "DESCRIBE_QUERY_TIMEOUT", "DESCRIBE_QUERY_UNEXPECTED_FAILURE", "FUNCTIONS_NOT_AVAILABLE_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION", "FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION", "GENERATED_SQL_QUERY_TOO_LONG_EXCEPTION", "GENERIC_CHAT_COMPLETION_EXCEPTION", "GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION", "GENERIC_SQL_EXEC_API_CALL_EXCEPTION", "ILLEGAL_PARAMETER_DEFINITION_EXCEPTION", "INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION", "INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION", "INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION", "INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION", "INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION", "INVALID_CHAT_COMPLETION_JSON_EXCEPTION", "INVALID_COMPLETION_REQUEST_EXCEPTION", "INVALID_FUNCTION_CALL_EXCEPTION", "INVALID_SQL_MULTIPLE_DATASET_REFERENCES_EXCEPTION", "INVALID_SQL_MULTIPLE_STATEMENTS_EXCEPTION", "INVALID_SQL_UNKNOWN_TABLE_EXCEPTION", "INVALID_TABLE_IDENTIFIER_EXCEPTION", "LOCAL_CONTEXT_EXCEEDED_EXCEPTION", "MESSAGE_ATTACHMENT_TOO_LONG_ERROR", "MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION", "MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION", "MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION", "MISSING_SQL_QUERY_EXCEPTION", "NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE", "NO_QUERY_TO_VISUALIZE_EXCEPTION", "NO_TABLES_TO_QUERY_EXCEPTION", "RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION", "RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION", "REPLY_PROCESS_TIMEOUT_EXCEPTION", "RETRYABLE_PROCESSING_EXCEPTION", "SQL_EXECUTION_EXCEPTION", "STOP_PROCESS_DUE_TO_AUTO_REGENERATE", "TABLES_MISSING_EXCEPTION", "TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION", "TOO_MANY_TABLES_EXCEPTION", "UNEXPECTED_REPLY_PROCESS_EXCEPTION", "UNKNOWN_AI_MODEL", "WAREHOUSE_ACCESS_MISSING_EXCEPTION", "WAREHOUSE_NOT_FOUND_EXCEPTION"`, v) } } @@ -941,6 +1239,8 @@ func (f *MessageErrorType) Values() []MessageErrorType { MessageErrorTypeGenericChatCompletionServiceException, MessageErrorTypeGenericSqlExecApiCallException, MessageErrorTypeIllegalParameterDefinitionException, + MessageErrorTypeInternalCatalogMissingUcPathException, + MessageErrorTypeInternalCatalogPathOverlapException, MessageErrorTypeInvalidCertifiedAnswerFunctionException, MessageErrorTypeInvalidCertifiedAnswerIdentifierException, MessageErrorTypeInvalidChatCompletionArgumentsJsonException, @@ -1100,6 +1400,29 @@ func (s MigrateDashboardRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type PendingStatus struct { + // The token to poll for result asynchronously Example: + // EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ + DataToken string `json:"data_token"` +} + +type PollPublishedQueryStatusRequest struct { + DashboardName string `json:"-" url:"dashboard_name"` + + DashboardRevisionId string `json:"-" url:"dashboard_revision_id"` + // Example: + // EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ + Tokens []string `json:"-" url:"tokens,omitempty"` +} + +type PollQueryStatusResponse struct { + Data []PollQueryStatusResponseData `json:"data,omitempty"` +} + +type PollQueryStatusResponseData struct { + Status QueryResponseStatus `json:"status"` +} + type PublishRequest struct { // UUID identifying the dashboard to be published. DashboardId string `json:"-" url:"-"` @@ -1143,6 +1466,31 @@ func (s PublishedDashboard) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type QueryResponseStatus struct { + Canceled *Empty `json:"canceled,omitempty"` + + Closed *Empty `json:"closed,omitempty"` + + Pending *PendingStatus `json:"pending,omitempty"` + // The statement id in format(01eef5da-c56e-1f36-bafa-21906587d6ba) The + // statement_id should be identical to data_token in SuccessStatus and + // PendingStatus. This field is created for audit logging purpose to record + // the statement_id of all QueryResponseStatus. + StatementId string `json:"statement_id,omitempty"` + + Success *SuccessStatus `json:"success,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *QueryResponseStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s QueryResponseStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type Result struct { // If result is truncated IsTruncated bool `json:"is_truncated,omitempty"` @@ -1290,6 +1638,24 @@ type SubscriptionSubscriberUser struct { UserId int64 `json:"user_id"` } +type SuccessStatus struct { + // The token to poll for result asynchronously Example: + // EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ + DataToken string `json:"data_token"` + // Whether the query result is truncated (either by byte limit or row limit) + Truncated bool `json:"truncated,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *SuccessStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s SuccessStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type TextAttachment struct { // AI generated message Content string `json:"content,omitempty"` diff --git a/service/database/api.go b/service/database/api.go index 60788f020..c5dd9cdf5 100755 --- a/service/database/api.go +++ b/service/database/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// Database Instances provide access to a database via REST API or direct SQL. +// These APIs allow you to manage Database, Database Project, etc. package database import ( @@ -75,6 +75,9 @@ type DatabaseInterface interface { // Delete a Synced Database Table. DeleteSyncedDatabaseTableByName(ctx context.Context, name string) error + // Failover the primary node of a Database Instance to a secondary. + FailoverDatabaseInstance(ctx context.Context, request FailoverDatabaseInstanceRequest) (*DatabaseInstance, error) + // Find a Database Instance by uid. FindDatabaseInstanceByUid(ctx context.Context, request FindDatabaseInstanceByUidRequest) (*DatabaseInstance, error) @@ -178,6 +181,9 @@ type DatabaseInterface interface { // Update a Database Instance. UpdateDatabaseInstance(ctx context.Context, request UpdateDatabaseInstanceRequest) (*DatabaseInstance, error) + // Update a role for a Database Instance. + UpdateDatabaseInstanceRole(ctx context.Context, request UpdateDatabaseInstanceRoleRequest) (*DatabaseInstanceRole, error) + // This API is currently unimplemented, but exposed for Terraform support. UpdateSyncedDatabaseTable(ctx context.Context, request UpdateSyncedDatabaseTableRequest) (*SyncedDatabaseTable, error) } @@ -385,3 +391,90 @@ func (a *DatabaseAPI) ListSyncedDatabaseTablesByInstanceName(ctx context.Context InstanceName: instanceName, }) } + +type DatabaseProjectInterface interface { + + // Create a Database Branch. + CreateDatabaseBranch(ctx context.Context, request CreateDatabaseBranchRequest) (*DatabaseBranch, error) + + // Create a Database Endpoint. + CreateDatabaseEndpoint(ctx context.Context, request CreateDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Create a Database Project. + CreateDatabaseProject(ctx context.Context, request CreateDatabaseProjectRequest) (*DatabaseProject, error) + + // Delete a Database Branch. + DeleteDatabaseBranch(ctx context.Context, request DeleteDatabaseBranchRequest) error + + // Delete a Database Endpoint. + DeleteDatabaseEndpoint(ctx context.Context, request DeleteDatabaseEndpointRequest) error + + // Delete a Database Project. + DeleteDatabaseProject(ctx context.Context, request DeleteDatabaseProjectRequest) error + + // Get a Database Branch. + GetDatabaseBranch(ctx context.Context, request GetDatabaseBranchRequest) (*DatabaseBranch, error) + + // Get a Database Endpoint. + GetDatabaseEndpoint(ctx context.Context, request GetDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Get a Database Project. + GetDatabaseProject(ctx context.Context, request GetDatabaseProjectRequest) (*DatabaseProject, error) + + // List Database Branches. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseBranches(ctx context.Context, request ListDatabaseBranchesRequest) listing.Iterator[DatabaseBranch] + + // List Database Branches. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseBranchesAll(ctx context.Context, request ListDatabaseBranchesRequest) ([]DatabaseBranch, error) + + // List Database Endpoints. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseEndpoints(ctx context.Context, request ListDatabaseEndpointsRequest) listing.Iterator[DatabaseEndpoint] + + // List Database Endpoints. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseEndpointsAll(ctx context.Context, request ListDatabaseEndpointsRequest) ([]DatabaseEndpoint, error) + + // List Database Instances. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseProjects(ctx context.Context, request ListDatabaseProjectsRequest) listing.Iterator[DatabaseProject] + + // List Database Instances. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseProjectsAll(ctx context.Context, request ListDatabaseProjectsRequest) ([]DatabaseProject, error) + + // Restart a Database Endpoint. TODO: should return + // databricks.longrunning.Operation + RestartDatabaseEndpoint(ctx context.Context, request RestartDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Update a Database Branch. + UpdateDatabaseBranch(ctx context.Context, request UpdateDatabaseBranchRequest) (*DatabaseBranch, error) + + // Update a Database Endpoint. TODO: should return + // databricks.longrunning.Operation { + UpdateDatabaseEndpoint(ctx context.Context, request UpdateDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Update a Database Project. + UpdateDatabaseProject(ctx context.Context, request UpdateDatabaseProjectRequest) (*DatabaseProject, error) +} + +func NewDatabaseProject(client *client.DatabricksClient) *DatabaseProjectAPI { + return &DatabaseProjectAPI{ + databaseProjectImpl: databaseProjectImpl{ + client: client, + }, + } +} + +// Database Projects provide access to a database via REST API or direct SQL. +type DatabaseProjectAPI struct { + databaseProjectImpl +} diff --git a/service/database/impl.go b/service/database/impl.go index 9ea0e56f6..aeca6fe7e 100755 --- a/service/database/impl.go +++ b/service/database/impl.go @@ -117,6 +117,17 @@ func (a *databaseImpl) DeleteSyncedDatabaseTable(ctx context.Context, request De return err } +func (a *databaseImpl) FailoverDatabaseInstance(ctx context.Context, request FailoverDatabaseInstanceRequest) (*DatabaseInstance, error) { + var databaseInstance DatabaseInstance + path := fmt.Sprintf("/api/2.0/database/instances/%v/failover", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &databaseInstance) + return &databaseInstance, err +} + func (a *databaseImpl) FindDatabaseInstanceByUid(ctx context.Context, request FindDatabaseInstanceByUidRequest) (*DatabaseInstance, error) { var databaseInstance DatabaseInstance path := "/api/2.0/database/instances:findByUid" @@ -364,6 +375,7 @@ func (a *databaseImpl) UpdateDatabaseCatalog(ctx context.Context, request Update var databaseCatalog DatabaseCatalog path := fmt.Sprintf("/api/2.0/database/catalogs/%v", request.Name) queryParams := make(map[string]any) + if request.UpdateMask != "" { queryParams["update_mask"] = request.UpdateMask } @@ -378,6 +390,7 @@ func (a *databaseImpl) UpdateDatabaseInstance(ctx context.Context, request Updat var databaseInstance DatabaseInstance path := fmt.Sprintf("/api/2.0/database/instances/%v", request.Name) queryParams := make(map[string]any) + if request.UpdateMask != "" { queryParams["update_mask"] = request.UpdateMask } @@ -388,10 +401,22 @@ func (a *databaseImpl) UpdateDatabaseInstance(ctx context.Context, request Updat return &databaseInstance, err } +func (a *databaseImpl) UpdateDatabaseInstanceRole(ctx context.Context, request UpdateDatabaseInstanceRoleRequest) (*DatabaseInstanceRole, error) { + var databaseInstanceRole DatabaseInstanceRole + path := fmt.Sprintf("/api/2.0/database/instances/%v/roles/%v", request.InstanceName, request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DatabaseInstanceRole, &databaseInstanceRole) + return &databaseInstanceRole, err +} + func (a *databaseImpl) UpdateSyncedDatabaseTable(ctx context.Context, request UpdateSyncedDatabaseTableRequest) (*SyncedDatabaseTable, error) { var syncedDatabaseTable SyncedDatabaseTable path := fmt.Sprintf("/api/2.0/database/synced_tables/%v", request.Name) queryParams := make(map[string]any) + if request.UpdateMask != "" { queryParams["update_mask"] = request.UpdateMask } @@ -401,3 +426,277 @@ func (a *databaseImpl) UpdateSyncedDatabaseTable(ctx context.Context, request Up err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.SyncedTable, &syncedDatabaseTable) return &syncedDatabaseTable, err } + +// unexported type that holds implementations of just DatabaseProject API methods +type databaseProjectImpl struct { + client *client.DatabricksClient +} + +func (a *databaseProjectImpl) CreateDatabaseBranch(ctx context.Context, request CreateDatabaseBranchRequest) (*DatabaseBranch, error) { + var databaseBranch DatabaseBranch + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches", request.ProjectId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.DatabaseBranch, &databaseBranch) + return &databaseBranch, err +} + +func (a *databaseProjectImpl) CreateDatabaseEndpoint(ctx context.Context, request CreateDatabaseEndpointRequest) (*DatabaseEndpoint, error) { + var databaseEndpoint DatabaseEndpoint + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints", request.ProjectId, request.BranchId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.DatabaseEndpoint, &databaseEndpoint) + return &databaseEndpoint, err +} + +func (a *databaseProjectImpl) CreateDatabaseProject(ctx context.Context, request CreateDatabaseProjectRequest) (*DatabaseProject, error) { + var databaseProject DatabaseProject + path := "/api/2.0/database/projects" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.DatabaseProject, &databaseProject) + return &databaseProject, err +} + +func (a *databaseProjectImpl) DeleteDatabaseBranch(ctx context.Context, request DeleteDatabaseBranchRequest) error { + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v", request.ProjectId, request.BranchId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *databaseProjectImpl) DeleteDatabaseEndpoint(ctx context.Context, request DeleteDatabaseEndpointRequest) error { + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints/%v", request.ProjectId, request.BranchId, request.EndpointId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *databaseProjectImpl) DeleteDatabaseProject(ctx context.Context, request DeleteDatabaseProjectRequest) error { + path := fmt.Sprintf("/api/2.0/database/projects/%v", request.ProjectId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *databaseProjectImpl) GetDatabaseBranch(ctx context.Context, request GetDatabaseBranchRequest) (*DatabaseBranch, error) { + var databaseBranch DatabaseBranch + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v", request.ProjectId, request.BranchId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseBranch) + return &databaseBranch, err +} + +func (a *databaseProjectImpl) GetDatabaseEndpoint(ctx context.Context, request GetDatabaseEndpointRequest) (*DatabaseEndpoint, error) { + var databaseEndpoint DatabaseEndpoint + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints/%v", request.ProjectId, request.BranchId, request.EndpointId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseEndpoint) + return &databaseEndpoint, err +} + +func (a *databaseProjectImpl) GetDatabaseProject(ctx context.Context, request GetDatabaseProjectRequest) (*DatabaseProject, error) { + var databaseProject DatabaseProject + path := fmt.Sprintf("/api/2.0/database/projects/%v", request.ProjectId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseProject) + return &databaseProject, err +} + +// List Database Branches. +func (a *databaseProjectImpl) ListDatabaseBranches(ctx context.Context, request ListDatabaseBranchesRequest) listing.Iterator[DatabaseBranch] { + + getNextPage := func(ctx context.Context, req ListDatabaseBranchesRequest) (*ListDatabaseBranchesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListDatabaseBranches(ctx, req) + } + getItems := func(resp *ListDatabaseBranchesResponse) []DatabaseBranch { + return resp.DatabaseBranches + } + getNextReq := func(resp *ListDatabaseBranchesResponse) *ListDatabaseBranchesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List Database Branches. +func (a *databaseProjectImpl) ListDatabaseBranchesAll(ctx context.Context, request ListDatabaseBranchesRequest) ([]DatabaseBranch, error) { + iterator := a.ListDatabaseBranches(ctx, request) + return listing.ToSlice[DatabaseBranch](ctx, iterator) +} + +func (a *databaseProjectImpl) internalListDatabaseBranches(ctx context.Context, request ListDatabaseBranchesRequest) (*ListDatabaseBranchesResponse, error) { + var listDatabaseBranchesResponse ListDatabaseBranchesResponse + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches", request.ProjectId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDatabaseBranchesResponse) + return &listDatabaseBranchesResponse, err +} + +// List Database Endpoints. +func (a *databaseProjectImpl) ListDatabaseEndpoints(ctx context.Context, request ListDatabaseEndpointsRequest) listing.Iterator[DatabaseEndpoint] { + + getNextPage := func(ctx context.Context, req ListDatabaseEndpointsRequest) (*ListDatabaseEndpointsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListDatabaseEndpoints(ctx, req) + } + getItems := func(resp *ListDatabaseEndpointsResponse) []DatabaseEndpoint { + return resp.DatabaseEndpoints + } + getNextReq := func(resp *ListDatabaseEndpointsResponse) *ListDatabaseEndpointsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List Database Endpoints. +func (a *databaseProjectImpl) ListDatabaseEndpointsAll(ctx context.Context, request ListDatabaseEndpointsRequest) ([]DatabaseEndpoint, error) { + iterator := a.ListDatabaseEndpoints(ctx, request) + return listing.ToSlice[DatabaseEndpoint](ctx, iterator) +} + +func (a *databaseProjectImpl) internalListDatabaseEndpoints(ctx context.Context, request ListDatabaseEndpointsRequest) (*ListDatabaseEndpointsResponse, error) { + var listDatabaseEndpointsResponse ListDatabaseEndpointsResponse + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints", request.ProjectId, request.BranchId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDatabaseEndpointsResponse) + return &listDatabaseEndpointsResponse, err +} + +// List Database Instances. +func (a *databaseProjectImpl) ListDatabaseProjects(ctx context.Context, request ListDatabaseProjectsRequest) listing.Iterator[DatabaseProject] { + + getNextPage := func(ctx context.Context, req ListDatabaseProjectsRequest) (*ListDatabaseProjectsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListDatabaseProjects(ctx, req) + } + getItems := func(resp *ListDatabaseProjectsResponse) []DatabaseProject { + return resp.DatabaseProjects + } + getNextReq := func(resp *ListDatabaseProjectsResponse) *ListDatabaseProjectsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List Database Instances. +func (a *databaseProjectImpl) ListDatabaseProjectsAll(ctx context.Context, request ListDatabaseProjectsRequest) ([]DatabaseProject, error) { + iterator := a.ListDatabaseProjects(ctx, request) + return listing.ToSlice[DatabaseProject](ctx, iterator) +} + +func (a *databaseProjectImpl) internalListDatabaseProjects(ctx context.Context, request ListDatabaseProjectsRequest) (*ListDatabaseProjectsResponse, error) { + var listDatabaseProjectsResponse ListDatabaseProjectsResponse + path := "/api/2.0/database/projects" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDatabaseProjectsResponse) + return &listDatabaseProjectsResponse, err +} + +func (a *databaseProjectImpl) RestartDatabaseEndpoint(ctx context.Context, request RestartDatabaseEndpointRequest) (*DatabaseEndpoint, error) { + var databaseEndpoint DatabaseEndpoint + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints/%v/restart", request.ProjectId, request.BranchId, request.EndpointId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &databaseEndpoint) + return &databaseEndpoint, err +} + +func (a *databaseProjectImpl) UpdateDatabaseBranch(ctx context.Context, request UpdateDatabaseBranchRequest) (*DatabaseBranch, error) { + var databaseBranch DatabaseBranch + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v", request.ProjectId, request.BranchId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DatabaseBranch, &databaseBranch) + return &databaseBranch, err +} + +func (a *databaseProjectImpl) UpdateDatabaseEndpoint(ctx context.Context, request UpdateDatabaseEndpointRequest) (*DatabaseEndpoint, error) { + var databaseEndpoint DatabaseEndpoint + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints/%v", request.ProjectId, request.BranchId, request.EndpointId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DatabaseEndpoint, &databaseEndpoint) + return &databaseEndpoint, err +} + +func (a *databaseProjectImpl) UpdateDatabaseProject(ctx context.Context, request UpdateDatabaseProjectRequest) (*DatabaseProject, error) { + var databaseProject DatabaseProject + path := fmt.Sprintf("/api/2.0/database/projects/%v", request.ProjectId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DatabaseProject, &databaseProject) + return &databaseProject, err +} diff --git a/service/database/interface.go b/service/database/interface.go index 38e9aa038..c9369374e 100755 --- a/service/database/interface.go +++ b/service/database/interface.go @@ -43,6 +43,9 @@ type DatabaseService interface { // Delete a Synced Database Table. DeleteSyncedDatabaseTable(ctx context.Context, request DeleteSyncedDatabaseTableRequest) error + // Failover the primary node of a Database Instance to a secondary. + FailoverDatabaseInstance(ctx context.Context, request FailoverDatabaseInstanceRequest) (*DatabaseInstance, error) + // Find a Database Instance by uid. FindDatabaseInstanceByUid(ctx context.Context, request FindDatabaseInstanceByUidRequest) (*DatabaseInstance, error) @@ -86,6 +89,65 @@ type DatabaseService interface { // Update a Database Instance. UpdateDatabaseInstance(ctx context.Context, request UpdateDatabaseInstanceRequest) (*DatabaseInstance, error) + // Update a role for a Database Instance. + UpdateDatabaseInstanceRole(ctx context.Context, request UpdateDatabaseInstanceRoleRequest) (*DatabaseInstanceRole, error) + // This API is currently unimplemented, but exposed for Terraform support. UpdateSyncedDatabaseTable(ctx context.Context, request UpdateSyncedDatabaseTableRequest) (*SyncedDatabaseTable, error) } + +// Database Projects provide access to a database via REST API or direct SQL. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type DatabaseProjectService interface { + + // Create a Database Branch. + CreateDatabaseBranch(ctx context.Context, request CreateDatabaseBranchRequest) (*DatabaseBranch, error) + + // Create a Database Endpoint. + CreateDatabaseEndpoint(ctx context.Context, request CreateDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Create a Database Project. + CreateDatabaseProject(ctx context.Context, request CreateDatabaseProjectRequest) (*DatabaseProject, error) + + // Delete a Database Branch. + DeleteDatabaseBranch(ctx context.Context, request DeleteDatabaseBranchRequest) error + + // Delete a Database Endpoint. + DeleteDatabaseEndpoint(ctx context.Context, request DeleteDatabaseEndpointRequest) error + + // Delete a Database Project. + DeleteDatabaseProject(ctx context.Context, request DeleteDatabaseProjectRequest) error + + // Get a Database Branch. + GetDatabaseBranch(ctx context.Context, request GetDatabaseBranchRequest) (*DatabaseBranch, error) + + // Get a Database Endpoint. + GetDatabaseEndpoint(ctx context.Context, request GetDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Get a Database Project. + GetDatabaseProject(ctx context.Context, request GetDatabaseProjectRequest) (*DatabaseProject, error) + + // List Database Branches. + ListDatabaseBranches(ctx context.Context, request ListDatabaseBranchesRequest) (*ListDatabaseBranchesResponse, error) + + // List Database Endpoints. + ListDatabaseEndpoints(ctx context.Context, request ListDatabaseEndpointsRequest) (*ListDatabaseEndpointsResponse, error) + + // List Database Instances. + ListDatabaseProjects(ctx context.Context, request ListDatabaseProjectsRequest) (*ListDatabaseProjectsResponse, error) + + // Restart a Database Endpoint. TODO: should return + // databricks.longrunning.Operation + RestartDatabaseEndpoint(ctx context.Context, request RestartDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Update a Database Branch. + UpdateDatabaseBranch(ctx context.Context, request UpdateDatabaseBranchRequest) (*DatabaseBranch, error) + + // Update a Database Endpoint. TODO: should return + // databricks.longrunning.Operation { + UpdateDatabaseEndpoint(ctx context.Context, request UpdateDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Update a Database Project. + UpdateDatabaseProject(ctx context.Context, request UpdateDatabaseProjectRequest) (*DatabaseProject, error) +} diff --git a/service/database/model.go b/service/database/model.go index fe92f97cd..2682af641 100755 --- a/service/database/model.go +++ b/service/database/model.go @@ -8,10 +8,24 @@ import ( "github.com/databricks/databricks-sdk-go/marshal" ) +type CreateDatabaseBranchRequest struct { + DatabaseBranch DatabaseBranch `json:"database_branch"` + + ProjectId string `json:"-" url:"-"` +} + type CreateDatabaseCatalogRequest struct { Catalog DatabaseCatalog `json:"catalog"` } +type CreateDatabaseEndpointRequest struct { + BranchId string `json:"-" url:"-"` + + DatabaseEndpoint DatabaseEndpoint `json:"database_endpoint"` + + ProjectId string `json:"-" url:"-"` +} + type CreateDatabaseInstanceRequest struct { // Instance to create. DatabaseInstance DatabaseInstance `json:"database_instance"` @@ -23,6 +37,10 @@ type CreateDatabaseInstanceRoleRequest struct { InstanceName string `json:"-" url:"-"` } +type CreateDatabaseProjectRequest struct { + DatabaseProject DatabaseProject `json:"database_project"` +} + type CreateDatabaseTableRequest struct { Table DatabaseTable `json:"table"` } @@ -31,6 +49,114 @@ type CreateSyncedDatabaseTableRequest struct { SyncedTable SyncedDatabaseTable `json:"synced_table"` } +type CustomTag struct { + // The key of the custom tag. + Key string `json:"key,omitempty"` + // The value of the custom tag. + Value string `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CustomTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CustomTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DatabaseBranch struct { + BranchId string `json:"branch_id"` + // A timestamp indicating when the branch was created. + CreateTime string `json:"create_time,omitempty"` + + CurrentState DatabaseBranchState `json:"current_state,omitempty"` + // Whether the branch is the project's default branch. This field is only + // returned on create/update responses. See effective_default for the value + // that is actually applied to the database branch. + Default bool `json:"default,omitempty"` + // Whether the branch is the project's default branch. + EffectiveDefault bool `json:"effective_default,omitempty"` + // The logical size of the branch. + LogicalSizeBytes int64 `json:"logical_size_bytes,omitempty"` + // The id of the parent branch + ParentId string `json:"parent_id,omitempty"` + // The Log Sequence Number (LSN) on the parent branch from which this branch + // was created. When restoring a branch using the Restore Database Branch + // endpoint, this value isn’t finalized until all operations related to + // the restore have completed successfully. + ParentLsn string `json:"parent_lsn,omitempty"` + // The point in time on the parent branch from which this branch was + // created. + ParentTime string `json:"parent_time,omitempty"` + + PendingState DatabaseBranchState `json:"pending_state,omitempty"` + + ProjectId string `json:"project_id,omitempty"` + // Whether the branch is protected. + Protected bool `json:"protected,omitempty"` + // A timestamp indicating when the `current_state` began. + StateChangeTime string `json:"state_change_time,omitempty"` + // A timestamp indicating when the branch was last updated. + UpdateTime string `json:"update_time,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseBranch) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseBranch) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// The branch’s state, indicating if it is initializing, ready for use, or +// archived. +type DatabaseBranchState string + +const DatabaseBranchStateArchived DatabaseBranchState = `ARCHIVED` + +const DatabaseBranchStateInit DatabaseBranchState = `INIT` + +const DatabaseBranchStateReady DatabaseBranchState = `READY` + +const DatabaseBranchStateResetting DatabaseBranchState = `RESETTING` + +// String representation for [fmt.Print] +func (f *DatabaseBranchState) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DatabaseBranchState) Set(v string) error { + switch v { + case `ARCHIVED`, `INIT`, `READY`, `RESETTING`: + *f = DatabaseBranchState(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ARCHIVED", "INIT", "READY", "RESETTING"`, v) + } +} + +// Values returns all possible values for DatabaseBranchState. +// +// There is no guarantee on the order of the values in the slice. +func (f *DatabaseBranchState) Values() []DatabaseBranchState { + return []DatabaseBranchState{ + DatabaseBranchStateArchived, + DatabaseBranchStateInit, + DatabaseBranchStateReady, + DatabaseBranchStateResetting, + } +} + +// Type always returns DatabaseBranchState to satisfy [pflag.Value] interface +func (f *DatabaseBranchState) Type() string { + return "DatabaseBranchState" +} + type DatabaseCatalog struct { CreateDatabaseIfNotExists bool `json:"create_database_if_not_exists,omitempty"` // The name of the DatabaseInstance housing the database. @@ -69,6 +195,183 @@ func (s DatabaseCredential) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type DatabaseEndpoint struct { + // The maximum number of Compute Units. + AutoscalingLimitMaxCu float64 `json:"autoscaling_limit_max_cu,omitempty"` + // The minimum number of Compute Units. + AutoscalingLimitMinCu float64 `json:"autoscaling_limit_min_cu,omitempty"` + + BranchId string `json:"branch_id,omitempty"` + // A timestamp indicating when the compute endpoint was created. + CreateTime string `json:"create_time,omitempty"` + + CurrentState DatabaseEndpointState `json:"current_state,omitempty"` + // Whether to restrict connections to the compute endpoint. Enabling this + // option schedules a suspend compute operation. A disabled compute endpoint + // cannot be enabled by a connection or console action. + Disabled bool `json:"disabled,omitempty"` + + EndpointId string `json:"endpoint_id"` + // The hostname of the compute endpoint. This is the hostname specified when + // connecting to a database. + Host string `json:"host,omitempty"` + // A timestamp indicating when the compute endpoint was last active. + LastActiveTime string `json:"last_active_time,omitempty"` + + PendingState DatabaseEndpointState `json:"pending_state,omitempty"` + + PoolerMode DatabaseEndpointPoolerMode `json:"pooler_mode,omitempty"` + + ProjectId string `json:"project_id,omitempty"` + + Settings *DatabaseEndpointSettings `json:"settings,omitempty"` + // A timestamp indicating when the compute endpoint was last started. + StartTime string `json:"start_time,omitempty"` + // A timestamp indicating when the compute endpoint was last suspended. + SuspendTime string `json:"suspend_time,omitempty"` + // Duration of inactivity after which the compute endpoint is automatically + // suspended. + SuspendTimeoutDuration string `json:"suspend_timeout_duration,omitempty"` + // NOTE: if want type to default to some value set the server then an + // effective_type field OR make this field REQUIRED + Type DatabaseEndpointType `json:"type,omitempty"` + // A timestamp indicating when the compute endpoint was last updated. + UpdateTime string `json:"update_time,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseEndpoint) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseEndpoint) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// The connection pooler mode. Lakebase supports PgBouncer in `transaction` mode +// only. +type DatabaseEndpointPoolerMode string + +const DatabaseEndpointPoolerModeTransaction DatabaseEndpointPoolerMode = `TRANSACTION` + +// String representation for [fmt.Print] +func (f *DatabaseEndpointPoolerMode) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DatabaseEndpointPoolerMode) Set(v string) error { + switch v { + case `TRANSACTION`: + *f = DatabaseEndpointPoolerMode(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "TRANSACTION"`, v) + } +} + +// Values returns all possible values for DatabaseEndpointPoolerMode. +// +// There is no guarantee on the order of the values in the slice. +func (f *DatabaseEndpointPoolerMode) Values() []DatabaseEndpointPoolerMode { + return []DatabaseEndpointPoolerMode{ + DatabaseEndpointPoolerModeTransaction, + } +} + +// Type always returns DatabaseEndpointPoolerMode to satisfy [pflag.Value] interface +func (f *DatabaseEndpointPoolerMode) Type() string { + return "DatabaseEndpointPoolerMode" +} + +// A collection of settings for a compute endpoint +type DatabaseEndpointSettings struct { + // A raw representation of Postgres settings. + PgSettings map[string]string `json:"pg_settings,omitempty"` + // A raw representation of PgBouncer settings. + PgbouncerSettings map[string]string `json:"pgbouncer_settings,omitempty"` +} + +// The state of the compute endpoint +type DatabaseEndpointState string + +const DatabaseEndpointStateActive DatabaseEndpointState = `ACTIVE` + +const DatabaseEndpointStateIdle DatabaseEndpointState = `IDLE` + +const DatabaseEndpointStateInit DatabaseEndpointState = `INIT` + +// String representation for [fmt.Print] +func (f *DatabaseEndpointState) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DatabaseEndpointState) Set(v string) error { + switch v { + case `ACTIVE`, `IDLE`, `INIT`: + *f = DatabaseEndpointState(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ACTIVE", "IDLE", "INIT"`, v) + } +} + +// Values returns all possible values for DatabaseEndpointState. +// +// There is no guarantee on the order of the values in the slice. +func (f *DatabaseEndpointState) Values() []DatabaseEndpointState { + return []DatabaseEndpointState{ + DatabaseEndpointStateActive, + DatabaseEndpointStateIdle, + DatabaseEndpointStateInit, + } +} + +// Type always returns DatabaseEndpointState to satisfy [pflag.Value] interface +func (f *DatabaseEndpointState) Type() string { + return "DatabaseEndpointState" +} + +// The compute endpoint type. Either `read_write` or `read_only`. +type DatabaseEndpointType string + +const DatabaseEndpointTypeReadOnly DatabaseEndpointType = `READ_ONLY` + +const DatabaseEndpointTypeReadWrite DatabaseEndpointType = `READ_WRITE` + +// String representation for [fmt.Print] +func (f *DatabaseEndpointType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DatabaseEndpointType) Set(v string) error { + switch v { + case `READ_ONLY`, `READ_WRITE`: + *f = DatabaseEndpointType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "READ_ONLY", "READ_WRITE"`, v) + } +} + +// Values returns all possible values for DatabaseEndpointType. +// +// There is no guarantee on the order of the values in the slice. +func (f *DatabaseEndpointType) Values() []DatabaseEndpointType { + return []DatabaseEndpointType{ + DatabaseEndpointTypeReadOnly, + DatabaseEndpointTypeReadWrite, + } +} + +// Type always returns DatabaseEndpointType to satisfy [pflag.Value] interface +func (f *DatabaseEndpointType) Type() string { + return "DatabaseEndpointType" +} + // A DatabaseInstance represents a logical Postgres instance, comprised of both // compute and storage. type DatabaseInstance struct { @@ -81,39 +384,40 @@ type DatabaseInstance struct { CreationTime string `json:"creation_time,omitempty"` // The email of the creator of the instance. Creator string `json:"creator,omitempty"` - // xref AIP-129. `enable_readable_secondaries` is owned by the client, while - // `effective_enable_readable_secondaries` is owned by the server. - // `enable_readable_secondaries` will only be set in Create/Update response - // messages if and only if the user provides the field via the request. - // `effective_enable_readable_secondaries` on the other hand will always bet - // set in all response messages (Create/Update/Get/List). + // Custom tags associated with the instance. This field is only included on + // create and update responses. + CustomTags []CustomTag `json:"custom_tags,omitempty"` + // Deprecated. The sku of the instance; this field will always match the + // value of capacity. + EffectiveCapacity string `json:"effective_capacity,omitempty"` + // The recorded custom tags associated with the instance. + EffectiveCustomTags []CustomTag `json:"effective_custom_tags,omitempty"` + // Whether the instance has PG native password login enabled. + EffectiveEnablePgNativeLogin bool `json:"effective_enable_pg_native_login,omitempty"` + // Whether secondaries serving read-only traffic are enabled. Defaults to + // false. EffectiveEnableReadableSecondaries bool `json:"effective_enable_readable_secondaries,omitempty"` - // xref AIP-129. `node_count` is owned by the client, while - // `effective_node_count` is owned by the server. `node_count` will only be - // set in Create/Update response messages if and only if the user provides - // the field via the request. `effective_node_count` on the other hand will - // always bet set in all response messages (Create/Update/Get/List). + // The number of nodes in the instance, composed of 1 primary and 0 or more + // secondaries. Defaults to 1 primary and 0 secondaries. EffectiveNodeCount int `json:"effective_node_count,omitempty"` - // xref AIP-129. `retention_window_in_days` is owned by the client, while - // `effective_retention_window_in_days` is owned by the server. - // `retention_window_in_days` will only be set in Create/Update response - // messages if and only if the user provides the field via the request. - // `effective_retention_window_in_days` on the other hand will always bet - // set in all response messages (Create/Update/Get/List). + // The retention window for the instance. This is the time window in days + // for which the historical data is retained. EffectiveRetentionWindowInDays int `json:"effective_retention_window_in_days,omitempty"` - // xref AIP-129. `stopped` is owned by the client, while `effective_stopped` - // is owned by the server. `stopped` will only be set in Create/Update - // response messages if and only if the user provides the field via the - // request. `effective_stopped` on the other hand will always bet set in all - // response messages (Create/Update/Get/List). + // Whether the instance is stopped. EffectiveStopped bool `json:"effective_stopped,omitempty"` + // The policy that is applied to the instance. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` + // Whether to enable PG native password login on the instance. Defaults to + // false. + EnablePgNativeLogin bool `json:"enable_pg_native_login,omitempty"` // Whether to enable secondaries to serve read-only traffic. Defaults to // false. EnableReadableSecondaries bool `json:"enable_readable_secondaries,omitempty"` // The name of the instance. This is the unique identifier for the instance. Name string `json:"name"` // The number of nodes in the instance, composed of 1 primary and 0 or more - // secondaries. Defaults to 1 primary and 0 secondaries. + // secondaries. Defaults to 1 primary and 0 secondaries. This field is input + // only, see effective_node_count for the output. NodeCount int `json:"node_count,omitempty"` // The ref of the parent instance. This is only available if the instance is // child instance. Input: For specifying the parent instance to create a @@ -133,10 +437,13 @@ type DatabaseInstance struct { RetentionWindowInDays int `json:"retention_window_in_days,omitempty"` // The current state of the instance. State DatabaseInstanceState `json:"state,omitempty"` - // Whether the instance is stopped. + // Whether to stop the instance. An input only param, see effective_stopped + // for the output. Stopped bool `json:"stopped,omitempty"` // An immutable UUID identifier for the instance. Uid string `json:"uid,omitempty"` + // The desired usage policy to associate with the instance. + UsagePolicyId string `json:"usage_policy_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -164,14 +471,9 @@ type DatabaseInstanceRef struct { // the point in time to create a child instance. Optional. Output: Only // populated if provided as input to create a child instance. BranchTime string `json:"branch_time,omitempty"` - // xref AIP-129. `lsn` is owned by the client, while `effective_lsn` is - // owned by the server. `lsn` will only be set in Create/Update response - // messages if and only if the user provides the field via the request. - // `effective_lsn` on the other hand will always bet set in all response - // messages (Create/Update/Get/List). For a parent ref instance, this is the - // LSN on the parent instance from which the instance was created. For a - // child ref instance, this is the LSN on the instance from which the child - // instance was created. + // For a parent ref instance, this is the LSN on the parent instance from + // which the instance was created. For a child ref instance, this is the LSN + // on the instance from which the child instance was created. EffectiveLsn string `json:"effective_lsn,omitempty"` // User-specified WAL LSN of the ref database instance. // @@ -369,6 +671,115 @@ func (f *DatabaseInstanceState) Type() string { return "DatabaseInstanceState" } +type DatabaseProject struct { + // The logical size limit for a branch. + BranchLogicalSizeLimitBytes int64 `json:"branch_logical_size_limit_bytes,omitempty"` + // The desired budget policy to associate with the instance. This field is + // only returned on create/update responses, and represents the customer + // provided budget policy. See effective_budget_policy_id for the policy + // that is actually applied to the instance. + BudgetPolicyId string `json:"budget_policy_id,omitempty"` + // The most recent time when any endpoint of this project was active. + ComputeLastActiveTime string `json:"compute_last_active_time,omitempty"` + // A timestamp indicating when the project was created. + CreateTime string `json:"create_time,omitempty"` + // Custom tags associated with the instance. + CustomTags []DatabaseProjectCustomTag `json:"custom_tags,omitempty"` + + DefaultEndpointSettings *DatabaseProjectDefaultEndpointSettings `json:"default_endpoint_settings,omitempty"` + // Human-readable project name. + DisplayName string `json:"display_name,omitempty"` + // The policy that is applied to the instance. + EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + // The number of seconds to retain the shared history for point in time + // recovery for all branches in this project. + HistoryRetentionDuration string `json:"history_retention_duration,omitempty"` + // The major Postgres version number. NOTE: fields could be either user-set + // or server-set. we can't have fields that are optionally user-provided and + // server-set to default value. TODO: this needs an effective variant or + // make REQUIRED + PgVersion int `json:"pg_version,omitempty"` + + ProjectId string `json:"project_id,omitempty"` + + Settings *DatabaseProjectSettings `json:"settings,omitempty"` + // The current space occupied by the project in storage. Synthetic storage + // size combines the logical data size and Write-Ahead Log (WAL) size for + // all branches in a project. + SyntheticStorageSizeBytes int64 `json:"synthetic_storage_size_bytes,omitempty"` + // A timestamp indicating when the project was last updated. + UpdateTime string `json:"update_time,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseProject) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseProject) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DatabaseProjectCustomTag struct { + // The key of the custom tag. + Key string `json:"key,omitempty"` + // The value of the custom tag. + Value string `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseProjectCustomTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseProjectCustomTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// A collection of settings for a database endpoint. +type DatabaseProjectDefaultEndpointSettings struct { + // The maximum number of Compute Units. + AutoscalingLimitMaxCu float64 `json:"autoscaling_limit_max_cu,omitempty"` + // The minimum number of Compute Units. + AutoscalingLimitMinCu float64 `json:"autoscaling_limit_min_cu,omitempty"` + // A raw representation of Postgres settings. + PgSettings map[string]string `json:"pg_settings,omitempty"` + // A raw representation of PgBouncer settings. + PgbouncerSettings map[string]string `json:"pgbouncer_settings,omitempty"` + // Duration of inactivity after which the compute endpoint is automatically + // suspended. + SuspendTimeoutDuration string `json:"suspend_timeout_duration,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseProjectDefaultEndpointSettings) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseProjectDefaultEndpointSettings) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DatabaseProjectSettings struct { + // Sets wal_level=logical for all compute endpoints in this project. All + // active endpoints will be suspended. Once enabled, logical replication + // cannot be disabled. + EnableLogicalReplication bool `json:"enable_logical_replication,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseProjectSettings) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseProjectSettings) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Next field marker: 13 type DatabaseTable struct { // Name of the target database instance. This is required when creating @@ -392,6 +803,8 @@ type DatabaseTable struct { LogicalDatabaseName string `json:"logical_database_name,omitempty"` // Full three-part (catalog, schema, table) name of the table. Name string `json:"name"` + // Data serving REST API URL for this table + TableServingUrl string `json:"table_serving_url,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -404,10 +817,24 @@ func (s DatabaseTable) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type DeleteDatabaseBranchRequest struct { + BranchId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` +} + type DeleteDatabaseCatalogRequest struct { Name string `json:"-" url:"-"` } +type DeleteDatabaseEndpointRequest struct { + BranchId string `json:"-" url:"-"` + + EndpointId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` +} + type DeleteDatabaseInstanceRequest struct { // By default, a instance cannot be deleted if it has descendant instances // created via PITR. If this flag is specified as true, all descendent @@ -415,14 +842,9 @@ type DeleteDatabaseInstanceRequest struct { Force bool `json:"-" url:"force,omitempty"` // Name of the instance to delete. Name string `json:"-" url:"-"` - // Note purge=false is in development. If false, the database instance is - // soft deleted (implementation pending). Soft deleted instances behave as - // if they are deleted, and cannot be used for CRUD operations nor connected - // to. However they can be undeleted by calling the undelete API for a - // limited time (implementation pending). If true, the database instance is - // hard deleted and cannot be undeleted. For the time being, setting this - // value to true is required to delete an instance (soft delete is not yet - // supported). + // Deprecated. Omitting the field or setting it to true will result in the + // field being hard deleted. Setting a value of false will throw a bad + // request. Purge bool `json:"-" url:"purge,omitempty"` ForceSendFields []string `json:"-" url:"-"` @@ -458,6 +880,10 @@ func (s DeleteDatabaseInstanceRoleRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type DeleteDatabaseProjectRequest struct { + ProjectId string `json:"-" url:"-"` +} + type DeleteDatabaseTableRequest struct { Name string `json:"-" url:"-"` } @@ -485,6 +911,22 @@ func (s DeltaTableSyncInfo) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type FailoverDatabaseInstanceRequest struct { + FailoverTargetDatabaseInstanceName string `json:"failover_target_database_instance_name,omitempty"` + // Name of the instance to failover. + Name string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *FailoverDatabaseInstanceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s FailoverDatabaseInstanceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type FindDatabaseInstanceByUidRequest struct { // UID of the cluster to get. Uid string `json:"-" url:"uid,omitempty"` @@ -522,10 +964,24 @@ func (s GenerateDatabaseCredentialRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type GetDatabaseBranchRequest struct { + BranchId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` +} + type GetDatabaseCatalogRequest struct { Name string `json:"-" url:"-"` } +type GetDatabaseEndpointRequest struct { + BranchId string `json:"-" url:"-"` + + EndpointId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` +} + type GetDatabaseInstanceRequest struct { // Name of the cluster to get. Name string `json:"-" url:"-"` @@ -537,6 +993,10 @@ type GetDatabaseInstanceRoleRequest struct { Name string `json:"-" url:"-"` } +type GetDatabaseProjectRequest struct { + ProjectId string `json:"-" url:"-"` +} + type GetDatabaseTableRequest struct { Name string `json:"-" url:"-"` } @@ -545,6 +1005,43 @@ type GetSyncedDatabaseTableRequest struct { Name string `json:"-" url:"-"` } +type ListDatabaseBranchesRequest struct { + // Upper bound for items returned. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page of Database Branches. Requests + // first page if absent. + PageToken string `json:"-" url:"page_token,omitempty"` + + ProjectId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseBranchesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseBranchesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListDatabaseBranchesResponse struct { + // List of branches. + DatabaseBranches []DatabaseBranch `json:"database_branches,omitempty"` + // Pagination token to request the next page of instances. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseBranchesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseBranchesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListDatabaseCatalogsRequest struct { // Name of the instance to get database catalogs for. InstanceName string `json:"-" url:"-"` @@ -581,6 +1078,44 @@ func (s ListDatabaseCatalogsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListDatabaseEndpointsRequest struct { + BranchId string `json:"-" url:"-"` + // Upper bound for items returned. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page of Database Endpoints. Requests + // first page if absent. + PageToken string `json:"-" url:"page_token,omitempty"` + + ProjectId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseEndpointsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseEndpointsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListDatabaseEndpointsResponse struct { + // List of endpoints. + DatabaseEndpoints []DatabaseEndpoint `json:"database_endpoints,omitempty"` + // Pagination token to request the next page of instances. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseEndpointsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseEndpointsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListDatabaseInstanceRolesRequest struct { InstanceName string `json:"-" url:"-"` // Upper bound for items returned. @@ -652,6 +1187,41 @@ func (s ListDatabaseInstancesResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListDatabaseProjectsRequest struct { + // Upper bound for items returned. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page of Database Projects. Requests + // first page if absent. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseProjectsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseProjectsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListDatabaseProjectsResponse struct { + // List of projects. + DatabaseProjects []DatabaseProject `json:"database_projects,omitempty"` + // Pagination token to request the next page of instances. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseProjectsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseProjectsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListSyncedDatabaseTablesRequest struct { // Name of the instance to get synced tables for. InstanceName string `json:"-" url:"-"` @@ -693,6 +1263,8 @@ func (s ListSyncedDatabaseTablesResponse) MarshalJSON() ([]byte, error) { // SyncedDatabaseTable. Note that other fields of pipeline are still inferred by // table def internally type NewPipelineSpec struct { + // Budget policy of this pipeline. + BudgetPolicyId string `json:"budget_policy_id,omitempty"` // This field needs to be specified if the destination catalog is a managed // postgres catalog. // @@ -865,6 +1437,14 @@ func (s RequestedResource) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type RestartDatabaseEndpointRequest struct { + BranchId string `json:"-" url:"-"` + + EndpointId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` +} + // Next field marker: 14 type SyncedDatabaseTable struct { // Synced Table data synchronization status @@ -899,6 +1479,8 @@ type SyncedDatabaseTable struct { Name string `json:"name"` Spec *SyncedTableSpec `json:"spec,omitempty"` + // Data serving REST API URL for this table + TableServingUrl string `json:"table_serving_url,omitempty"` // The provisioning state of the synced table entity in Unity Catalog. This // is distinct from the state of the data synchronization pipeline (i.e. the // table may be in "ACTIVE" but the pipeline may be in "PROVISIONING" as it @@ -1239,6 +1821,17 @@ func (s SyncedTableTriggeredUpdateStatus) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateDatabaseBranchRequest struct { + BranchId string `json:"-" url:"-"` + + DatabaseBranch DatabaseBranch `json:"database_branch"` + + ProjectId string `json:"-" url:"-"` + // The list of fields to update. If unspecified, all fields will be updated + // when possible. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateDatabaseCatalogRequest struct { // Note that updating a database catalog is not yet supported. DatabaseCatalog DatabaseCatalog `json:"database_catalog"` @@ -1248,6 +1841,19 @@ type UpdateDatabaseCatalogRequest struct { UpdateMask string `json:"-" url:"update_mask"` } +type UpdateDatabaseEndpointRequest struct { + BranchId string `json:"-" url:"-"` + + DatabaseEndpoint DatabaseEndpoint `json:"database_endpoint"` + + EndpointId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` + // The list of fields to update. If unspecified, all fields will be updated + // when possible. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateDatabaseInstanceRequest struct { DatabaseInstance DatabaseInstance `json:"database_instance"` // The name of the instance. This is the unique identifier for the instance. @@ -1258,6 +1864,24 @@ type UpdateDatabaseInstanceRequest struct { UpdateMask string `json:"-" url:"update_mask"` } +type UpdateDatabaseInstanceRoleRequest struct { + DatabaseInstanceRole DatabaseInstanceRole `json:"database_instance_role"` + + InstanceName string `json:"-" url:"-"` + // The name of the role. This is the unique identifier for the role in an + // instance. + Name string `json:"-" url:"-"` +} + +type UpdateDatabaseProjectRequest struct { + DatabaseProject DatabaseProject `json:"database_project"` + + ProjectId string `json:"-" url:"-"` + // The list of fields to update. If unspecified, all fields will be updated + // when possible. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateSyncedDatabaseTableRequest struct { // Full three-part (catalog, schema, table) name of the table. Name string `json:"-" url:"-"` diff --git a/service/files/impl.go b/service/files/impl.go index 5bf3c6a5b..bea30838e 100755 --- a/service/files/impl.go +++ b/service/files/impl.go @@ -267,6 +267,7 @@ func (a *filesImpl) internalListDirectoryContents(ctx context.Context, request L func (a *filesImpl) Upload(ctx context.Context, request UploadRequest) error { path := fmt.Sprintf("/api/2.0/fs/files%v", httpclient.EncodeMultiSegmentPathParameter(request.FilePath)) queryParams := make(map[string]any) + if request.Overwrite != false || slices.Contains(request.ForceSendFields, "Overwrite") { queryParams["overwrite"] = request.Overwrite } diff --git a/service/iam/api.go b/service/iam/api.go index edabb3d05..38ce3bb4c 100755 --- a/service/iam/api.go +++ b/service/iam/api.go @@ -1,15 +1,13 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Access Control, Account Access Control, Account Access Control Proxy, Account Groups, Account Service Principals, Account Users, Current User, Groups, Permission Migration, Permissions, Service Principals, Users, Workspace Assignment, etc. +// These APIs allow you to manage Access Control, Account Access Control, Account Access Control Proxy, Account Groups V2, Account Service Principals V2, Account Users V2, Current User, Groups V2, Permission Migration, Permissions, Service Principals V2, Users V2, Workspace Assignment, etc. package iam import ( "context" - "fmt" "github.com/databricks/databricks-sdk-go/client" "github.com/databricks/databricks-sdk-go/listing" - "github.com/databricks/databricks-sdk-go/useragent" ) type AccessControlInterface interface { @@ -98,62 +96,42 @@ type AccountAccessControlProxyAPI struct { accountAccessControlProxyImpl } -type AccountGroupsInterface interface { +type AccountGroupsV2Interface interface { // Creates a group in the Databricks account with a unique name, using the // supplied group details. - Create(ctx context.Context, request Group) (*Group, error) + Create(ctx context.Context, request CreateAccountGroupRequest) (*AccountGroup, error) // Deletes a group from the Databricks account. Delete(ctx context.Context, request DeleteAccountGroupRequest) error - // Deletes a group from the Databricks account. - DeleteById(ctx context.Context, id string) error - - // Gets the information for a specific group in the Databricks account. - Get(ctx context.Context, request GetAccountGroupRequest) (*Group, error) - // Gets the information for a specific group in the Databricks account. - GetById(ctx context.Context, id string) (*Group, error) - - // Gets all details of the groups associated with the Databricks account. - // - // This method is generated by Databricks SDK Code Generator. - List(ctx context.Context, request ListAccountGroupsRequest) listing.Iterator[Group] + Get(ctx context.Context, request GetAccountGroupRequest) (*AccountGroup, error) - // Gets all details of the groups associated with the Databricks account. + // Gets all details of the groups associated with the Databricks account. As of + // 08/22/2025, this endpoint will not return members. Instead, members should be + // retrieved by iterating through `Get group details`. // // This method is generated by Databricks SDK Code Generator. - ListAll(ctx context.Context, request ListAccountGroupsRequest) ([]Group, error) + List(ctx context.Context, request ListAccountGroupsRequest) listing.Iterator[AccountGroup] - // GroupDisplayNameToIdMap calls [AccountGroupsAPI.ListAll] and creates a map of results with [Group].DisplayName as key and [Group].Id as value. - // - // Returns an error if there's more than one [Group] with the same .DisplayName. - // - // Note: All [Group] instances are loaded into memory before creating a map. - // - // This method is generated by Databricks SDK Code Generator. - GroupDisplayNameToIdMap(ctx context.Context, request ListAccountGroupsRequest) (map[string]string, error) - - // GetByDisplayName calls [AccountGroupsAPI.GroupDisplayNameToIdMap] and returns a single [Group]. - // - // Returns an error if there's more than one [Group] with the same .DisplayName. - // - // Note: All [Group] instances are loaded into memory before returning matching by name. + // Gets all details of the groups associated with the Databricks account. As of + // 08/22/2025, this endpoint will not return members. Instead, members should be + // retrieved by iterating through `Get group details`. // // This method is generated by Databricks SDK Code Generator. - GetByDisplayName(ctx context.Context, name string) (*Group, error) + ListAll(ctx context.Context, request ListAccountGroupsRequest) ([]AccountGroup, error) // Partially updates the details of a group. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchAccountGroupRequest) error // Updates the details of a group by replacing the entire group entity. - Update(ctx context.Context, request Group) error + Update(ctx context.Context, request UpdateAccountGroupRequest) error } -func NewAccountGroups(client *client.DatabricksClient) *AccountGroupsAPI { - return &AccountGroupsAPI{ - accountGroupsImpl: accountGroupsImpl{ +func NewAccountGroupsV2(client *client.DatabricksClient) *AccountGroupsV2API { + return &AccountGroupsV2API{ + accountGroupsV2Impl: accountGroupsV2Impl{ client: client, }, } @@ -166,137 +144,45 @@ func NewAccountGroups(client *client.DatabricksClient) *AccountGroupsAPI { // policies in Unity Catalog to groups, instead of to users individually. All // Databricks account identities can be assigned as members of groups, and // members inherit permissions that are assigned to their group. -type AccountGroupsAPI struct { - accountGroupsImpl -} - -// Deletes a group from the Databricks account. -func (a *AccountGroupsAPI) DeleteById(ctx context.Context, id string) error { - return a.accountGroupsImpl.Delete(ctx, DeleteAccountGroupRequest{ - Id: id, - }) -} - -// Gets the information for a specific group in the Databricks account. -func (a *AccountGroupsAPI) GetById(ctx context.Context, id string) (*Group, error) { - return a.accountGroupsImpl.Get(ctx, GetAccountGroupRequest{ - Id: id, - }) -} - -// GroupDisplayNameToIdMap calls [AccountGroupsAPI.ListAll] and creates a map of results with [Group].DisplayName as key and [Group].Id as value. -// -// Returns an error if there's more than one [Group] with the same .DisplayName. -// -// Note: All [Group] instances are loaded into memory before creating a map. -// -// This method is generated by Databricks SDK Code Generator. -func (a *AccountGroupsAPI) GroupDisplayNameToIdMap(ctx context.Context, request ListAccountGroupsRequest) (map[string]string, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") - mapping := map[string]string{} - result, err := a.ListAll(ctx, request) - if err != nil { - return nil, err - } - for _, v := range result { - key := v.DisplayName - _, duplicate := mapping[key] - if duplicate { - return nil, fmt.Errorf("duplicate .DisplayName: %s", key) - } - mapping[key] = v.Id - } - return mapping, nil -} - -// GetByDisplayName calls [AccountGroupsAPI.GroupDisplayNameToIdMap] and returns a single [Group]. -// -// Returns an error if there's more than one [Group] with the same .DisplayName. -// -// Note: All [Group] instances are loaded into memory before returning matching by name. -// -// This method is generated by Databricks SDK Code Generator. -func (a *AccountGroupsAPI) GetByDisplayName(ctx context.Context, name string) (*Group, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") - result, err := a.ListAll(ctx, ListAccountGroupsRequest{}) - if err != nil { - return nil, err - } - tmp := map[string][]Group{} - for _, v := range result { - key := v.DisplayName - tmp[key] = append(tmp[key], v) - } - alternatives, ok := tmp[name] - if !ok || len(alternatives) == 0 { - return nil, fmt.Errorf("Group named '%s' does not exist", name) - } - if len(alternatives) > 1 { - return nil, fmt.Errorf("there are %d instances of Group named '%s'", len(alternatives), name) - } - return &alternatives[0], nil +type AccountGroupsV2API struct { + accountGroupsV2Impl } -type AccountServicePrincipalsInterface interface { +type AccountServicePrincipalsV2Interface interface { // Creates a new service principal in the Databricks account. - Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) + Create(ctx context.Context, request CreateAccountServicePrincipalRequest) (*AccountServicePrincipal, error) // Delete a single service principal in the Databricks account. Delete(ctx context.Context, request DeleteAccountServicePrincipalRequest) error - // Delete a single service principal in the Databricks account. - DeleteById(ctx context.Context, id string) error - // Gets the details for a single service principal define in the Databricks // account. - Get(ctx context.Context, request GetAccountServicePrincipalRequest) (*ServicePrincipal, error) - - // Gets the details for a single service principal define in the Databricks - // account. - GetById(ctx context.Context, id string) (*ServicePrincipal, error) + Get(ctx context.Context, request GetAccountServicePrincipalRequest) (*AccountServicePrincipal, error) // Gets the set of service principals associated with a Databricks account. // // This method is generated by Databricks SDK Code Generator. - List(ctx context.Context, request ListAccountServicePrincipalsRequest) listing.Iterator[ServicePrincipal] + List(ctx context.Context, request ListAccountServicePrincipalsRequest) listing.Iterator[AccountServicePrincipal] // Gets the set of service principals associated with a Databricks account. // // This method is generated by Databricks SDK Code Generator. - ListAll(ctx context.Context, request ListAccountServicePrincipalsRequest) ([]ServicePrincipal, error) - - // ServicePrincipalDisplayNameToIdMap calls [AccountServicePrincipalsAPI.ListAll] and creates a map of results with [ServicePrincipal].DisplayName as key and [ServicePrincipal].Id as value. - // - // Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. - // - // Note: All [ServicePrincipal] instances are loaded into memory before creating a map. - // - // This method is generated by Databricks SDK Code Generator. - ServicePrincipalDisplayNameToIdMap(ctx context.Context, request ListAccountServicePrincipalsRequest) (map[string]string, error) - - // GetByDisplayName calls [AccountServicePrincipalsAPI.ServicePrincipalDisplayNameToIdMap] and returns a single [ServicePrincipal]. - // - // Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. - // - // Note: All [ServicePrincipal] instances are loaded into memory before returning matching by name. - // - // This method is generated by Databricks SDK Code Generator. - GetByDisplayName(ctx context.Context, name string) (*ServicePrincipal, error) + ListAll(ctx context.Context, request ListAccountServicePrincipalsRequest) ([]AccountServicePrincipal, error) // Partially updates the details of a single service principal in the Databricks // account. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchAccountServicePrincipalRequest) error // Updates the details of a single service principal. // // This action replaces the existing service principal with the same name. - Update(ctx context.Context, request ServicePrincipal) error + Update(ctx context.Context, request UpdateAccountServicePrincipalRequest) error } -func NewAccountServicePrincipals(client *client.DatabricksClient) *AccountServicePrincipalsAPI { - return &AccountServicePrincipalsAPI{ - accountServicePrincipalsImpl: accountServicePrincipalsImpl{ +func NewAccountServicePrincipalsV2(client *client.DatabricksClient) *AccountServicePrincipalsV2API { + return &AccountServicePrincipalsV2API{ + accountServicePrincipalsV2Impl: accountServicePrincipalsV2Impl{ client: client, }, } @@ -308,137 +194,44 @@ func NewAccountServicePrincipals(client *client.DatabricksClient) *AccountServic // on production data run with service principals, interactive users do not need // any write, delete, or modify privileges in production. This eliminates the // risk of a user overwriting production data by accident. -type AccountServicePrincipalsAPI struct { - accountServicePrincipalsImpl +type AccountServicePrincipalsV2API struct { + accountServicePrincipalsV2Impl } -// Delete a single service principal in the Databricks account. -func (a *AccountServicePrincipalsAPI) DeleteById(ctx context.Context, id string) error { - return a.accountServicePrincipalsImpl.Delete(ctx, DeleteAccountServicePrincipalRequest{ - Id: id, - }) -} - -// Gets the details for a single service principal define in the Databricks -// account. -func (a *AccountServicePrincipalsAPI) GetById(ctx context.Context, id string) (*ServicePrincipal, error) { - return a.accountServicePrincipalsImpl.Get(ctx, GetAccountServicePrincipalRequest{ - Id: id, - }) -} - -// ServicePrincipalDisplayNameToIdMap calls [AccountServicePrincipalsAPI.ListAll] and creates a map of results with [ServicePrincipal].DisplayName as key and [ServicePrincipal].Id as value. -// -// Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. -// -// Note: All [ServicePrincipal] instances are loaded into memory before creating a map. -// -// This method is generated by Databricks SDK Code Generator. -func (a *AccountServicePrincipalsAPI) ServicePrincipalDisplayNameToIdMap(ctx context.Context, request ListAccountServicePrincipalsRequest) (map[string]string, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") - mapping := map[string]string{} - result, err := a.ListAll(ctx, request) - if err != nil { - return nil, err - } - for _, v := range result { - key := v.DisplayName - _, duplicate := mapping[key] - if duplicate { - return nil, fmt.Errorf("duplicate .DisplayName: %s", key) - } - mapping[key] = v.Id - } - return mapping, nil -} - -// GetByDisplayName calls [AccountServicePrincipalsAPI.ServicePrincipalDisplayNameToIdMap] and returns a single [ServicePrincipal]. -// -// Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. -// -// Note: All [ServicePrincipal] instances are loaded into memory before returning matching by name. -// -// This method is generated by Databricks SDK Code Generator. -func (a *AccountServicePrincipalsAPI) GetByDisplayName(ctx context.Context, name string) (*ServicePrincipal, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") - result, err := a.ListAll(ctx, ListAccountServicePrincipalsRequest{}) - if err != nil { - return nil, err - } - tmp := map[string][]ServicePrincipal{} - for _, v := range result { - key := v.DisplayName - tmp[key] = append(tmp[key], v) - } - alternatives, ok := tmp[name] - if !ok || len(alternatives) == 0 { - return nil, fmt.Errorf("ServicePrincipal named '%s' does not exist", name) - } - if len(alternatives) > 1 { - return nil, fmt.Errorf("there are %d instances of ServicePrincipal named '%s'", len(alternatives), name) - } - return &alternatives[0], nil -} - -type AccountUsersInterface interface { +type AccountUsersV2Interface interface { // Creates a new user in the Databricks account. This new user will also be // added to the Databricks account. - Create(ctx context.Context, request User) (*User, error) + Create(ctx context.Context, request CreateAccountUserRequest) (*AccountUser, error) // Deletes a user. Deleting a user from a Databricks account also removes // objects associated with the user. Delete(ctx context.Context, request DeleteAccountUserRequest) error - // Deletes a user. Deleting a user from a Databricks account also removes - // objects associated with the user. - DeleteById(ctx context.Context, id string) error - - // Gets information for a specific user in Databricks account. - Get(ctx context.Context, request GetAccountUserRequest) (*User, error) - // Gets information for a specific user in Databricks account. - GetById(ctx context.Context, id string) (*User, error) + Get(ctx context.Context, request GetAccountUserRequest) (*AccountUser, error) // Gets details for all the users associated with a Databricks account. // // This method is generated by Databricks SDK Code Generator. - List(ctx context.Context, request ListAccountUsersRequest) listing.Iterator[User] + List(ctx context.Context, request ListAccountUsersRequest) listing.Iterator[AccountGroup] // Gets details for all the users associated with a Databricks account. // // This method is generated by Databricks SDK Code Generator. - ListAll(ctx context.Context, request ListAccountUsersRequest) ([]User, error) - - // UserUserNameToIdMap calls [AccountUsersAPI.ListAll] and creates a map of results with [User].UserName as key and [User].Id as value. - // - // Returns an error if there's more than one [User] with the same .UserName. - // - // Note: All [User] instances are loaded into memory before creating a map. - // - // This method is generated by Databricks SDK Code Generator. - UserUserNameToIdMap(ctx context.Context, request ListAccountUsersRequest) (map[string]string, error) - - // GetByUserName calls [AccountUsersAPI.UserUserNameToIdMap] and returns a single [User]. - // - // Returns an error if there's more than one [User] with the same .UserName. - // - // Note: All [User] instances are loaded into memory before returning matching by name. - // - // This method is generated by Databricks SDK Code Generator. - GetByUserName(ctx context.Context, name string) (*User, error) + ListAll(ctx context.Context, request ListAccountUsersRequest) ([]AccountGroup, error) // Partially updates a user resource by applying the supplied operations on // specific user attributes. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchAccountUserRequest) error // Replaces a user's information with the data supplied in request. - Update(ctx context.Context, request User) error + Update(ctx context.Context, request UpdateAccountUserRequest) error } -func NewAccountUsers(client *client.DatabricksClient) *AccountUsersAPI { - return &AccountUsersAPI{ - accountUsersImpl: accountUsersImpl{ +func NewAccountUsersV2(client *client.DatabricksClient) *AccountUsersV2API { + return &AccountUsersV2API{ + accountUsersV2Impl: accountUsersV2Impl{ client: client, }, } @@ -455,76 +248,8 @@ func NewAccountUsers(client *client.DatabricksClient) *AccountUsersAPI { // provider and that user’s account will also be removed from Databricks // account. This ensures a consistent offboarding process and prevents // unauthorized users from accessing sensitive data. -type AccountUsersAPI struct { - accountUsersImpl -} - -// Deletes a user. Deleting a user from a Databricks account also removes -// objects associated with the user. -func (a *AccountUsersAPI) DeleteById(ctx context.Context, id string) error { - return a.accountUsersImpl.Delete(ctx, DeleteAccountUserRequest{ - Id: id, - }) -} - -// Gets information for a specific user in Databricks account. -func (a *AccountUsersAPI) GetById(ctx context.Context, id string) (*User, error) { - return a.accountUsersImpl.Get(ctx, GetAccountUserRequest{ - Id: id, - }) -} - -// UserUserNameToIdMap calls [AccountUsersAPI.ListAll] and creates a map of results with [User].UserName as key and [User].Id as value. -// -// Returns an error if there's more than one [User] with the same .UserName. -// -// Note: All [User] instances are loaded into memory before creating a map. -// -// This method is generated by Databricks SDK Code Generator. -func (a *AccountUsersAPI) UserUserNameToIdMap(ctx context.Context, request ListAccountUsersRequest) (map[string]string, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") - mapping := map[string]string{} - result, err := a.ListAll(ctx, request) - if err != nil { - return nil, err - } - for _, v := range result { - key := v.UserName - _, duplicate := mapping[key] - if duplicate { - return nil, fmt.Errorf("duplicate .UserName: %s", key) - } - mapping[key] = v.Id - } - return mapping, nil -} - -// GetByUserName calls [AccountUsersAPI.UserUserNameToIdMap] and returns a single [User]. -// -// Returns an error if there's more than one [User] with the same .UserName. -// -// Note: All [User] instances are loaded into memory before returning matching by name. -// -// This method is generated by Databricks SDK Code Generator. -func (a *AccountUsersAPI) GetByUserName(ctx context.Context, name string) (*User, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") - result, err := a.ListAll(ctx, ListAccountUsersRequest{}) - if err != nil { - return nil, err - } - tmp := map[string][]User{} - for _, v := range result { - key := v.UserName - tmp[key] = append(tmp[key], v) - } - alternatives, ok := tmp[name] - if !ok || len(alternatives) == 0 { - return nil, fmt.Errorf("User named '%s' does not exist", name) - } - if len(alternatives) > 1 { - return nil, fmt.Errorf("there are %d instances of User named '%s'", len(alternatives), name) - } - return &alternatives[0], nil +type AccountUsersV2API struct { + accountUsersV2Impl } type CurrentUserInterface interface { @@ -547,24 +272,18 @@ type CurrentUserAPI struct { currentUserImpl } -type GroupsInterface interface { +type GroupsV2Interface interface { // Creates a group in the Databricks workspace with a unique name, using the // supplied group details. - Create(ctx context.Context, request Group) (*Group, error) + Create(ctx context.Context, request CreateGroupRequest) (*Group, error) // Deletes a group from the Databricks workspace. Delete(ctx context.Context, request DeleteGroupRequest) error - // Deletes a group from the Databricks workspace. - DeleteById(ctx context.Context, id string) error - // Gets the information for a specific group in the Databricks workspace. Get(ctx context.Context, request GetGroupRequest) (*Group, error) - // Gets the information for a specific group in the Databricks workspace. - GetById(ctx context.Context, id string) (*Group, error) - // Gets all details of the groups associated with the Databricks workspace. // // This method is generated by Databricks SDK Code Generator. @@ -575,34 +294,16 @@ type GroupsInterface interface { // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListGroupsRequest) ([]Group, error) - // GroupDisplayNameToIdMap calls [GroupsAPI.ListAll] and creates a map of results with [Group].DisplayName as key and [Group].Id as value. - // - // Returns an error if there's more than one [Group] with the same .DisplayName. - // - // Note: All [Group] instances are loaded into memory before creating a map. - // - // This method is generated by Databricks SDK Code Generator. - GroupDisplayNameToIdMap(ctx context.Context, request ListGroupsRequest) (map[string]string, error) - - // GetByDisplayName calls [GroupsAPI.GroupDisplayNameToIdMap] and returns a single [Group]. - // - // Returns an error if there's more than one [Group] with the same .DisplayName. - // - // Note: All [Group] instances are loaded into memory before returning matching by name. - // - // This method is generated by Databricks SDK Code Generator. - GetByDisplayName(ctx context.Context, name string) (*Group, error) - // Partially updates the details of a group. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchGroupRequest) error // Updates the details of a group by replacing the entire group entity. - Update(ctx context.Context, request Group) error + Update(ctx context.Context, request UpdateGroupRequest) error } -func NewGroups(client *client.DatabricksClient) *GroupsAPI { - return &GroupsAPI{ - groupsImpl: groupsImpl{ +func NewGroupsV2(client *client.DatabricksClient) *GroupsV2API { + return &GroupsV2API{ + groupsV2Impl: groupsV2Impl{ client: client, }, } @@ -615,75 +316,8 @@ func NewGroups(client *client.DatabricksClient) *GroupsAPI { // policies in Unity Catalog to groups, instead of to users individually. All // Databricks workspace identities can be assigned as members of groups, and // members inherit permissions that are assigned to their group. -type GroupsAPI struct { - groupsImpl -} - -// Deletes a group from the Databricks workspace. -func (a *GroupsAPI) DeleteById(ctx context.Context, id string) error { - return a.groupsImpl.Delete(ctx, DeleteGroupRequest{ - Id: id, - }) -} - -// Gets the information for a specific group in the Databricks workspace. -func (a *GroupsAPI) GetById(ctx context.Context, id string) (*Group, error) { - return a.groupsImpl.Get(ctx, GetGroupRequest{ - Id: id, - }) -} - -// GroupDisplayNameToIdMap calls [GroupsAPI.ListAll] and creates a map of results with [Group].DisplayName as key and [Group].Id as value. -// -// Returns an error if there's more than one [Group] with the same .DisplayName. -// -// Note: All [Group] instances are loaded into memory before creating a map. -// -// This method is generated by Databricks SDK Code Generator. -func (a *GroupsAPI) GroupDisplayNameToIdMap(ctx context.Context, request ListGroupsRequest) (map[string]string, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") - mapping := map[string]string{} - result, err := a.ListAll(ctx, request) - if err != nil { - return nil, err - } - for _, v := range result { - key := v.DisplayName - _, duplicate := mapping[key] - if duplicate { - return nil, fmt.Errorf("duplicate .DisplayName: %s", key) - } - mapping[key] = v.Id - } - return mapping, nil -} - -// GetByDisplayName calls [GroupsAPI.GroupDisplayNameToIdMap] and returns a single [Group]. -// -// Returns an error if there's more than one [Group] with the same .DisplayName. -// -// Note: All [Group] instances are loaded into memory before returning matching by name. -// -// This method is generated by Databricks SDK Code Generator. -func (a *GroupsAPI) GetByDisplayName(ctx context.Context, name string) (*Group, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") - result, err := a.ListAll(ctx, ListGroupsRequest{}) - if err != nil { - return nil, err - } - tmp := map[string][]Group{} - for _, v := range result { - key := v.DisplayName - tmp[key] = append(tmp[key], v) - } - alternatives, ok := tmp[name] - if !ok || len(alternatives) == 0 { - return nil, fmt.Errorf("Group named '%s' does not exist", name) - } - if len(alternatives) > 1 { - return nil, fmt.Errorf("there are %d instances of Group named '%s'", len(alternatives), name) - } - return &alternatives[0], nil +type GroupsV2API struct { + groupsV2Impl } type PermissionMigrationInterface interface { @@ -792,25 +426,18 @@ func (a *PermissionsAPI) GetPermissionLevelsByRequestObjectTypeAndRequestObjectI }) } -type ServicePrincipalsInterface interface { +type ServicePrincipalsV2Interface interface { // Creates a new service principal in the Databricks workspace. - Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) + Create(ctx context.Context, request CreateServicePrincipalRequest) (*ServicePrincipal, error) // Delete a single service principal in the Databricks workspace. Delete(ctx context.Context, request DeleteServicePrincipalRequest) error - // Delete a single service principal in the Databricks workspace. - DeleteById(ctx context.Context, id string) error - // Gets the details for a single service principal define in the Databricks // workspace. Get(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) - // Gets the details for a single service principal define in the Databricks - // workspace. - GetById(ctx context.Context, id string) (*ServicePrincipal, error) - // Gets the set of service principals associated with a Databricks workspace. // // This method is generated by Databricks SDK Code Generator. @@ -821,37 +448,19 @@ type ServicePrincipalsInterface interface { // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListServicePrincipalsRequest) ([]ServicePrincipal, error) - // ServicePrincipalDisplayNameToIdMap calls [ServicePrincipalsAPI.ListAll] and creates a map of results with [ServicePrincipal].DisplayName as key and [ServicePrincipal].Id as value. - // - // Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. - // - // Note: All [ServicePrincipal] instances are loaded into memory before creating a map. - // - // This method is generated by Databricks SDK Code Generator. - ServicePrincipalDisplayNameToIdMap(ctx context.Context, request ListServicePrincipalsRequest) (map[string]string, error) - - // GetByDisplayName calls [ServicePrincipalsAPI.ServicePrincipalDisplayNameToIdMap] and returns a single [ServicePrincipal]. - // - // Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. - // - // Note: All [ServicePrincipal] instances are loaded into memory before returning matching by name. - // - // This method is generated by Databricks SDK Code Generator. - GetByDisplayName(ctx context.Context, name string) (*ServicePrincipal, error) - // Partially updates the details of a single service principal in the Databricks // workspace. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchServicePrincipalRequest) error // Updates the details of a single service principal. // // This action replaces the existing service principal with the same name. - Update(ctx context.Context, request ServicePrincipal) error + Update(ctx context.Context, request UpdateServicePrincipalRequest) error } -func NewServicePrincipals(client *client.DatabricksClient) *ServicePrincipalsAPI { - return &ServicePrincipalsAPI{ - servicePrincipalsImpl: servicePrincipalsImpl{ +func NewServicePrincipalsV2(client *client.DatabricksClient) *ServicePrincipalsV2API { + return &ServicePrincipalsV2API{ + servicePrincipalsV2Impl: servicePrincipalsV2Impl{ client: client, }, } @@ -863,104 +472,29 @@ func NewServicePrincipals(client *client.DatabricksClient) *ServicePrincipalsAPI // on production data run with service principals, interactive users do not need // any write, delete, or modify privileges in production. This eliminates the // risk of a user overwriting production data by accident. -type ServicePrincipalsAPI struct { - servicePrincipalsImpl -} - -// Delete a single service principal in the Databricks workspace. -func (a *ServicePrincipalsAPI) DeleteById(ctx context.Context, id string) error { - return a.servicePrincipalsImpl.Delete(ctx, DeleteServicePrincipalRequest{ - Id: id, - }) -} - -// Gets the details for a single service principal define in the Databricks -// workspace. -func (a *ServicePrincipalsAPI) GetById(ctx context.Context, id string) (*ServicePrincipal, error) { - return a.servicePrincipalsImpl.Get(ctx, GetServicePrincipalRequest{ - Id: id, - }) -} - -// ServicePrincipalDisplayNameToIdMap calls [ServicePrincipalsAPI.ListAll] and creates a map of results with [ServicePrincipal].DisplayName as key and [ServicePrincipal].Id as value. -// -// Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. -// -// Note: All [ServicePrincipal] instances are loaded into memory before creating a map. -// -// This method is generated by Databricks SDK Code Generator. -func (a *ServicePrincipalsAPI) ServicePrincipalDisplayNameToIdMap(ctx context.Context, request ListServicePrincipalsRequest) (map[string]string, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") - mapping := map[string]string{} - result, err := a.ListAll(ctx, request) - if err != nil { - return nil, err - } - for _, v := range result { - key := v.DisplayName - _, duplicate := mapping[key] - if duplicate { - return nil, fmt.Errorf("duplicate .DisplayName: %s", key) - } - mapping[key] = v.Id - } - return mapping, nil -} - -// GetByDisplayName calls [ServicePrincipalsAPI.ServicePrincipalDisplayNameToIdMap] and returns a single [ServicePrincipal]. -// -// Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. -// -// Note: All [ServicePrincipal] instances are loaded into memory before returning matching by name. -// -// This method is generated by Databricks SDK Code Generator. -func (a *ServicePrincipalsAPI) GetByDisplayName(ctx context.Context, name string) (*ServicePrincipal, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") - result, err := a.ListAll(ctx, ListServicePrincipalsRequest{}) - if err != nil { - return nil, err - } - tmp := map[string][]ServicePrincipal{} - for _, v := range result { - key := v.DisplayName - tmp[key] = append(tmp[key], v) - } - alternatives, ok := tmp[name] - if !ok || len(alternatives) == 0 { - return nil, fmt.Errorf("ServicePrincipal named '%s' does not exist", name) - } - if len(alternatives) > 1 { - return nil, fmt.Errorf("there are %d instances of ServicePrincipal named '%s'", len(alternatives), name) - } - return &alternatives[0], nil +type ServicePrincipalsV2API struct { + servicePrincipalsV2Impl } -type UsersInterface interface { +type UsersV2Interface interface { // Creates a new user in the Databricks workspace. This new user will also be // added to the Databricks account. - Create(ctx context.Context, request User) (*User, error) + Create(ctx context.Context, request CreateUserRequest) (*User, error) // Deletes a user. Deleting a user from a Databricks workspace also removes // objects associated with the user. Delete(ctx context.Context, request DeleteUserRequest) error - // Deletes a user. Deleting a user from a Databricks workspace also removes - // objects associated with the user. - DeleteById(ctx context.Context, id string) error - // Gets information for a specific user in Databricks workspace. Get(ctx context.Context, request GetUserRequest) (*User, error) - // Gets information for a specific user in Databricks workspace. - GetById(ctx context.Context, id string) (*User, error) - // Gets the permission levels that a user can have on an object. - GetPermissionLevels(ctx context.Context) (*GetPasswordPermissionLevelsResponse, error) + GetPermissionLevels(ctx context.Context, request GetPasswordPermissionLevelsRequest) (*GetPasswordPermissionLevelsResponse, error) // Gets the permissions of all passwords. Passwords can inherit permissions from // their root object. - GetPermissions(ctx context.Context) (*PasswordPermissions, error) + GetPermissions(ctx context.Context, request GetPasswordPermissionsRequest) (*PasswordPermissions, error) // Gets details for all the users associated with a Databricks workspace. // @@ -972,27 +506,9 @@ type UsersInterface interface { // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListUsersRequest) ([]User, error) - // UserUserNameToIdMap calls [UsersAPI.ListAll] and creates a map of results with [User].UserName as key and [User].Id as value. - // - // Returns an error if there's more than one [User] with the same .UserName. - // - // Note: All [User] instances are loaded into memory before creating a map. - // - // This method is generated by Databricks SDK Code Generator. - UserUserNameToIdMap(ctx context.Context, request ListUsersRequest) (map[string]string, error) - - // GetByUserName calls [UsersAPI.UserUserNameToIdMap] and returns a single [User]. - // - // Returns an error if there's more than one [User] with the same .UserName. - // - // Note: All [User] instances are loaded into memory before returning matching by name. - // - // This method is generated by Databricks SDK Code Generator. - GetByUserName(ctx context.Context, name string) (*User, error) - // Partially updates a user resource by applying the supplied operations on // specific user attributes. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchUserRequest) error // Sets permissions on an object, replacing existing permissions if they exist. // Deletes all direct permissions if none are specified. Objects can inherit @@ -1000,16 +516,16 @@ type UsersInterface interface { SetPermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) // Replaces a user's information with the data supplied in request. - Update(ctx context.Context, request User) error + Update(ctx context.Context, request UpdateUserRequest) error // Updates the permissions on all passwords. Passwords can inherit permissions // from their root object. UpdatePermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) } -func NewUsers(client *client.DatabricksClient) *UsersAPI { - return &UsersAPI{ - usersImpl: usersImpl{ +func NewUsersV2(client *client.DatabricksClient) *UsersV2API { + return &UsersV2API{ + usersV2Impl: usersV2Impl{ client: client, }, } @@ -1026,76 +542,8 @@ func NewUsers(client *client.DatabricksClient) *UsersAPI { // identity provider and that user’s account will also be removed from // Databricks workspace. This ensures a consistent offboarding process and // prevents unauthorized users from accessing sensitive data. -type UsersAPI struct { - usersImpl -} - -// Deletes a user. Deleting a user from a Databricks workspace also removes -// objects associated with the user. -func (a *UsersAPI) DeleteById(ctx context.Context, id string) error { - return a.usersImpl.Delete(ctx, DeleteUserRequest{ - Id: id, - }) -} - -// Gets information for a specific user in Databricks workspace. -func (a *UsersAPI) GetById(ctx context.Context, id string) (*User, error) { - return a.usersImpl.Get(ctx, GetUserRequest{ - Id: id, - }) -} - -// UserUserNameToIdMap calls [UsersAPI.ListAll] and creates a map of results with [User].UserName as key and [User].Id as value. -// -// Returns an error if there's more than one [User] with the same .UserName. -// -// Note: All [User] instances are loaded into memory before creating a map. -// -// This method is generated by Databricks SDK Code Generator. -func (a *UsersAPI) UserUserNameToIdMap(ctx context.Context, request ListUsersRequest) (map[string]string, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") - mapping := map[string]string{} - result, err := a.ListAll(ctx, request) - if err != nil { - return nil, err - } - for _, v := range result { - key := v.UserName - _, duplicate := mapping[key] - if duplicate { - return nil, fmt.Errorf("duplicate .UserName: %s", key) - } - mapping[key] = v.Id - } - return mapping, nil -} - -// GetByUserName calls [UsersAPI.UserUserNameToIdMap] and returns a single [User]. -// -// Returns an error if there's more than one [User] with the same .UserName. -// -// Note: All [User] instances are loaded into memory before returning matching by name. -// -// This method is generated by Databricks SDK Code Generator. -func (a *UsersAPI) GetByUserName(ctx context.Context, name string) (*User, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") - result, err := a.ListAll(ctx, ListUsersRequest{}) - if err != nil { - return nil, err - } - tmp := map[string][]User{} - for _, v := range result { - key := v.UserName - tmp[key] = append(tmp[key], v) - } - alternatives, ok := tmp[name] - if !ok || len(alternatives) == 0 { - return nil, fmt.Errorf("User named '%s' does not exist", name) - } - if len(alternatives) > 1 { - return nil, fmt.Errorf("there are %d instances of User named '%s'", len(alternatives), name) - } - return &alternatives[0], nil +type UsersV2API struct { + usersV2Impl } type WorkspaceAssignmentInterface interface { diff --git a/service/iam/ext_api.go b/service/iam/ext_api.go new file mode 100644 index 000000000..3372b6762 --- /dev/null +++ b/service/iam/ext_api.go @@ -0,0 +1,884 @@ +package iam + +import ( + "context" + "fmt" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" + "github.com/databricks/databricks-sdk-go/useragent" +) + +type AccountGroupsInterface interface { + + // Creates a group in the Databricks account with a unique name, using the + // supplied group details. + Create(ctx context.Context, request Group) (*Group, error) + + // Deletes a group from the Databricks account. + Delete(ctx context.Context, request DeleteAccountGroupRequest) error + + // Deletes a group from the Databricks account. + DeleteById(ctx context.Context, id string) error + + // Gets the information for a specific group in the Databricks account. + Get(ctx context.Context, request GetAccountGroupRequest) (*Group, error) + + // Gets the information for a specific group in the Databricks account. + GetById(ctx context.Context, id string) (*Group, error) + + // Gets all details of the groups associated with the Databricks account. + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context, request ListAccountGroupsRequest) listing.Iterator[Group] + + // Gets all details of the groups associated with the Databricks account. + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context, request ListAccountGroupsRequest) ([]Group, error) + + // GroupDisplayNameToIdMap calls [AccountGroupsAPI.ListAll] and creates a map of results with [Group].DisplayName as key and [Group].Id as value. + // + // Returns an error if there's more than one [Group] with the same .DisplayName. + // + // Note: All [Group] instances are loaded into memory before creating a map. + // + // This method is generated by Databricks SDK Code Generator. + GroupDisplayNameToIdMap(ctx context.Context, request ListAccountGroupsRequest) (map[string]string, error) + + // GetByDisplayName calls [AccountGroupsAPI.GroupDisplayNameToIdMap] and returns a single [Group]. + // + // Returns an error if there's more than one [Group] with the same .DisplayName. + // + // Note: All [Group] instances are loaded into memory before returning matching by name. + // + // This method is generated by Databricks SDK Code Generator. + GetByDisplayName(ctx context.Context, name string) (*Group, error) + + // Partially updates the details of a group. + Patch(ctx context.Context, request PartialUpdate) error + + // Updates the details of a group by replacing the entire group entity. + Update(ctx context.Context, request Group) error +} + +func NewAccountGroups(client *client.DatabricksClient) *AccountGroupsAPI { + return &AccountGroupsAPI{ + accountGroupsImpl: accountGroupsImpl{ + client: client, + }, + } +} + +// Groups simplify identity management, making it easier to assign access to +// Databricks account, data, and other securable objects. +// +// It is best practice to assign access to workspaces and access-control +// policies in Unity Catalog to groups, instead of to users individually. All +// Databricks account identities can be assigned as members of groups, and +// members inherit permissions that are assigned to their group. +type AccountGroupsAPI struct { + accountGroupsImpl +} + +// Deletes a group from the Databricks account. +func (a *AccountGroupsAPI) DeleteById(ctx context.Context, id string) error { + return a.accountGroupsImpl.Delete(ctx, DeleteAccountGroupRequest{ + Id: id, + }) +} + +// Gets the information for a specific group in the Databricks account. +func (a *AccountGroupsAPI) GetById(ctx context.Context, id string) (*Group, error) { + return a.accountGroupsImpl.Get(ctx, GetAccountGroupRequest{ + Id: id, + }) +} + +// GroupDisplayNameToIdMap calls [AccountGroupsAPI.ListAll] and creates a map of results with [Group].DisplayName as key and [Group].Id as value. +// +// Returns an error if there's more than one [Group] with the same .DisplayName. +// +// Note: All [Group] instances are loaded into memory before creating a map. +// +// This method is generated by Databricks SDK Code Generator. +func (a *AccountGroupsAPI) GroupDisplayNameToIdMap(ctx context.Context, request ListAccountGroupsRequest) (map[string]string, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") + mapping := map[string]string{} + result, err := a.ListAll(ctx, request) + if err != nil { + return nil, err + } + for _, v := range result { + key := v.DisplayName + _, duplicate := mapping[key] + if duplicate { + return nil, fmt.Errorf("duplicate .DisplayName: %s", key) + } + mapping[key] = v.Id + } + return mapping, nil +} + +// GetByDisplayName calls [AccountGroupsAPI.GroupDisplayNameToIdMap] and returns a single [Group]. +// +// Returns an error if there's more than one [Group] with the same .DisplayName. +// +// Note: All [Group] instances are loaded into memory before returning matching by name. +// +// This method is generated by Databricks SDK Code Generator. +func (a *AccountGroupsAPI) GetByDisplayName(ctx context.Context, name string) (*Group, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") + result, err := a.ListAll(ctx, ListAccountGroupsRequest{}) + if err != nil { + return nil, err + } + tmp := map[string][]Group{} + for _, v := range result { + key := v.DisplayName + tmp[key] = append(tmp[key], v) + } + alternatives, ok := tmp[name] + if !ok || len(alternatives) == 0 { + return nil, fmt.Errorf("Group named '%s' does not exist", name) + } + if len(alternatives) > 1 { + return nil, fmt.Errorf("there are %d instances of Group named '%s'", len(alternatives), name) + } + return &alternatives[0], nil +} + +type AccountServicePrincipalsInterface interface { + + // Creates a new service principal in the Databricks account. + Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) + + // Delete a single service principal in the Databricks account. + Delete(ctx context.Context, request DeleteAccountServicePrincipalRequest) error + + // Delete a single service principal in the Databricks account. + DeleteById(ctx context.Context, id string) error + + // Gets the details for a single service principal define in the Databricks + // account. + Get(ctx context.Context, request GetAccountServicePrincipalRequest) (*ServicePrincipal, error) + + // Gets the details for a single service principal define in the Databricks + // account. + GetById(ctx context.Context, id string) (*ServicePrincipal, error) + + // Gets the set of service principals associated with a Databricks account. + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context, request ListAccountServicePrincipalsRequest) listing.Iterator[ServicePrincipal] + + // Gets the set of service principals associated with a Databricks account. + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context, request ListAccountServicePrincipalsRequest) ([]ServicePrincipal, error) + + // ServicePrincipalDisplayNameToIdMap calls [AccountServicePrincipalsAPI.ListAll] and creates a map of results with [ServicePrincipal].DisplayName as key and [ServicePrincipal].Id as value. + // + // Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. + // + // Note: All [ServicePrincipal] instances are loaded into memory before creating a map. + // + // This method is generated by Databricks SDK Code Generator. + ServicePrincipalDisplayNameToIdMap(ctx context.Context, request ListAccountServicePrincipalsRequest) (map[string]string, error) + + // GetByDisplayName calls [AccountServicePrincipalsAPI.ServicePrincipalDisplayNameToIdMap] and returns a single [ServicePrincipal]. + // + // Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. + // + // Note: All [ServicePrincipal] instances are loaded into memory before returning matching by name. + // + // This method is generated by Databricks SDK Code Generator. + GetByDisplayName(ctx context.Context, name string) (*ServicePrincipal, error) + + // Partially updates the details of a single service principal in the Databricks + // account. + Patch(ctx context.Context, request PartialUpdate) error + + // Updates the details of a single service principal. + // + // This action replaces the existing service principal with the same name. + Update(ctx context.Context, request ServicePrincipal) error +} + +func NewAccountServicePrincipals(client *client.DatabricksClient) *AccountServicePrincipalsAPI { + return &AccountServicePrincipalsAPI{ + accountServicePrincipalsImpl: accountServicePrincipalsImpl{ + client: client, + }, + } +} + +// Identities for use with jobs, automated tools, and systems such as scripts, +// apps, and CI/CD platforms. Databricks recommends creating service principals +// to run production jobs or modify production data. If all processes that act +// on production data run with service principals, interactive users do not need +// any write, delete, or modify privileges in production. This eliminates the +// risk of a user overwriting production data by accident. +type AccountServicePrincipalsAPI struct { + accountServicePrincipalsImpl +} + +// Delete a single service principal in the Databricks account. +func (a *AccountServicePrincipalsAPI) DeleteById(ctx context.Context, id string) error { + return a.accountServicePrincipalsImpl.Delete(ctx, DeleteAccountServicePrincipalRequest{ + Id: id, + }) +} + +// Gets the details for a single service principal define in the Databricks +// account. +func (a *AccountServicePrincipalsAPI) GetById(ctx context.Context, id string) (*ServicePrincipal, error) { + return a.accountServicePrincipalsImpl.Get(ctx, GetAccountServicePrincipalRequest{ + Id: id, + }) +} + +// ServicePrincipalDisplayNameToIdMap calls [AccountServicePrincipalsAPI.ListAll] and creates a map of results with [ServicePrincipal].DisplayName as key and [ServicePrincipal].Id as value. +// +// Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. +// +// Note: All [ServicePrincipal] instances are loaded into memory before creating a map. +// +// This method is generated by Databricks SDK Code Generator. +func (a *AccountServicePrincipalsAPI) ServicePrincipalDisplayNameToIdMap(ctx context.Context, request ListAccountServicePrincipalsRequest) (map[string]string, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") + mapping := map[string]string{} + result, err := a.ListAll(ctx, request) + if err != nil { + return nil, err + } + for _, v := range result { + key := v.DisplayName + _, duplicate := mapping[key] + if duplicate { + return nil, fmt.Errorf("duplicate .DisplayName: %s", key) + } + mapping[key] = v.Id + } + return mapping, nil +} + +// GetByDisplayName calls [AccountServicePrincipalsAPI.ServicePrincipalDisplayNameToIdMap] and returns a single [ServicePrincipal]. +// +// Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. +// +// Note: All [ServicePrincipal] instances are loaded into memory before returning matching by name. +// +// This method is generated by Databricks SDK Code Generator. +func (a *AccountServicePrincipalsAPI) GetByDisplayName(ctx context.Context, name string) (*ServicePrincipal, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") + result, err := a.ListAll(ctx, ListAccountServicePrincipalsRequest{}) + if err != nil { + return nil, err + } + tmp := map[string][]ServicePrincipal{} + for _, v := range result { + key := v.DisplayName + tmp[key] = append(tmp[key], v) + } + alternatives, ok := tmp[name] + if !ok || len(alternatives) == 0 { + return nil, fmt.Errorf("ServicePrincipal named '%s' does not exist", name) + } + if len(alternatives) > 1 { + return nil, fmt.Errorf("there are %d instances of ServicePrincipal named '%s'", len(alternatives), name) + } + return &alternatives[0], nil +} + +type AccountUsersInterface interface { + + // Creates a new user in the Databricks account. This new user will also be + // added to the Databricks account. + Create(ctx context.Context, request User) (*User, error) + + // Deletes a user. Deleting a user from a Databricks account also removes + // objects associated with the user. + Delete(ctx context.Context, request DeleteAccountUserRequest) error + + // Deletes a user. Deleting a user from a Databricks account also removes + // objects associated with the user. + DeleteById(ctx context.Context, id string) error + + // Gets information for a specific user in Databricks account. + Get(ctx context.Context, request GetAccountUserRequest) (*User, error) + + // Gets information for a specific user in Databricks account. + GetById(ctx context.Context, id string) (*User, error) + + // Gets details for all the users associated with a Databricks account. + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context, request ListAccountUsersRequest) listing.Iterator[User] + + // Gets details for all the users associated with a Databricks account. + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context, request ListAccountUsersRequest) ([]User, error) + + // UserUserNameToIdMap calls [AccountUsersAPI.ListAll] and creates a map of results with [User].UserName as key and [User].Id as value. + // + // Returns an error if there's more than one [User] with the same .UserName. + // + // Note: All [User] instances are loaded into memory before creating a map. + // + // This method is generated by Databricks SDK Code Generator. + UserUserNameToIdMap(ctx context.Context, request ListAccountUsersRequest) (map[string]string, error) + + // GetByUserName calls [AccountUsersAPI.UserUserNameToIdMap] and returns a single [User]. + // + // Returns an error if there's more than one [User] with the same .UserName. + // + // Note: All [User] instances are loaded into memory before returning matching by name. + // + // This method is generated by Databricks SDK Code Generator. + GetByUserName(ctx context.Context, name string) (*User, error) + + // Partially updates a user resource by applying the supplied operations on + // specific user attributes. + Patch(ctx context.Context, request PartialUpdate) error + + // Replaces a user's information with the data supplied in request. + Update(ctx context.Context, request User) error +} + +func NewAccountUsers(client *client.DatabricksClient) *AccountUsersAPI { + return &AccountUsersAPI{ + accountUsersImpl: accountUsersImpl{ + client: client, + }, + } +} + +// User identities recognized by Databricks and represented by email addresses. +// +// Databricks recommends using SCIM provisioning to sync users and groups +// automatically from your identity provider to your Databricks account. SCIM +// streamlines onboarding a new employee or team by using your identity provider +// to create users and groups in Databricks account and give them the proper +// level of access. When a user leaves your organization or no longer needs +// access to Databricks account, admins can terminate the user in your identity +// provider and that user’s account will also be removed from Databricks +// account. This ensures a consistent offboarding process and prevents +// unauthorized users from accessing sensitive data. +type AccountUsersAPI struct { + accountUsersImpl +} + +// Deletes a user. Deleting a user from a Databricks account also removes +// objects associated with the user. +func (a *AccountUsersAPI) DeleteById(ctx context.Context, id string) error { + return a.accountUsersImpl.Delete(ctx, DeleteAccountUserRequest{ + Id: id, + }) +} + +// Gets information for a specific user in Databricks account. +func (a *AccountUsersAPI) GetById(ctx context.Context, id string) (*User, error) { + return a.accountUsersImpl.Get(ctx, GetAccountUserRequest{ + Id: id, + }) +} + +// UserUserNameToIdMap calls [AccountUsersAPI.ListAll] and creates a map of results with [User].UserName as key and [User].Id as value. +// +// Returns an error if there's more than one [User] with the same .UserName. +// +// Note: All [User] instances are loaded into memory before creating a map. +// +// This method is generated by Databricks SDK Code Generator. +func (a *AccountUsersAPI) UserUserNameToIdMap(ctx context.Context, request ListAccountUsersRequest) (map[string]string, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") + mapping := map[string]string{} + result, err := a.ListAll(ctx, request) + if err != nil { + return nil, err + } + for _, v := range result { + key := v.UserName + _, duplicate := mapping[key] + if duplicate { + return nil, fmt.Errorf("duplicate .UserName: %s", key) + } + mapping[key] = v.Id + } + return mapping, nil +} + +// GetByUserName calls [AccountUsersAPI.UserUserNameToIdMap] and returns a single [User]. +// +// Returns an error if there's more than one [User] with the same .UserName. +// +// Note: All [User] instances are loaded into memory before returning matching by name. +// +// This method is generated by Databricks SDK Code Generator. +func (a *AccountUsersAPI) GetByUserName(ctx context.Context, name string) (*User, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") + result, err := a.ListAll(ctx, ListAccountUsersRequest{}) + if err != nil { + return nil, err + } + tmp := map[string][]User{} + for _, v := range result { + key := v.UserName + tmp[key] = append(tmp[key], v) + } + alternatives, ok := tmp[name] + if !ok || len(alternatives) == 0 { + return nil, fmt.Errorf("User named '%s' does not exist", name) + } + if len(alternatives) > 1 { + return nil, fmt.Errorf("there are %d instances of User named '%s'", len(alternatives), name) + } + return &alternatives[0], nil +} + +type GroupsInterface interface { + + // Creates a group in the Databricks workspace with a unique name, using the + // supplied group details. + Create(ctx context.Context, request Group) (*Group, error) + + // Deletes a group from the Databricks workspace. + Delete(ctx context.Context, request DeleteGroupRequest) error + + // Deletes a group from the Databricks workspace. + DeleteById(ctx context.Context, id string) error + + // Gets the information for a specific group in the Databricks workspace. + Get(ctx context.Context, request GetGroupRequest) (*Group, error) + + // Gets the information for a specific group in the Databricks workspace. + GetById(ctx context.Context, id string) (*Group, error) + + // Gets all details of the groups associated with the Databricks workspace. + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context, request ListGroupsRequest) listing.Iterator[Group] + + // Gets all details of the groups associated with the Databricks workspace. + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context, request ListGroupsRequest) ([]Group, error) + + // GroupDisplayNameToIdMap calls [GroupsAPI.ListAll] and creates a map of results with [Group].DisplayName as key and [Group].Id as value. + // + // Returns an error if there's more than one [Group] with the same .DisplayName. + // + // Note: All [Group] instances are loaded into memory before creating a map. + // + // This method is generated by Databricks SDK Code Generator. + GroupDisplayNameToIdMap(ctx context.Context, request ListGroupsRequest) (map[string]string, error) + + // GetByDisplayName calls [GroupsAPI.GroupDisplayNameToIdMap] and returns a single [Group]. + // + // Returns an error if there's more than one [Group] with the same .DisplayName. + // + // Note: All [Group] instances are loaded into memory before returning matching by name. + // + // This method is generated by Databricks SDK Code Generator. + GetByDisplayName(ctx context.Context, name string) (*Group, error) + + // Partially updates the details of a group. + Patch(ctx context.Context, request PartialUpdate) error + + // Updates the details of a group by replacing the entire group entity. + Update(ctx context.Context, request Group) error +} + +func NewGroups(client *client.DatabricksClient) *GroupsAPI { + return &GroupsAPI{ + groupsImpl: groupsImpl{ + client: client, + }, + } +} + +// Groups simplify identity management, making it easier to assign access to +// Databricks workspace, data, and other securable objects. +// +// It is best practice to assign access to workspaces and access-control +// policies in Unity Catalog to groups, instead of to users individually. All +// Databricks workspace identities can be assigned as members of groups, and +// members inherit permissions that are assigned to their group. +type GroupsAPI struct { + groupsImpl +} + +// Deletes a group from the Databricks workspace. +func (a *GroupsAPI) DeleteById(ctx context.Context, id string) error { + return a.groupsImpl.Delete(ctx, DeleteGroupRequest{ + Id: id, + }) +} + +// Gets the information for a specific group in the Databricks workspace. +func (a *GroupsAPI) GetById(ctx context.Context, id string) (*Group, error) { + return a.groupsImpl.Get(ctx, GetGroupRequest{ + Id: id, + }) +} + +// GroupDisplayNameToIdMap calls [GroupsAPI.ListAll] and creates a map of results with [Group].DisplayName as key and [Group].Id as value. +// +// Returns an error if there's more than one [Group] with the same .DisplayName. +// +// Note: All [Group] instances are loaded into memory before creating a map. +// +// This method is generated by Databricks SDK Code Generator. +func (a *GroupsAPI) GroupDisplayNameToIdMap(ctx context.Context, request ListGroupsRequest) (map[string]string, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") + mapping := map[string]string{} + result, err := a.ListAll(ctx, request) + if err != nil { + return nil, err + } + for _, v := range result { + key := v.DisplayName + _, duplicate := mapping[key] + if duplicate { + return nil, fmt.Errorf("duplicate .DisplayName: %s", key) + } + mapping[key] = v.Id + } + return mapping, nil +} + +// GetByDisplayName calls [GroupsAPI.GroupDisplayNameToIdMap] and returns a single [Group]. +// +// Returns an error if there's more than one [Group] with the same .DisplayName. +// +// Note: All [Group] instances are loaded into memory before returning matching by name. +// +// This method is generated by Databricks SDK Code Generator. +func (a *GroupsAPI) GetByDisplayName(ctx context.Context, name string) (*Group, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") + result, err := a.ListAll(ctx, ListGroupsRequest{}) + if err != nil { + return nil, err + } + tmp := map[string][]Group{} + for _, v := range result { + key := v.DisplayName + tmp[key] = append(tmp[key], v) + } + alternatives, ok := tmp[name] + if !ok || len(alternatives) == 0 { + return nil, fmt.Errorf("Group named '%s' does not exist", name) + } + if len(alternatives) > 1 { + return nil, fmt.Errorf("there are %d instances of Group named '%s'", len(alternatives), name) + } + return &alternatives[0], nil +} + +type ServicePrincipalsInterface interface { + + // Creates a new service principal in the Databricks workspace. + Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) + + // Delete a single service principal in the Databricks workspace. + Delete(ctx context.Context, request DeleteServicePrincipalRequest) error + + // Delete a single service principal in the Databricks workspace. + DeleteById(ctx context.Context, id string) error + + // Gets the details for a single service principal define in the Databricks + // workspace. + Get(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) + + // Gets the details for a single service principal define in the Databricks + // workspace. + GetById(ctx context.Context, id string) (*ServicePrincipal, error) + + // Gets the set of service principals associated with a Databricks workspace. + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context, request ListServicePrincipalsRequest) listing.Iterator[ServicePrincipal] + + // Gets the set of service principals associated with a Databricks workspace. + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context, request ListServicePrincipalsRequest) ([]ServicePrincipal, error) + + // ServicePrincipalDisplayNameToIdMap calls [ServicePrincipalsAPI.ListAll] and creates a map of results with [ServicePrincipal].DisplayName as key and [ServicePrincipal].Id as value. + // + // Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. + // + // Note: All [ServicePrincipal] instances are loaded into memory before creating a map. + // + // This method is generated by Databricks SDK Code Generator. + ServicePrincipalDisplayNameToIdMap(ctx context.Context, request ListServicePrincipalsRequest) (map[string]string, error) + + // GetByDisplayName calls [ServicePrincipalsAPI.ServicePrincipalDisplayNameToIdMap] and returns a single [ServicePrincipal]. + // + // Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. + // + // Note: All [ServicePrincipal] instances are loaded into memory before returning matching by name. + // + // This method is generated by Databricks SDK Code Generator. + GetByDisplayName(ctx context.Context, name string) (*ServicePrincipal, error) + + // Partially updates the details of a single service principal in the Databricks + // workspace. + Patch(ctx context.Context, request PartialUpdate) error + + // Updates the details of a single service principal. + // + // This action replaces the existing service principal with the same name. + Update(ctx context.Context, request ServicePrincipal) error +} + +func NewServicePrincipals(client *client.DatabricksClient) *ServicePrincipalsAPI { + return &ServicePrincipalsAPI{ + servicePrincipalsImpl: servicePrincipalsImpl{ + client: client, + }, + } +} + +// Identities for use with jobs, automated tools, and systems such as scripts, +// apps, and CI/CD platforms. Databricks recommends creating service principals +// to run production jobs or modify production data. If all processes that act +// on production data run with service principals, interactive users do not need +// any write, delete, or modify privileges in production. This eliminates the +// risk of a user overwriting production data by accident. +type ServicePrincipalsAPI struct { + servicePrincipalsImpl +} + +// Delete a single service principal in the Databricks workspace. +func (a *ServicePrincipalsAPI) DeleteById(ctx context.Context, id string) error { + return a.servicePrincipalsImpl.Delete(ctx, DeleteServicePrincipalRequest{ + Id: id, + }) +} + +// Gets the details for a single service principal define in the Databricks +// workspace. +func (a *ServicePrincipalsAPI) GetById(ctx context.Context, id string) (*ServicePrincipal, error) { + return a.servicePrincipalsImpl.Get(ctx, GetServicePrincipalRequest{ + Id: id, + }) +} + +// ServicePrincipalDisplayNameToIdMap calls [ServicePrincipalsAPI.ListAll] and creates a map of results with [ServicePrincipal].DisplayName as key and [ServicePrincipal].Id as value. +// +// Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. +// +// Note: All [ServicePrincipal] instances are loaded into memory before creating a map. +// +// This method is generated by Databricks SDK Code Generator. +func (a *ServicePrincipalsAPI) ServicePrincipalDisplayNameToIdMap(ctx context.Context, request ListServicePrincipalsRequest) (map[string]string, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") + mapping := map[string]string{} + result, err := a.ListAll(ctx, request) + if err != nil { + return nil, err + } + for _, v := range result { + key := v.DisplayName + _, duplicate := mapping[key] + if duplicate { + return nil, fmt.Errorf("duplicate .DisplayName: %s", key) + } + mapping[key] = v.Id + } + return mapping, nil +} + +// GetByDisplayName calls [ServicePrincipalsAPI.ServicePrincipalDisplayNameToIdMap] and returns a single [ServicePrincipal]. +// +// Returns an error if there's more than one [ServicePrincipal] with the same .DisplayName. +// +// Note: All [ServicePrincipal] instances are loaded into memory before returning matching by name. +// +// This method is generated by Databricks SDK Code Generator. +func (a *ServicePrincipalsAPI) GetByDisplayName(ctx context.Context, name string) (*ServicePrincipal, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") + result, err := a.ListAll(ctx, ListServicePrincipalsRequest{}) + if err != nil { + return nil, err + } + tmp := map[string][]ServicePrincipal{} + for _, v := range result { + key := v.DisplayName + tmp[key] = append(tmp[key], v) + } + alternatives, ok := tmp[name] + if !ok || len(alternatives) == 0 { + return nil, fmt.Errorf("ServicePrincipal named '%s' does not exist", name) + } + if len(alternatives) > 1 { + return nil, fmt.Errorf("there are %d instances of ServicePrincipal named '%s'", len(alternatives), name) + } + return &alternatives[0], nil +} + +type UsersInterface interface { + + // Creates a new user in the Databricks workspace. This new user will also be + // added to the Databricks account. + Create(ctx context.Context, request User) (*User, error) + + // Deletes a user. Deleting a user from a Databricks workspace also removes + // objects associated with the user. + Delete(ctx context.Context, request DeleteUserRequest) error + + // Deletes a user. Deleting a user from a Databricks workspace also removes + // objects associated with the user. + DeleteById(ctx context.Context, id string) error + + // Gets information for a specific user in Databricks workspace. + Get(ctx context.Context, request GetUserRequest) (*User, error) + + // Gets information for a specific user in Databricks workspace. + GetById(ctx context.Context, id string) (*User, error) + + // Gets the permission levels that a user can have on an object. + GetPermissionLevels(ctx context.Context) (*GetPasswordPermissionLevelsResponse, error) + + // Gets the permissions of all passwords. Passwords can inherit permissions from + // their root object. + GetPermissions(ctx context.Context) (*PasswordPermissions, error) + + // Gets details for all the users associated with a Databricks workspace. + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context, request ListUsersRequest) listing.Iterator[User] + + // Gets details for all the users associated with a Databricks workspace. + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context, request ListUsersRequest) ([]User, error) + + // UserUserNameToIdMap calls [UsersAPI.ListAll] and creates a map of results with [User].UserName as key and [User].Id as value. + // + // Returns an error if there's more than one [User] with the same .UserName. + // + // Note: All [User] instances are loaded into memory before creating a map. + // + // This method is generated by Databricks SDK Code Generator. + UserUserNameToIdMap(ctx context.Context, request ListUsersRequest) (map[string]string, error) + + // GetByUserName calls [UsersAPI.UserUserNameToIdMap] and returns a single [User]. + // + // Returns an error if there's more than one [User] with the same .UserName. + // + // Note: All [User] instances are loaded into memory before returning matching by name. + // + // This method is generated by Databricks SDK Code Generator. + GetByUserName(ctx context.Context, name string) (*User, error) + + // Partially updates a user resource by applying the supplied operations on + // specific user attributes. + Patch(ctx context.Context, request PartialUpdate) error + + // Sets permissions on an object, replacing existing permissions if they exist. + // Deletes all direct permissions if none are specified. Objects can inherit + // permissions from their root object. + SetPermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) + + // Replaces a user's information with the data supplied in request. + Update(ctx context.Context, request User) error + + // Updates the permissions on all passwords. Passwords can inherit permissions + // from their root object. + UpdatePermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) +} + +func NewUsers(client *client.DatabricksClient) *UsersAPI { + return &UsersAPI{ + usersImpl: usersImpl{ + client: client, + }, + } +} + +// User identities recognized by Databricks and represented by email addresses. +// +// Databricks recommends using SCIM provisioning to sync users and groups +// automatically from your identity provider to your Databricks workspace. SCIM +// streamlines onboarding a new employee or team by using your identity provider +// to create users and groups in Databricks workspace and give them the proper +// level of access. When a user leaves your organization or no longer needs +// access to Databricks workspace, admins can terminate the user in your +// identity provider and that user’s account will also be removed from +// Databricks workspace. This ensures a consistent offboarding process and +// prevents unauthorized users from accessing sensitive data. +type UsersAPI struct { + usersImpl +} + +// Deletes a user. Deleting a user from a Databricks workspace also removes +// objects associated with the user. +func (a *UsersAPI) DeleteById(ctx context.Context, id string) error { + return a.usersImpl.Delete(ctx, DeleteUserRequest{ + Id: id, + }) +} + +// Gets information for a specific user in Databricks workspace. +func (a *UsersAPI) GetById(ctx context.Context, id string) (*User, error) { + return a.usersImpl.Get(ctx, GetUserRequest{ + Id: id, + }) +} + +// UserUserNameToIdMap calls [UsersAPI.ListAll] and creates a map of results with [User].UserName as key and [User].Id as value. +// +// Returns an error if there's more than one [User] with the same .UserName. +// +// Note: All [User] instances are loaded into memory before creating a map. +// +// This method is generated by Databricks SDK Code Generator. +func (a *UsersAPI) UserUserNameToIdMap(ctx context.Context, request ListUsersRequest) (map[string]string, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") + mapping := map[string]string{} + result, err := a.ListAll(ctx, request) + if err != nil { + return nil, err + } + for _, v := range result { + key := v.UserName + _, duplicate := mapping[key] + if duplicate { + return nil, fmt.Errorf("duplicate .UserName: %s", key) + } + mapping[key] = v.Id + } + return mapping, nil +} + +// GetByUserName calls [UsersAPI.UserUserNameToIdMap] and returns a single [User]. +// +// Returns an error if there's more than one [User] with the same .UserName. +// +// Note: All [User] instances are loaded into memory before returning matching by name. +// +// This method is generated by Databricks SDK Code Generator. +func (a *UsersAPI) GetByUserName(ctx context.Context, name string) (*User, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") + result, err := a.ListAll(ctx, ListUsersRequest{}) + if err != nil { + return nil, err + } + tmp := map[string][]User{} + for _, v := range result { + key := v.UserName + tmp[key] = append(tmp[key], v) + } + alternatives, ok := tmp[name] + if !ok || len(alternatives) == 0 { + return nil, fmt.Errorf("User named '%s' does not exist", name) + } + if len(alternatives) > 1 { + return nil, fmt.Errorf("there are %d instances of User named '%s'", len(alternatives), name) + } + return &alternatives[0], nil +} diff --git a/service/iam/ext_impl.go b/service/iam/ext_impl.go new file mode 100644 index 000000000..8acb78e0e --- /dev/null +++ b/service/iam/ext_impl.go @@ -0,0 +1,671 @@ +package iam + +import ( + "context" + "fmt" + "net/http" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" + "github.com/databricks/databricks-sdk-go/useragent" +) + +// unexported type that holds implementations of just AccountGroups API methods +type accountGroupsImpl struct { + client *client.DatabricksClient +} + +func (a *accountGroupsImpl) Create(ctx context.Context, request Group) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &group) + return &group, err +} + +func (a *accountGroupsImpl) Delete(ctx context.Context, request DeleteAccountGroupRequest) error { + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *accountGroupsImpl) Get(ctx context.Context, request GetAccountGroupRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &group) + return &group, err +} + +// Gets all details of the groups associated with the Databricks account. +func (a *accountGroupsImpl) List(ctx context.Context, request ListAccountGroupsRequest) listing.Iterator[Group] { + + request.StartIndex = 1 // SCIM offset starts from 1 + if request.Count == 0 { + request.Count = 10000 + } + getNextPage := func(ctx context.Context, req ListAccountGroupsRequest) (*ListGroupsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListGroupsResponse) []Group { + return resp.Resources + } + getNextReq := func(resp *ListGroupsResponse) *ListAccountGroupsRequest { + if len(getItems(resp)) == 0 { + return nil + } + request.StartIndex = resp.StartIndex + int64(len(resp.Resources)) + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + dedupedIterator := listing.NewDedupeIterator[Group, string]( + iterator, + func(item Group) string { + return item.Id + }) + return dedupedIterator +} + +// Gets all details of the groups associated with the Databricks account. +func (a *accountGroupsImpl) ListAll(ctx context.Context, request ListAccountGroupsRequest) ([]Group, error) { + iterator := a.List(ctx, request) + return listing.ToSliceN[Group, int64](ctx, iterator, request.Count) + +} + +func (a *accountGroupsImpl) internalList(ctx context.Context, request ListAccountGroupsRequest) (*ListGroupsResponse, error) { + var listGroupsResponse ListGroupsResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listGroupsResponse) + return &listGroupsResponse, err +} + +func (a *accountGroupsImpl) Patch(ctx context.Context, request PartialUpdate) error { + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) + return err +} + +func (a *accountGroupsImpl) Update(ctx context.Context, request Group) error { + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) + return err +} + +// unexported type that holds implementations of just AccountServicePrincipals API methods +type accountServicePrincipalsImpl struct { + client *client.DatabricksClient +} + +func (a *accountServicePrincipalsImpl) Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *accountServicePrincipalsImpl) Delete(ctx context.Context, request DeleteAccountServicePrincipalRequest) error { + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *accountServicePrincipalsImpl) Get(ctx context.Context, request GetAccountServicePrincipalRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servicePrincipal) + return &servicePrincipal, err +} + +// Gets the set of service principals associated with a Databricks account. +func (a *accountServicePrincipalsImpl) List(ctx context.Context, request ListAccountServicePrincipalsRequest) listing.Iterator[ServicePrincipal] { + + request.StartIndex = 1 // SCIM offset starts from 1 + if request.Count == 0 { + request.Count = 10000 + } + getNextPage := func(ctx context.Context, req ListAccountServicePrincipalsRequest) (*ListServicePrincipalResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListServicePrincipalResponse) []ServicePrincipal { + return resp.Resources + } + getNextReq := func(resp *ListServicePrincipalResponse) *ListAccountServicePrincipalsRequest { + if len(getItems(resp)) == 0 { + return nil + } + request.StartIndex = resp.StartIndex + int64(len(resp.Resources)) + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + dedupedIterator := listing.NewDedupeIterator[ServicePrincipal, string]( + iterator, + func(item ServicePrincipal) string { + return item.Id + }) + return dedupedIterator +} + +// Gets the set of service principals associated with a Databricks account. +func (a *accountServicePrincipalsImpl) ListAll(ctx context.Context, request ListAccountServicePrincipalsRequest) ([]ServicePrincipal, error) { + iterator := a.List(ctx, request) + return listing.ToSliceN[ServicePrincipal, int64](ctx, iterator, request.Count) + +} + +func (a *accountServicePrincipalsImpl) internalList(ctx context.Context, request ListAccountServicePrincipalsRequest) (*ListServicePrincipalResponse, error) { + var listServicePrincipalResponse ListServicePrincipalResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listServicePrincipalResponse) + return &listServicePrincipalResponse, err +} + +func (a *accountServicePrincipalsImpl) Patch(ctx context.Context, request PartialUpdate) error { + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) + return err +} + +func (a *accountServicePrincipalsImpl) Update(ctx context.Context, request ServicePrincipal) error { + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) + return err +} + +// unexported type that holds implementations of just AccountUsers API methods +type accountUsersImpl struct { + client *client.DatabricksClient +} + +func (a *accountUsersImpl) Create(ctx context.Context, request User) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &user) + return &user, err +} + +func (a *accountUsersImpl) Delete(ctx context.Context, request DeleteAccountUserRequest) error { + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *accountUsersImpl) Get(ctx context.Context, request GetAccountUserRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &user) + return &user, err +} + +// Gets details for all the users associated with a Databricks account. +func (a *accountUsersImpl) List(ctx context.Context, request ListAccountUsersRequest) listing.Iterator[User] { + + request.StartIndex = 1 // SCIM offset starts from 1 + if request.Count == 0 { + request.Count = 10000 + } + getNextPage := func(ctx context.Context, req ListAccountUsersRequest) (*ListUsersResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListUsersResponse) []User { + return resp.Resources + } + getNextReq := func(resp *ListUsersResponse) *ListAccountUsersRequest { + if len(getItems(resp)) == 0 { + return nil + } + request.StartIndex = resp.StartIndex + int64(len(resp.Resources)) + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + dedupedIterator := listing.NewDedupeIterator[User, string]( + iterator, + func(item User) string { + return item.Id + }) + return dedupedIterator +} + +// Gets details for all the users associated with a Databricks account. +func (a *accountUsersImpl) ListAll(ctx context.Context, request ListAccountUsersRequest) ([]User, error) { + iterator := a.List(ctx, request) + return listing.ToSliceN[User, int64](ctx, iterator, request.Count) + +} + +func (a *accountUsersImpl) internalList(ctx context.Context, request ListAccountUsersRequest) (*ListUsersResponse, error) { + var listUsersResponse ListUsersResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listUsersResponse) + return &listUsersResponse, err +} + +func (a *accountUsersImpl) Patch(ctx context.Context, request PartialUpdate) error { + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) + return err +} + +func (a *accountUsersImpl) Update(ctx context.Context, request User) error { + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) + return err +} + +// unexported type that holds implementations of just Groups API methods +type groupsImpl struct { + client *client.DatabricksClient +} + +func (a *groupsImpl) Create(ctx context.Context, request Group) (*Group, error) { + var group Group + path := "/api/2.0/preview/scim/v2/Groups" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &group) + return &group, err +} + +func (a *groupsImpl) Delete(ctx context.Context, request DeleteGroupRequest) error { + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *groupsImpl) Get(ctx context.Context, request GetGroupRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &group) + return &group, err +} + +// Gets all details of the groups associated with the Databricks workspace. +func (a *groupsImpl) List(ctx context.Context, request ListGroupsRequest) listing.Iterator[Group] { + + request.StartIndex = 1 // SCIM offset starts from 1 + if request.Count == 0 { + request.Count = 10000 + } + getNextPage := func(ctx context.Context, req ListGroupsRequest) (*ListGroupsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListGroupsResponse) []Group { + return resp.Resources + } + getNextReq := func(resp *ListGroupsResponse) *ListGroupsRequest { + if len(getItems(resp)) == 0 { + return nil + } + request.StartIndex = resp.StartIndex + int64(len(resp.Resources)) + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + dedupedIterator := listing.NewDedupeIterator[Group, string]( + iterator, + func(item Group) string { + return item.Id + }) + return dedupedIterator +} + +// Gets all details of the groups associated with the Databricks workspace. +func (a *groupsImpl) ListAll(ctx context.Context, request ListGroupsRequest) ([]Group, error) { + iterator := a.List(ctx, request) + return listing.ToSliceN[Group, int64](ctx, iterator, request.Count) + +} + +func (a *groupsImpl) internalList(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) { + var listGroupsResponse ListGroupsResponse + path := "/api/2.0/preview/scim/v2/Groups" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listGroupsResponse) + return &listGroupsResponse, err +} + +func (a *groupsImpl) Patch(ctx context.Context, request PartialUpdate) error { + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) + return err +} + +func (a *groupsImpl) Update(ctx context.Context, request Group) error { + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) + return err +} + +// unexported type that holds implementations of just ServicePrincipals API methods +type servicePrincipalsImpl struct { + client *client.DatabricksClient +} + +func (a *servicePrincipalsImpl) Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := "/api/2.0/preview/scim/v2/ServicePrincipals" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *servicePrincipalsImpl) Delete(ctx context.Context, request DeleteServicePrincipalRequest) error { + path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *servicePrincipalsImpl) Get(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servicePrincipal) + return &servicePrincipal, err +} + +// Gets the set of service principals associated with a Databricks workspace. +func (a *servicePrincipalsImpl) List(ctx context.Context, request ListServicePrincipalsRequest) listing.Iterator[ServicePrincipal] { + + request.StartIndex = 1 // SCIM offset starts from 1 + if request.Count == 0 { + request.Count = 10000 + } + getNextPage := func(ctx context.Context, req ListServicePrincipalsRequest) (*ListServicePrincipalResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListServicePrincipalResponse) []ServicePrincipal { + return resp.Resources + } + getNextReq := func(resp *ListServicePrincipalResponse) *ListServicePrincipalsRequest { + if len(getItems(resp)) == 0 { + return nil + } + request.StartIndex = resp.StartIndex + int64(len(resp.Resources)) + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + dedupedIterator := listing.NewDedupeIterator[ServicePrincipal, string]( + iterator, + func(item ServicePrincipal) string { + return item.Id + }) + return dedupedIterator +} + +// Gets the set of service principals associated with a Databricks workspace. +func (a *servicePrincipalsImpl) ListAll(ctx context.Context, request ListServicePrincipalsRequest) ([]ServicePrincipal, error) { + iterator := a.List(ctx, request) + return listing.ToSliceN[ServicePrincipal, int64](ctx, iterator, request.Count) + +} + +func (a *servicePrincipalsImpl) internalList(ctx context.Context, request ListServicePrincipalsRequest) (*ListServicePrincipalResponse, error) { + var listServicePrincipalResponse ListServicePrincipalResponse + path := "/api/2.0/preview/scim/v2/ServicePrincipals" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listServicePrincipalResponse) + return &listServicePrincipalResponse, err +} + +func (a *servicePrincipalsImpl) Patch(ctx context.Context, request PartialUpdate) error { + path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) + return err +} + +func (a *servicePrincipalsImpl) Update(ctx context.Context, request ServicePrincipal) error { + path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) + return err +} + +// unexported type that holds implementations of just Users API methods +type usersImpl struct { + client *client.DatabricksClient +} + +func (a *usersImpl) Create(ctx context.Context, request User) (*User, error) { + var user User + path := "/api/2.0/preview/scim/v2/Users" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &user) + return &user, err +} + +func (a *usersImpl) Delete(ctx context.Context, request DeleteUserRequest) error { + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *usersImpl) Get(ctx context.Context, request GetUserRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &user) + return &user, err +} + +func (a *usersImpl) GetPermissionLevels(ctx context.Context) (*GetPasswordPermissionLevelsResponse, error) { + var getPasswordPermissionLevelsResponse GetPasswordPermissionLevelsResponse + path := "/api/2.0/permissions/authorization/passwords/permissionLevels" + + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getPasswordPermissionLevelsResponse) + return &getPasswordPermissionLevelsResponse, err +} + +func (a *usersImpl) GetPermissions(ctx context.Context) (*PasswordPermissions, error) { + var passwordPermissions PasswordPermissions + path := "/api/2.0/permissions/authorization/passwords" + + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &passwordPermissions) + return &passwordPermissions, err +} + +// Gets details for all the users associated with a Databricks workspace. +func (a *usersImpl) List(ctx context.Context, request ListUsersRequest) listing.Iterator[User] { + + request.StartIndex = 1 // SCIM offset starts from 1 + if request.Count == 0 { + request.Count = 10000 + } + getNextPage := func(ctx context.Context, req ListUsersRequest) (*ListUsersResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListUsersResponse) []User { + return resp.Resources + } + getNextReq := func(resp *ListUsersResponse) *ListUsersRequest { + if len(getItems(resp)) == 0 { + return nil + } + request.StartIndex = resp.StartIndex + int64(len(resp.Resources)) + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + dedupedIterator := listing.NewDedupeIterator[User, string]( + iterator, + func(item User) string { + return item.Id + }) + return dedupedIterator +} + +// Gets details for all the users associated with a Databricks workspace. +func (a *usersImpl) ListAll(ctx context.Context, request ListUsersRequest) ([]User, error) { + iterator := a.List(ctx, request) + return listing.ToSliceN[User, int64](ctx, iterator, request.Count) + +} + +func (a *usersImpl) internalList(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) { + var listUsersResponse ListUsersResponse + path := "/api/2.0/preview/scim/v2/Users" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listUsersResponse) + return &listUsersResponse, err +} + +func (a *usersImpl) Patch(ctx context.Context, request PartialUpdate) error { + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) + return err +} + +func (a *usersImpl) SetPermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) { + var passwordPermissions PasswordPermissions + path := "/api/2.0/permissions/authorization/passwords" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &passwordPermissions) + return &passwordPermissions, err +} + +func (a *usersImpl) Update(ctx context.Context, request User) error { + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) + return err +} + +func (a *usersImpl) UpdatePermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) { + var passwordPermissions PasswordPermissions + path := "/api/2.0/permissions/authorization/passwords" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &passwordPermissions) + return &passwordPermissions, err +} diff --git a/service/iam/ext_interface.go b/service/iam/ext_interface.go new file mode 100644 index 000000000..9407669ee --- /dev/null +++ b/service/iam/ext_interface.go @@ -0,0 +1,222 @@ +package iam + +import "context" + +// Groups simplify identity management, making it easier to assign access to +// Databricks account, data, and other securable objects. +// +// It is best practice to assign access to workspaces and access-control +// policies in Unity Catalog to groups, instead of to users individually. All +// Databricks account identities can be assigned as members of groups, and +// members inherit permissions that are assigned to their group. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type AccountGroupsService interface { + + // Creates a group in the Databricks account with a unique name, using the + // supplied group details. + Create(ctx context.Context, request Group) (*Group, error) + + // Deletes a group from the Databricks account. + Delete(ctx context.Context, request DeleteAccountGroupRequest) error + + // Gets the information for a specific group in the Databricks account. + Get(ctx context.Context, request GetAccountGroupRequest) (*Group, error) + + // Gets all details of the groups associated with the Databricks account. + List(ctx context.Context, request ListAccountGroupsRequest) (*ListGroupsResponse, error) + + // Partially updates the details of a group. + Patch(ctx context.Context, request PartialUpdate) error + + // Updates the details of a group by replacing the entire group entity. + Update(ctx context.Context, request Group) error +} + +// Identities for use with jobs, automated tools, and systems such as scripts, +// apps, and CI/CD platforms. Databricks recommends creating service principals +// to run production jobs or modify production data. If all processes that act +// on production data run with service principals, interactive users do not need +// any write, delete, or modify privileges in production. This eliminates the +// risk of a user overwriting production data by accident. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type AccountServicePrincipalsService interface { + + // Creates a new service principal in the Databricks account. + Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) + + // Delete a single service principal in the Databricks account. + Delete(ctx context.Context, request DeleteAccountServicePrincipalRequest) error + + // Gets the details for a single service principal define in the Databricks + // account. + Get(ctx context.Context, request GetAccountServicePrincipalRequest) (*ServicePrincipal, error) + + // Gets the set of service principals associated with a Databricks account. + List(ctx context.Context, request ListAccountServicePrincipalsRequest) (*ListServicePrincipalResponse, error) + + // Partially updates the details of a single service principal in the + // Databricks account. + Patch(ctx context.Context, request PartialUpdate) error + + // Updates the details of a single service principal. + // + // This action replaces the existing service principal with the same name. + Update(ctx context.Context, request ServicePrincipal) error +} + +// User identities recognized by Databricks and represented by email addresses. +// +// Databricks recommends using SCIM provisioning to sync users and groups +// automatically from your identity provider to your Databricks account. SCIM +// streamlines onboarding a new employee or team by using your identity provider +// to create users and groups in Databricks account and give them the proper +// level of access. When a user leaves your organization or no longer needs +// access to Databricks account, admins can terminate the user in your identity +// provider and that user’s account will also be removed from Databricks +// account. This ensures a consistent offboarding process and prevents +// unauthorized users from accessing sensitive data. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type AccountUsersService interface { + + // Creates a new user in the Databricks account. This new user will also be + // added to the Databricks account. + Create(ctx context.Context, request User) (*User, error) + + // Deletes a user. Deleting a user from a Databricks account also removes + // objects associated with the user. + Delete(ctx context.Context, request DeleteAccountUserRequest) error + + // Gets information for a specific user in Databricks account. + Get(ctx context.Context, request GetAccountUserRequest) (*User, error) + + // Gets details for all the users associated with a Databricks account. + List(ctx context.Context, request ListAccountUsersRequest) (*ListUsersResponse, error) + + // Partially updates a user resource by applying the supplied operations on + // specific user attributes. + Patch(ctx context.Context, request PartialUpdate) error + + // Replaces a user's information with the data supplied in request. + Update(ctx context.Context, request User) error +} + +// Groups simplify identity management, making it easier to assign access to +// Databricks workspace, data, and other securable objects. +// +// It is best practice to assign access to workspaces and access-control +// policies in Unity Catalog to groups, instead of to users individually. All +// Databricks workspace identities can be assigned as members of groups, and +// members inherit permissions that are assigned to their group. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type GroupsService interface { + + // Creates a group in the Databricks workspace with a unique name, using the + // supplied group details. + Create(ctx context.Context, request Group) (*Group, error) + + // Deletes a group from the Databricks workspace. + Delete(ctx context.Context, request DeleteGroupRequest) error + + // Gets the information for a specific group in the Databricks workspace. + Get(ctx context.Context, request GetGroupRequest) (*Group, error) + + // Gets all details of the groups associated with the Databricks workspace. + List(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) + + // Partially updates the details of a group. + Patch(ctx context.Context, request PartialUpdate) error + + // Updates the details of a group by replacing the entire group entity. + Update(ctx context.Context, request Group) error +} + +// Identities for use with jobs, automated tools, and systems such as scripts, +// apps, and CI/CD platforms. Databricks recommends creating service principals +// to run production jobs or modify production data. If all processes that act +// on production data run with service principals, interactive users do not need +// any write, delete, or modify privileges in production. This eliminates the +// risk of a user overwriting production data by accident. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type ServicePrincipalsService interface { + + // Creates a new service principal in the Databricks workspace. + Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) + + // Delete a single service principal in the Databricks workspace. + Delete(ctx context.Context, request DeleteServicePrincipalRequest) error + + // Gets the details for a single service principal define in the Databricks + // workspace. + Get(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) + + // Gets the set of service principals associated with a Databricks + // workspace. + List(ctx context.Context, request ListServicePrincipalsRequest) (*ListServicePrincipalResponse, error) + + // Partially updates the details of a single service principal in the + // Databricks workspace. + Patch(ctx context.Context, request PartialUpdate) error + + // Updates the details of a single service principal. + // + // This action replaces the existing service principal with the same name. + Update(ctx context.Context, request ServicePrincipal) error +} + +// User identities recognized by Databricks and represented by email addresses. +// +// Databricks recommends using SCIM provisioning to sync users and groups +// automatically from your identity provider to your Databricks workspace. SCIM +// streamlines onboarding a new employee or team by using your identity provider +// to create users and groups in Databricks workspace and give them the proper +// level of access. When a user leaves your organization or no longer needs +// access to Databricks workspace, admins can terminate the user in your +// identity provider and that user’s account will also be removed from +// Databricks workspace. This ensures a consistent offboarding process and +// prevents unauthorized users from accessing sensitive data. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type UsersService interface { + + // Creates a new user in the Databricks workspace. This new user will also + // be added to the Databricks account. + Create(ctx context.Context, request User) (*User, error) + + // Deletes a user. Deleting a user from a Databricks workspace also removes + // objects associated with the user. + Delete(ctx context.Context, request DeleteUserRequest) error + + // Gets information for a specific user in Databricks workspace. + Get(ctx context.Context, request GetUserRequest) (*User, error) + + // Gets the permission levels that a user can have on an object. + GetPermissionLevels(ctx context.Context) (*GetPasswordPermissionLevelsResponse, error) + + // Gets the permissions of all passwords. Passwords can inherit permissions + // from their root object. + GetPermissions(ctx context.Context) (*PasswordPermissions, error) + + // Gets details for all the users associated with a Databricks workspace. + List(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) + + // Partially updates a user resource by applying the supplied operations on + // specific user attributes. + Patch(ctx context.Context, request PartialUpdate) error + + // Sets permissions on an object, replacing existing permissions if they + // exist. Deletes all direct permissions if none are specified. Objects can + // inherit permissions from their root object. + SetPermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) + + // Replaces a user's information with the data supplied in request. + Update(ctx context.Context, request User) error + + // Updates the permissions on all passwords. Passwords can inherit + // permissions from their root object. + UpdatePermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) +} diff --git a/service/iam/ext_model.go b/service/iam/ext_model.go new file mode 100644 index 000000000..f6bb07a46 --- /dev/null +++ b/service/iam/ext_model.go @@ -0,0 +1,11 @@ +package iam + +type PartialUpdate struct { + // Unique ID in the Databricks workspace. + Id string `json:"-" url:"-"` + + Operations []Patch `json:"Operations,omitempty"` + // The schema of the patch request. Must be + // ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. + Schemas []PatchSchema `json:"schemas,omitempty"` +} diff --git a/service/iam/impl.go b/service/iam/impl.go index 9565b03a9..4a11d555f 100755 --- a/service/iam/impl.go +++ b/service/iam/impl.go @@ -99,23 +99,23 @@ func (a *accountAccessControlProxyImpl) UpdateRuleSet(ctx context.Context, reque return &ruleSetResponse, err } -// unexported type that holds implementations of just AccountGroups API methods -type accountGroupsImpl struct { +// unexported type that holds implementations of just AccountGroupsV2 API methods +type accountGroupsV2Impl struct { client *client.DatabricksClient } -func (a *accountGroupsImpl) Create(ctx context.Context, request Group) (*Group, error) { - var group Group +func (a *accountGroupsV2Impl) Create(ctx context.Context, request CreateAccountGroupRequest) (*AccountGroup, error) { + var accountGroup AccountGroup path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &group) - return &group, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &accountGroup) + return &accountGroup, err } -func (a *accountGroupsImpl) Delete(ctx context.Context, request DeleteAccountGroupRequest) error { +func (a *accountGroupsV2Impl) Delete(ctx context.Context, request DeleteAccountGroupRequest) error { path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) @@ -123,31 +123,33 @@ func (a *accountGroupsImpl) Delete(ctx context.Context, request DeleteAccountGro return err } -func (a *accountGroupsImpl) Get(ctx context.Context, request GetAccountGroupRequest) (*Group, error) { - var group Group +func (a *accountGroupsV2Impl) Get(ctx context.Context, request GetAccountGroupRequest) (*AccountGroup, error) { + var accountGroup AccountGroup path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &group) - return &group, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accountGroup) + return &accountGroup, err } -// Gets all details of the groups associated with the Databricks account. -func (a *accountGroupsImpl) List(ctx context.Context, request ListAccountGroupsRequest) listing.Iterator[Group] { +// Gets all details of the groups associated with the Databricks account. As of +// 08/22/2025, this endpoint will not return members. Instead, members should be +// retrieved by iterating through `Get group details`. +func (a *accountGroupsV2Impl) List(ctx context.Context, request ListAccountGroupsRequest) listing.Iterator[AccountGroup] { request.StartIndex = 1 // SCIM offset starts from 1 if request.Count == 0 { request.Count = 10000 } - getNextPage := func(ctx context.Context, req ListAccountGroupsRequest) (*ListGroupsResponse, error) { + getNextPage := func(ctx context.Context, req ListAccountGroupsRequest) (*ListAccountGroupsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) } - getItems := func(resp *ListGroupsResponse) []Group { + getItems := func(resp *ListAccountGroupsResponse) []AccountGroup { return resp.Resources } - getNextReq := func(resp *ListGroupsResponse) *ListAccountGroupsRequest { + getNextReq := func(resp *ListAccountGroupsResponse) *ListAccountGroupsRequest { if len(getItems(resp)) == 0 { return nil } @@ -159,32 +161,29 @@ func (a *accountGroupsImpl) List(ctx context.Context, request ListAccountGroupsR getNextPage, getItems, getNextReq) - dedupedIterator := listing.NewDedupeIterator[Group, string]( - iterator, - func(item Group) string { - return item.Id - }) - return dedupedIterator + return iterator } -// Gets all details of the groups associated with the Databricks account. -func (a *accountGroupsImpl) ListAll(ctx context.Context, request ListAccountGroupsRequest) ([]Group, error) { +// Gets all details of the groups associated with the Databricks account. As of +// 08/22/2025, this endpoint will not return members. Instead, members should be +// retrieved by iterating through `Get group details`. +func (a *accountGroupsV2Impl) ListAll(ctx context.Context, request ListAccountGroupsRequest) ([]AccountGroup, error) { iterator := a.List(ctx, request) - return listing.ToSliceN[Group, int64](ctx, iterator, request.Count) + return listing.ToSliceN[AccountGroup, int64](ctx, iterator, request.Count) } -func (a *accountGroupsImpl) internalList(ctx context.Context, request ListAccountGroupsRequest) (*ListGroupsResponse, error) { - var listGroupsResponse ListGroupsResponse +func (a *accountGroupsV2Impl) internalList(ctx context.Context, request ListAccountGroupsRequest) (*ListAccountGroupsResponse, error) { + var listAccountGroupsResponse ListAccountGroupsResponse path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listGroupsResponse) - return &listGroupsResponse, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAccountGroupsResponse) + return &listAccountGroupsResponse, err } -func (a *accountGroupsImpl) Patch(ctx context.Context, request PartialUpdate) error { +func (a *accountGroupsV2Impl) Patch(ctx context.Context, request PatchAccountGroupRequest) error { path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) @@ -193,32 +192,33 @@ func (a *accountGroupsImpl) Patch(ctx context.Context, request PartialUpdate) er return err } -func (a *accountGroupsImpl) Update(ctx context.Context, request Group) error { +func (a *accountGroupsV2Impl) Update(ctx context.Context, request UpdateAccountGroupRequest) error { path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) + headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) return err } -// unexported type that holds implementations of just AccountServicePrincipals API methods -type accountServicePrincipalsImpl struct { +// unexported type that holds implementations of just AccountServicePrincipalsV2 API methods +type accountServicePrincipalsV2Impl struct { client *client.DatabricksClient } -func (a *accountServicePrincipalsImpl) Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) { - var servicePrincipal ServicePrincipal +func (a *accountServicePrincipalsV2Impl) Create(ctx context.Context, request CreateAccountServicePrincipalRequest) (*AccountServicePrincipal, error) { + var accountServicePrincipal AccountServicePrincipal path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &servicePrincipal) - return &servicePrincipal, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &accountServicePrincipal) + return &accountServicePrincipal, err } -func (a *accountServicePrincipalsImpl) Delete(ctx context.Context, request DeleteAccountServicePrincipalRequest) error { +func (a *accountServicePrincipalsV2Impl) Delete(ctx context.Context, request DeleteAccountServicePrincipalRequest) error { path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) @@ -226,31 +226,31 @@ func (a *accountServicePrincipalsImpl) Delete(ctx context.Context, request Delet return err } -func (a *accountServicePrincipalsImpl) Get(ctx context.Context, request GetAccountServicePrincipalRequest) (*ServicePrincipal, error) { - var servicePrincipal ServicePrincipal +func (a *accountServicePrincipalsV2Impl) Get(ctx context.Context, request GetAccountServicePrincipalRequest) (*AccountServicePrincipal, error) { + var accountServicePrincipal AccountServicePrincipal path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servicePrincipal) - return &servicePrincipal, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accountServicePrincipal) + return &accountServicePrincipal, err } // Gets the set of service principals associated with a Databricks account. -func (a *accountServicePrincipalsImpl) List(ctx context.Context, request ListAccountServicePrincipalsRequest) listing.Iterator[ServicePrincipal] { +func (a *accountServicePrincipalsV2Impl) List(ctx context.Context, request ListAccountServicePrincipalsRequest) listing.Iterator[AccountServicePrincipal] { request.StartIndex = 1 // SCIM offset starts from 1 if request.Count == 0 { request.Count = 10000 } - getNextPage := func(ctx context.Context, req ListAccountServicePrincipalsRequest) (*ListServicePrincipalResponse, error) { + getNextPage := func(ctx context.Context, req ListAccountServicePrincipalsRequest) (*ListAccountServicePrincipalsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) } - getItems := func(resp *ListServicePrincipalResponse) []ServicePrincipal { + getItems := func(resp *ListAccountServicePrincipalsResponse) []AccountServicePrincipal { return resp.Resources } - getNextReq := func(resp *ListServicePrincipalResponse) *ListAccountServicePrincipalsRequest { + getNextReq := func(resp *ListAccountServicePrincipalsResponse) *ListAccountServicePrincipalsRequest { if len(getItems(resp)) == 0 { return nil } @@ -262,66 +262,63 @@ func (a *accountServicePrincipalsImpl) List(ctx context.Context, request ListAcc getNextPage, getItems, getNextReq) - dedupedIterator := listing.NewDedupeIterator[ServicePrincipal, string]( - iterator, - func(item ServicePrincipal) string { - return item.Id - }) - return dedupedIterator + return iterator } // Gets the set of service principals associated with a Databricks account. -func (a *accountServicePrincipalsImpl) ListAll(ctx context.Context, request ListAccountServicePrincipalsRequest) ([]ServicePrincipal, error) { +func (a *accountServicePrincipalsV2Impl) ListAll(ctx context.Context, request ListAccountServicePrincipalsRequest) ([]AccountServicePrincipal, error) { iterator := a.List(ctx, request) - return listing.ToSliceN[ServicePrincipal, int64](ctx, iterator, request.Count) + return listing.ToSliceN[AccountServicePrincipal, int64](ctx, iterator, request.Count) } -func (a *accountServicePrincipalsImpl) internalList(ctx context.Context, request ListAccountServicePrincipalsRequest) (*ListServicePrincipalResponse, error) { - var listServicePrincipalResponse ListServicePrincipalResponse +func (a *accountServicePrincipalsV2Impl) internalList(ctx context.Context, request ListAccountServicePrincipalsRequest) (*ListAccountServicePrincipalsResponse, error) { + var listAccountServicePrincipalsResponse ListAccountServicePrincipalsResponse path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listServicePrincipalResponse) - return &listServicePrincipalResponse, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAccountServicePrincipalsResponse) + return &listAccountServicePrincipalsResponse, err } -func (a *accountServicePrincipalsImpl) Patch(ctx context.Context, request PartialUpdate) error { +func (a *accountServicePrincipalsV2Impl) Patch(ctx context.Context, request PatchAccountServicePrincipalRequest) error { path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) + headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) return err } -func (a *accountServicePrincipalsImpl) Update(ctx context.Context, request ServicePrincipal) error { +func (a *accountServicePrincipalsV2Impl) Update(ctx context.Context, request UpdateAccountServicePrincipalRequest) error { path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) + headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) return err } -// unexported type that holds implementations of just AccountUsers API methods -type accountUsersImpl struct { +// unexported type that holds implementations of just AccountUsersV2 API methods +type accountUsersV2Impl struct { client *client.DatabricksClient } -func (a *accountUsersImpl) Create(ctx context.Context, request User) (*User, error) { - var user User +func (a *accountUsersV2Impl) Create(ctx context.Context, request CreateAccountUserRequest) (*AccountUser, error) { + var accountUser AccountUser path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &user) - return &user, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &accountUser) + return &accountUser, err } -func (a *accountUsersImpl) Delete(ctx context.Context, request DeleteAccountUserRequest) error { +func (a *accountUsersV2Impl) Delete(ctx context.Context, request DeleteAccountUserRequest) error { path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) @@ -329,31 +326,31 @@ func (a *accountUsersImpl) Delete(ctx context.Context, request DeleteAccountUser return err } -func (a *accountUsersImpl) Get(ctx context.Context, request GetAccountUserRequest) (*User, error) { - var user User +func (a *accountUsersV2Impl) Get(ctx context.Context, request GetAccountUserRequest) (*AccountUser, error) { + var accountUser AccountUser path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &user) - return &user, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accountUser) + return &accountUser, err } // Gets details for all the users associated with a Databricks account. -func (a *accountUsersImpl) List(ctx context.Context, request ListAccountUsersRequest) listing.Iterator[User] { +func (a *accountUsersV2Impl) List(ctx context.Context, request ListAccountUsersRequest) listing.Iterator[AccountGroup] { request.StartIndex = 1 // SCIM offset starts from 1 if request.Count == 0 { request.Count = 10000 } - getNextPage := func(ctx context.Context, req ListAccountUsersRequest) (*ListUsersResponse, error) { + getNextPage := func(ctx context.Context, req ListAccountUsersRequest) (*ListAccountGroupsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) } - getItems := func(resp *ListUsersResponse) []User { + getItems := func(resp *ListAccountGroupsResponse) []AccountGroup { return resp.Resources } - getNextReq := func(resp *ListUsersResponse) *ListAccountUsersRequest { + getNextReq := func(resp *ListAccountGroupsResponse) *ListAccountUsersRequest { if len(getItems(resp)) == 0 { return nil } @@ -365,44 +362,41 @@ func (a *accountUsersImpl) List(ctx context.Context, request ListAccountUsersReq getNextPage, getItems, getNextReq) - dedupedIterator := listing.NewDedupeIterator[User, string]( - iterator, - func(item User) string { - return item.Id - }) - return dedupedIterator + return iterator } // Gets details for all the users associated with a Databricks account. -func (a *accountUsersImpl) ListAll(ctx context.Context, request ListAccountUsersRequest) ([]User, error) { +func (a *accountUsersV2Impl) ListAll(ctx context.Context, request ListAccountUsersRequest) ([]AccountGroup, error) { iterator := a.List(ctx, request) - return listing.ToSliceN[User, int64](ctx, iterator, request.Count) + return listing.ToSliceN[AccountGroup, int64](ctx, iterator, request.Count) } -func (a *accountUsersImpl) internalList(ctx context.Context, request ListAccountUsersRequest) (*ListUsersResponse, error) { - var listUsersResponse ListUsersResponse +func (a *accountUsersV2Impl) internalList(ctx context.Context, request ListAccountUsersRequest) (*ListAccountGroupsResponse, error) { + var listAccountGroupsResponse ListAccountGroupsResponse path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listUsersResponse) - return &listUsersResponse, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAccountGroupsResponse) + return &listAccountGroupsResponse, err } -func (a *accountUsersImpl) Patch(ctx context.Context, request PartialUpdate) error { +func (a *accountUsersV2Impl) Patch(ctx context.Context, request PatchAccountUserRequest) error { path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) + headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) return err } -func (a *accountUsersImpl) Update(ctx context.Context, request User) error { +func (a *accountUsersV2Impl) Update(ctx context.Context, request UpdateAccountUserRequest) error { path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) + headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) return err @@ -423,12 +417,12 @@ func (a *currentUserImpl) Me(ctx context.Context) (*User, error) { return &user, err } -// unexported type that holds implementations of just Groups API methods -type groupsImpl struct { +// unexported type that holds implementations of just GroupsV2 API methods +type groupsV2Impl struct { client *client.DatabricksClient } -func (a *groupsImpl) Create(ctx context.Context, request Group) (*Group, error) { +func (a *groupsV2Impl) Create(ctx context.Context, request CreateGroupRequest) (*Group, error) { var group Group path := "/api/2.0/preview/scim/v2/Groups" queryParams := make(map[string]any) @@ -439,7 +433,7 @@ func (a *groupsImpl) Create(ctx context.Context, request Group) (*Group, error) return &group, err } -func (a *groupsImpl) Delete(ctx context.Context, request DeleteGroupRequest) error { +func (a *groupsV2Impl) Delete(ctx context.Context, request DeleteGroupRequest) error { path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) @@ -447,7 +441,7 @@ func (a *groupsImpl) Delete(ctx context.Context, request DeleteGroupRequest) err return err } -func (a *groupsImpl) Get(ctx context.Context, request GetGroupRequest) (*Group, error) { +func (a *groupsV2Impl) Get(ctx context.Context, request GetGroupRequest) (*Group, error) { var group Group path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) queryParams := make(map[string]any) @@ -458,7 +452,7 @@ func (a *groupsImpl) Get(ctx context.Context, request GetGroupRequest) (*Group, } // Gets all details of the groups associated with the Databricks workspace. -func (a *groupsImpl) List(ctx context.Context, request ListGroupsRequest) listing.Iterator[Group] { +func (a *groupsV2Impl) List(ctx context.Context, request ListGroupsRequest) listing.Iterator[Group] { request.StartIndex = 1 // SCIM offset starts from 1 if request.Count == 0 { @@ -483,22 +477,17 @@ func (a *groupsImpl) List(ctx context.Context, request ListGroupsRequest) listin getNextPage, getItems, getNextReq) - dedupedIterator := listing.NewDedupeIterator[Group, string]( - iterator, - func(item Group) string { - return item.Id - }) - return dedupedIterator + return iterator } // Gets all details of the groups associated with the Databricks workspace. -func (a *groupsImpl) ListAll(ctx context.Context, request ListGroupsRequest) ([]Group, error) { +func (a *groupsV2Impl) ListAll(ctx context.Context, request ListGroupsRequest) ([]Group, error) { iterator := a.List(ctx, request) return listing.ToSliceN[Group, int64](ctx, iterator, request.Count) } -func (a *groupsImpl) internalList(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) { +func (a *groupsV2Impl) internalList(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) { var listGroupsResponse ListGroupsResponse path := "/api/2.0/preview/scim/v2/Groups" queryParams := make(map[string]any) @@ -508,19 +497,21 @@ func (a *groupsImpl) internalList(ctx context.Context, request ListGroupsRequest return &listGroupsResponse, err } -func (a *groupsImpl) Patch(ctx context.Context, request PartialUpdate) error { +func (a *groupsV2Impl) Patch(ctx context.Context, request PatchGroupRequest) error { path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) + headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) return err } -func (a *groupsImpl) Update(ctx context.Context, request Group) error { +func (a *groupsV2Impl) Update(ctx context.Context, request UpdateGroupRequest) error { path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) + headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) return err @@ -589,12 +580,12 @@ func (a *permissionsImpl) Update(ctx context.Context, request UpdateObjectPermis return &objectPermissions, err } -// unexported type that holds implementations of just ServicePrincipals API methods -type servicePrincipalsImpl struct { +// unexported type that holds implementations of just ServicePrincipalsV2 API methods +type servicePrincipalsV2Impl struct { client *client.DatabricksClient } -func (a *servicePrincipalsImpl) Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) { +func (a *servicePrincipalsV2Impl) Create(ctx context.Context, request CreateServicePrincipalRequest) (*ServicePrincipal, error) { var servicePrincipal ServicePrincipal path := "/api/2.0/preview/scim/v2/ServicePrincipals" queryParams := make(map[string]any) @@ -605,7 +596,7 @@ func (a *servicePrincipalsImpl) Create(ctx context.Context, request ServicePrinc return &servicePrincipal, err } -func (a *servicePrincipalsImpl) Delete(ctx context.Context, request DeleteServicePrincipalRequest) error { +func (a *servicePrincipalsV2Impl) Delete(ctx context.Context, request DeleteServicePrincipalRequest) error { path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) @@ -613,7 +604,7 @@ func (a *servicePrincipalsImpl) Delete(ctx context.Context, request DeleteServic return err } -func (a *servicePrincipalsImpl) Get(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) { +func (a *servicePrincipalsV2Impl) Get(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) { var servicePrincipal ServicePrincipal path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) queryParams := make(map[string]any) @@ -624,7 +615,7 @@ func (a *servicePrincipalsImpl) Get(ctx context.Context, request GetServicePrinc } // Gets the set of service principals associated with a Databricks workspace. -func (a *servicePrincipalsImpl) List(ctx context.Context, request ListServicePrincipalsRequest) listing.Iterator[ServicePrincipal] { +func (a *servicePrincipalsV2Impl) List(ctx context.Context, request ListServicePrincipalsRequest) listing.Iterator[ServicePrincipal] { request.StartIndex = 1 // SCIM offset starts from 1 if request.Count == 0 { @@ -649,22 +640,17 @@ func (a *servicePrincipalsImpl) List(ctx context.Context, request ListServicePri getNextPage, getItems, getNextReq) - dedupedIterator := listing.NewDedupeIterator[ServicePrincipal, string]( - iterator, - func(item ServicePrincipal) string { - return item.Id - }) - return dedupedIterator + return iterator } // Gets the set of service principals associated with a Databricks workspace. -func (a *servicePrincipalsImpl) ListAll(ctx context.Context, request ListServicePrincipalsRequest) ([]ServicePrincipal, error) { +func (a *servicePrincipalsV2Impl) ListAll(ctx context.Context, request ListServicePrincipalsRequest) ([]ServicePrincipal, error) { iterator := a.List(ctx, request) return listing.ToSliceN[ServicePrincipal, int64](ctx, iterator, request.Count) } -func (a *servicePrincipalsImpl) internalList(ctx context.Context, request ListServicePrincipalsRequest) (*ListServicePrincipalResponse, error) { +func (a *servicePrincipalsV2Impl) internalList(ctx context.Context, request ListServicePrincipalsRequest) (*ListServicePrincipalResponse, error) { var listServicePrincipalResponse ListServicePrincipalResponse path := "/api/2.0/preview/scim/v2/ServicePrincipals" queryParams := make(map[string]any) @@ -674,30 +660,32 @@ func (a *servicePrincipalsImpl) internalList(ctx context.Context, request ListSe return &listServicePrincipalResponse, err } -func (a *servicePrincipalsImpl) Patch(ctx context.Context, request PartialUpdate) error { +func (a *servicePrincipalsV2Impl) Patch(ctx context.Context, request PatchServicePrincipalRequest) error { path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) + headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) return err } -func (a *servicePrincipalsImpl) Update(ctx context.Context, request ServicePrincipal) error { +func (a *servicePrincipalsV2Impl) Update(ctx context.Context, request UpdateServicePrincipalRequest) error { path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) + headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) return err } -// unexported type that holds implementations of just Users API methods -type usersImpl struct { +// unexported type that holds implementations of just UsersV2 API methods +type usersV2Impl struct { client *client.DatabricksClient } -func (a *usersImpl) Create(ctx context.Context, request User) (*User, error) { +func (a *usersV2Impl) Create(ctx context.Context, request CreateUserRequest) (*User, error) { var user User path := "/api/2.0/preview/scim/v2/Users" queryParams := make(map[string]any) @@ -708,7 +696,7 @@ func (a *usersImpl) Create(ctx context.Context, request User) (*User, error) { return &user, err } -func (a *usersImpl) Delete(ctx context.Context, request DeleteUserRequest) error { +func (a *usersV2Impl) Delete(ctx context.Context, request DeleteUserRequest) error { path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) @@ -716,7 +704,7 @@ func (a *usersImpl) Delete(ctx context.Context, request DeleteUserRequest) error return err } -func (a *usersImpl) Get(ctx context.Context, request GetUserRequest) (*User, error) { +func (a *usersV2Impl) Get(ctx context.Context, request GetUserRequest) (*User, error) { var user User path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) queryParams := make(map[string]any) @@ -726,28 +714,28 @@ func (a *usersImpl) Get(ctx context.Context, request GetUserRequest) (*User, err return &user, err } -func (a *usersImpl) GetPermissionLevels(ctx context.Context) (*GetPasswordPermissionLevelsResponse, error) { +func (a *usersV2Impl) GetPermissionLevels(ctx context.Context, request GetPasswordPermissionLevelsRequest) (*GetPasswordPermissionLevelsResponse, error) { var getPasswordPermissionLevelsResponse GetPasswordPermissionLevelsResponse path := "/api/2.0/permissions/authorization/passwords/permissionLevels" - + queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getPasswordPermissionLevelsResponse) + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPasswordPermissionLevelsResponse) return &getPasswordPermissionLevelsResponse, err } -func (a *usersImpl) GetPermissions(ctx context.Context) (*PasswordPermissions, error) { +func (a *usersV2Impl) GetPermissions(ctx context.Context, request GetPasswordPermissionsRequest) (*PasswordPermissions, error) { var passwordPermissions PasswordPermissions path := "/api/2.0/permissions/authorization/passwords" - + queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &passwordPermissions) + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &passwordPermissions) return &passwordPermissions, err } // Gets details for all the users associated with a Databricks workspace. -func (a *usersImpl) List(ctx context.Context, request ListUsersRequest) listing.Iterator[User] { +func (a *usersV2Impl) List(ctx context.Context, request ListUsersRequest) listing.Iterator[User] { request.StartIndex = 1 // SCIM offset starts from 1 if request.Count == 0 { @@ -772,22 +760,17 @@ func (a *usersImpl) List(ctx context.Context, request ListUsersRequest) listing. getNextPage, getItems, getNextReq) - dedupedIterator := listing.NewDedupeIterator[User, string]( - iterator, - func(item User) string { - return item.Id - }) - return dedupedIterator + return iterator } // Gets details for all the users associated with a Databricks workspace. -func (a *usersImpl) ListAll(ctx context.Context, request ListUsersRequest) ([]User, error) { +func (a *usersV2Impl) ListAll(ctx context.Context, request ListUsersRequest) ([]User, error) { iterator := a.List(ctx, request) return listing.ToSliceN[User, int64](ctx, iterator, request.Count) } -func (a *usersImpl) internalList(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) { +func (a *usersV2Impl) internalList(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) { var listUsersResponse ListUsersResponse path := "/api/2.0/preview/scim/v2/Users" queryParams := make(map[string]any) @@ -797,16 +780,17 @@ func (a *usersImpl) internalList(ctx context.Context, request ListUsersRequest) return &listUsersResponse, err } -func (a *usersImpl) Patch(ctx context.Context, request PartialUpdate) error { +func (a *usersV2Impl) Patch(ctx context.Context, request PatchUserRequest) error { path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) + headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) return err } -func (a *usersImpl) SetPermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) { +func (a *usersV2Impl) SetPermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) { var passwordPermissions PasswordPermissions path := "/api/2.0/permissions/authorization/passwords" queryParams := make(map[string]any) @@ -817,16 +801,17 @@ func (a *usersImpl) SetPermissions(ctx context.Context, request PasswordPermissi return &passwordPermissions, err } -func (a *usersImpl) Update(ctx context.Context, request User) error { +func (a *usersV2Impl) Update(ctx context.Context, request UpdateUserRequest) error { path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) + headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) return err } -func (a *usersImpl) UpdatePermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) { +func (a *usersV2Impl) UpdatePermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) { var passwordPermissions PasswordPermissions path := "/api/2.0/permissions/authorization/passwords" queryParams := make(map[string]any) diff --git a/service/iam/interface.go b/service/iam/interface.go index 805e37f1e..39d53cc9c 100755 --- a/service/iam/interface.go +++ b/service/iam/interface.go @@ -71,26 +71,28 @@ type AccountAccessControlProxyService interface { // members inherit permissions that are assigned to their group. // // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. -type AccountGroupsService interface { +type AccountGroupsV2Service interface { // Creates a group in the Databricks account with a unique name, using the // supplied group details. - Create(ctx context.Context, request Group) (*Group, error) + Create(ctx context.Context, request CreateAccountGroupRequest) (*AccountGroup, error) // Deletes a group from the Databricks account. Delete(ctx context.Context, request DeleteAccountGroupRequest) error // Gets the information for a specific group in the Databricks account. - Get(ctx context.Context, request GetAccountGroupRequest) (*Group, error) + Get(ctx context.Context, request GetAccountGroupRequest) (*AccountGroup, error) - // Gets all details of the groups associated with the Databricks account. - List(ctx context.Context, request ListAccountGroupsRequest) (*ListGroupsResponse, error) + // Gets all details of the groups associated with the Databricks account. As + // of 08/22/2025, this endpoint will not return members. Instead, members + // should be retrieved by iterating through `Get group details`. + List(ctx context.Context, request ListAccountGroupsRequest) (*ListAccountGroupsResponse, error) // Partially updates the details of a group. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchAccountGroupRequest) error // Updates the details of a group by replacing the entire group entity. - Update(ctx context.Context, request Group) error + Update(ctx context.Context, request UpdateAccountGroupRequest) error } // Identities for use with jobs, automated tools, and systems such as scripts, @@ -101,29 +103,29 @@ type AccountGroupsService interface { // risk of a user overwriting production data by accident. // // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. -type AccountServicePrincipalsService interface { +type AccountServicePrincipalsV2Service interface { // Creates a new service principal in the Databricks account. - Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) + Create(ctx context.Context, request CreateAccountServicePrincipalRequest) (*AccountServicePrincipal, error) // Delete a single service principal in the Databricks account. Delete(ctx context.Context, request DeleteAccountServicePrincipalRequest) error // Gets the details for a single service principal define in the Databricks // account. - Get(ctx context.Context, request GetAccountServicePrincipalRequest) (*ServicePrincipal, error) + Get(ctx context.Context, request GetAccountServicePrincipalRequest) (*AccountServicePrincipal, error) // Gets the set of service principals associated with a Databricks account. - List(ctx context.Context, request ListAccountServicePrincipalsRequest) (*ListServicePrincipalResponse, error) + List(ctx context.Context, request ListAccountServicePrincipalsRequest) (*ListAccountServicePrincipalsResponse, error) // Partially updates the details of a single service principal in the // Databricks account. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchAccountServicePrincipalRequest) error // Updates the details of a single service principal. // // This action replaces the existing service principal with the same name. - Update(ctx context.Context, request ServicePrincipal) error + Update(ctx context.Context, request UpdateAccountServicePrincipalRequest) error } // User identities recognized by Databricks and represented by email addresses. @@ -139,28 +141,28 @@ type AccountServicePrincipalsService interface { // unauthorized users from accessing sensitive data. // // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. -type AccountUsersService interface { +type AccountUsersV2Service interface { // Creates a new user in the Databricks account. This new user will also be // added to the Databricks account. - Create(ctx context.Context, request User) (*User, error) + Create(ctx context.Context, request CreateAccountUserRequest) (*AccountUser, error) // Deletes a user. Deleting a user from a Databricks account also removes // objects associated with the user. Delete(ctx context.Context, request DeleteAccountUserRequest) error // Gets information for a specific user in Databricks account. - Get(ctx context.Context, request GetAccountUserRequest) (*User, error) + Get(ctx context.Context, request GetAccountUserRequest) (*AccountUser, error) // Gets details for all the users associated with a Databricks account. - List(ctx context.Context, request ListAccountUsersRequest) (*ListUsersResponse, error) + List(ctx context.Context, request ListAccountUsersRequest) (*ListAccountGroupsResponse, error) // Partially updates a user resource by applying the supplied operations on // specific user attributes. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchAccountUserRequest) error // Replaces a user's information with the data supplied in request. - Update(ctx context.Context, request User) error + Update(ctx context.Context, request UpdateAccountUserRequest) error } // This API allows retrieving information about currently authenticated user or @@ -182,11 +184,11 @@ type CurrentUserService interface { // members inherit permissions that are assigned to their group. // // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. -type GroupsService interface { +type GroupsV2Service interface { // Creates a group in the Databricks workspace with a unique name, using the // supplied group details. - Create(ctx context.Context, request Group) (*Group, error) + Create(ctx context.Context, request CreateGroupRequest) (*Group, error) // Deletes a group from the Databricks workspace. Delete(ctx context.Context, request DeleteGroupRequest) error @@ -198,10 +200,10 @@ type GroupsService interface { List(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) // Partially updates the details of a group. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchGroupRequest) error // Updates the details of a group by replacing the entire group entity. - Update(ctx context.Context, request Group) error + Update(ctx context.Context, request UpdateGroupRequest) error } // APIs for migrating acl permissions, used only by the ucx tool: @@ -274,10 +276,10 @@ type PermissionsService interface { // risk of a user overwriting production data by accident. // // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. -type ServicePrincipalsService interface { +type ServicePrincipalsV2Service interface { // Creates a new service principal in the Databricks workspace. - Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) + Create(ctx context.Context, request CreateServicePrincipalRequest) (*ServicePrincipal, error) // Delete a single service principal in the Databricks workspace. Delete(ctx context.Context, request DeleteServicePrincipalRequest) error @@ -292,12 +294,12 @@ type ServicePrincipalsService interface { // Partially updates the details of a single service principal in the // Databricks workspace. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchServicePrincipalRequest) error // Updates the details of a single service principal. // // This action replaces the existing service principal with the same name. - Update(ctx context.Context, request ServicePrincipal) error + Update(ctx context.Context, request UpdateServicePrincipalRequest) error } // User identities recognized by Databricks and represented by email addresses. @@ -313,11 +315,11 @@ type ServicePrincipalsService interface { // prevents unauthorized users from accessing sensitive data. // // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. -type UsersService interface { +type UsersV2Service interface { // Creates a new user in the Databricks workspace. This new user will also // be added to the Databricks account. - Create(ctx context.Context, request User) (*User, error) + Create(ctx context.Context, request CreateUserRequest) (*User, error) // Deletes a user. Deleting a user from a Databricks workspace also removes // objects associated with the user. @@ -327,18 +329,18 @@ type UsersService interface { Get(ctx context.Context, request GetUserRequest) (*User, error) // Gets the permission levels that a user can have on an object. - GetPermissionLevels(ctx context.Context) (*GetPasswordPermissionLevelsResponse, error) + GetPermissionLevels(ctx context.Context, request GetPasswordPermissionLevelsRequest) (*GetPasswordPermissionLevelsResponse, error) // Gets the permissions of all passwords. Passwords can inherit permissions // from their root object. - GetPermissions(ctx context.Context) (*PasswordPermissions, error) + GetPermissions(ctx context.Context, request GetPasswordPermissionsRequest) (*PasswordPermissions, error) // Gets details for all the users associated with a Databricks workspace. List(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) // Partially updates a user resource by applying the supplied operations on // specific user attributes. - Patch(ctx context.Context, request PartialUpdate) error + Patch(ctx context.Context, request PatchUserRequest) error // Sets permissions on an object, replacing existing permissions if they // exist. Deletes all direct permissions if none are specified. Objects can @@ -346,7 +348,7 @@ type UsersService interface { SetPermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) // Replaces a user's information with the data supplied in request. - Update(ctx context.Context, request User) error + Update(ctx context.Context, request UpdateUserRequest) error // Updates the permissions on all passwords. Passwords can inherit // permissions from their root object. diff --git a/service/iam/model.go b/service/iam/model.go index 712971ccc..01e4ef890 100755 --- a/service/iam/model.go +++ b/service/iam/model.go @@ -52,6 +52,92 @@ func (s AccessControlResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type AccountGroup struct { + // Databricks account ID + AccountId string `json:"account_id,omitempty"` + // String that represents a human-readable group name + DisplayName string `json:"displayName,omitempty"` + // external_id should be unique for identifying groups + ExternalId string `json:"externalId,omitempty"` + // Databricks group ID + Id string `json:"id,omitempty"` + + Members []ComplexValue `json:"members,omitempty"` + // Container for the group identifier. Workspace local versus account. + Meta *ResourceMeta `json:"meta,omitempty"` + // Indicates if the group has the admin role. + Roles []ComplexValue `json:"roles,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AccountGroup) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AccountGroup) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type AccountServicePrincipal struct { + // Databricks account ID + AccountId string `json:"account_id,omitempty"` + // If this user is active + Active bool `json:"active,omitempty"` + // UUID relating to the service principal + ApplicationId string `json:"applicationId,omitempty"` + // String that represents a concatenation of given and family names. + DisplayName string `json:"displayName,omitempty"` + + ExternalId string `json:"externalId,omitempty"` + // Databricks service principal ID. + Id string `json:"id,omitempty"` + // Indicates if the group has the admin role. + Roles []ComplexValue `json:"roles,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AccountServicePrincipal) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AccountServicePrincipal) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type AccountUser struct { + // Databricks account ID + AccountId string `json:"account_id,omitempty"` + // If this user is active + Active bool `json:"active,omitempty"` + // String that represents a concatenation of given and family names. For + // example `John Smith`. + DisplayName string `json:"displayName,omitempty"` + // All the emails associated with the Databricks user. + Emails []ComplexValue `json:"emails,omitempty"` + // External ID is not currently supported. It is reserved for future use. + ExternalId string `json:"externalId,omitempty"` + // Databricks user ID. + Id string `json:"id,omitempty"` + + Name *Name `json:"name,omitempty"` + // Indicates if the group has the admin role. + Roles []ComplexValue `json:"roles,omitempty"` + // Email address of the Databricks user. + UserName string `json:"userName,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AccountUser) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AccountUser) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // represents an identity trying to access a resource - user or a service // principal group can be a principal of a permission set assignment but an // actor is always a user or a service principal @@ -128,6 +214,197 @@ type ConsistencyToken struct { Value string `json:"value" url:"value"` } +type CreateAccountGroupRequest struct { + // String that represents a human-readable group name + DisplayName string `json:"displayName,omitempty"` + + ExternalId string `json:"externalId,omitempty"` + // Databricks group ID + Id string `json:"id,omitempty"` + + Members []ComplexValue `json:"members,omitempty"` + // Container for the group identifier. Workspace local versus account. + Meta *ResourceMeta `json:"meta,omitempty"` + // Indicates if the group has the admin role. + Roles []ComplexValue `json:"roles,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateAccountGroupRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateAccountGroupRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateAccountServicePrincipalRequest struct { + // If this user is active + Active bool `json:"active,omitempty"` + // UUID relating to the service principal + ApplicationId string `json:"applicationId,omitempty"` + // String that represents a concatenation of given and family names. + DisplayName string `json:"displayName,omitempty"` + + ExternalId string `json:"externalId,omitempty"` + // Databricks service principal ID. + Id string `json:"id,omitempty"` + // Indicates if the group has the admin role. + Roles []ComplexValue `json:"roles,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateAccountServicePrincipalRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateAccountServicePrincipalRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateAccountUserRequest struct { + // If this user is active + Active bool `json:"active,omitempty"` + // String that represents a concatenation of given and family names. For + // example `John Smith`. + DisplayName string `json:"displayName,omitempty"` + // All the emails associated with the Databricks user. + Emails []ComplexValue `json:"emails,omitempty"` + // External ID is not currently supported. It is reserved for future use. + ExternalId string `json:"externalId,omitempty"` + // Databricks user ID. + Id string `json:"id,omitempty"` + + Name *Name `json:"name,omitempty"` + // Indicates if the group has the admin role. + Roles []ComplexValue `json:"roles,omitempty"` + // Email address of the Databricks user. + UserName string `json:"userName,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateAccountUserRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateAccountUserRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateGroupRequest struct { + // String that represents a human-readable group name + DisplayName string `json:"displayName,omitempty"` + // Entitlements assigned to the group. See [assigning entitlements] for a + // full list of supported values. + // + // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements + Entitlements []ComplexValue `json:"entitlements,omitempty"` + + ExternalId string `json:"externalId,omitempty"` + + Groups []ComplexValue `json:"groups,omitempty"` + // Databricks group ID + Id string `json:"id,omitempty"` + + Members []ComplexValue `json:"members,omitempty"` + // Container for the group identifier. Workspace local versus account. + Meta *ResourceMeta `json:"meta,omitempty"` + // Corresponds to AWS instance profile/arn role. + Roles []ComplexValue `json:"roles,omitempty"` + // The schema of the group. + Schemas []GroupSchema `json:"schemas,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateGroupRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateGroupRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateServicePrincipalRequest struct { + // If this user is active + Active bool `json:"active,omitempty"` + // UUID relating to the service principal + ApplicationId string `json:"applicationId,omitempty"` + // String that represents a concatenation of given and family names. + DisplayName string `json:"displayName,omitempty"` + // Entitlements assigned to the service principal. See [assigning + // entitlements] for a full list of supported values. + // + // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements + Entitlements []ComplexValue `json:"entitlements,omitempty"` + + ExternalId string `json:"externalId,omitempty"` + + Groups []ComplexValue `json:"groups,omitempty"` + // Databricks service principal ID. + Id string `json:"id,omitempty"` + // Corresponds to AWS instance profile/arn role. + Roles []ComplexValue `json:"roles,omitempty"` + // The schema of the List response. + Schemas []ServicePrincipalSchema `json:"schemas,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateServicePrincipalRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateServicePrincipalRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateUserRequest struct { + // If this user is active + Active bool `json:"active,omitempty"` + // String that represents a concatenation of given and family names. For + // example `John Smith`. This field cannot be updated through the Workspace + // SCIM APIs when [identity federation is enabled]. Use Account SCIM APIs to + // update `displayName`. + // + // [identity federation is enabled]: https://docs.databricks.com/administration-guide/users-groups/best-practices.html#enable-identity-federation + DisplayName string `json:"displayName,omitempty"` + // All the emails associated with the Databricks user. + Emails []ComplexValue `json:"emails,omitempty"` + // Entitlements assigned to the user. See [assigning entitlements] for a + // full list of supported values. + // + // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements + Entitlements []ComplexValue `json:"entitlements,omitempty"` + // External ID is not currently supported. It is reserved for future use. + ExternalId string `json:"externalId,omitempty"` + + Groups []ComplexValue `json:"groups,omitempty"` + // Databricks user ID. + Id string `json:"id,omitempty"` + + Name *Name `json:"name,omitempty"` + // Corresponds to AWS instance profile/arn role. + Roles []ComplexValue `json:"roles,omitempty"` + // The schema of the user. + Schemas []UserSchema `json:"schemas,omitempty"` + // Email address of the Databricks user. + UserName string `json:"userName,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateUserRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateUserRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type DeleteAccountGroupRequest struct { // Unique ID for a group in the Databricks account. Id string `json:"-" url:"-"` @@ -219,6 +496,8 @@ type GetAssignableRolesForResourceRequest struct { // `resource=accounts//groups/` | A resource name for // the group. `resource=accounts//servicePrincipals/` | A // resource name for the service principal. + // `resource=accounts//tagPolicies/` | A resource + // name for the tag policy. Resource string `json:"-" url:"resource"` } @@ -231,11 +510,17 @@ type GetGroupRequest struct { Id string `json:"-" url:"-"` } +type GetPasswordPermissionLevelsRequest struct { +} + type GetPasswordPermissionLevelsResponse struct { // Specific permission levels PermissionLevels []PasswordPermissionsDescription `json:"permission_levels,omitempty"` } +type GetPasswordPermissionsRequest struct { +} + type GetPermissionLevelsRequest struct { RequestObjectId string `json:"-" url:"-"` // The type of the request object. Can be one of the following: alerts, @@ -286,6 +571,8 @@ type GetRuleSetRequest struct { // for a rule set on the group. // `name=accounts//servicePrincipals//ruleSets/default` // | A name for a rule set on the service principal. + // `name=accounts//tagPolicies//ruleSets/default` + // | A name for a rule set on the tag policy. Name string `json:"-" url:"name"` } @@ -391,7 +678,7 @@ type Group struct { // // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements Entitlements []ComplexValue `json:"entitlements,omitempty"` - + // external_id should be unique for identifying groups ExternalId string `json:"externalId,omitempty"` Groups []ComplexValue `json:"groups,omitempty"` @@ -484,6 +771,28 @@ func (s ListAccountGroupsRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListAccountGroupsResponse struct { + // Total results returned in the response. + ItemsPerPage int64 `json:"itemsPerPage,omitempty"` + // User objects returned in the response. + Resources []AccountGroup `json:"Resources,omitempty"` + // Starting index of all the results that matched the request filters. First + // item is number 1. + StartIndex int64 `json:"startIndex,omitempty"` + // Total results that match the request filters. + TotalResults int64 `json:"totalResults,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListAccountGroupsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListAccountGroupsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListAccountServicePrincipalsRequest struct { // Comma-separated list of attributes to return in response. Attributes string `json:"-" url:"attributes,omitempty"` @@ -517,6 +826,28 @@ func (s ListAccountServicePrincipalsRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListAccountServicePrincipalsResponse struct { + // Total results returned in the response. + ItemsPerPage int64 `json:"itemsPerPage,omitempty"` + // User objects returned in the response. + Resources []AccountServicePrincipal `json:"Resources,omitempty"` + // Starting index of all the results that matched the request filters. First + // item is number 1. + StartIndex int64 `json:"startIndex,omitempty"` + // Total results that match the request filters. + TotalResults int64 `json:"totalResults,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListAccountServicePrincipalsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListAccountServicePrincipalsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListAccountUsersRequest struct { // Comma-separated list of attributes to return in response. Attributes string `json:"-" url:"attributes,omitempty"` @@ -871,16 +1202,6 @@ func (s ObjectPermissions) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -type PartialUpdate struct { - // Unique ID in the Databricks workspace. - Id string `json:"-" url:"-"` - - Operations []Patch `json:"Operations,omitempty"` - // The schema of the patch request. Must be - // ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. - Schemas []PatchSchema `json:"schemas,omitempty"` -} - type PasswordAccessControlRequest struct { // name of the group GroupName string `json:"group_name,omitempty"` @@ -1035,6 +1356,46 @@ func (s Patch) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type PatchAccountGroupRequest struct { + // Unique ID in the Databricks workspace. + Id string `json:"-" url:"-"` + + Operations []Patch `json:"Operations,omitempty"` + // The schema of the patch request. Must be + // ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. + Schemas []PatchSchema `json:"schemas,omitempty"` +} + +type PatchAccountServicePrincipalRequest struct { + // Unique ID in the Databricks workspace. + Id string `json:"-" url:"-"` + + Operations []Patch `json:"Operations,omitempty"` + // The schema of the patch request. Must be + // ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. + Schemas []PatchSchema `json:"schemas,omitempty"` +} + +type PatchAccountUserRequest struct { + // Unique ID in the Databricks workspace. + Id string `json:"-" url:"-"` + + Operations []Patch `json:"Operations,omitempty"` + // The schema of the patch request. Must be + // ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. + Schemas []PatchSchema `json:"schemas,omitempty"` +} + +type PatchGroupRequest struct { + // Unique ID in the Databricks workspace. + Id string `json:"-" url:"-"` + + Operations []Patch `json:"Operations,omitempty"` + // The schema of the patch request. Must be + // ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. + Schemas []PatchSchema `json:"schemas,omitempty"` +} + // Type of patch operation. type PatchOp string @@ -1110,6 +1471,26 @@ func (f *PatchSchema) Type() string { return "PatchSchema" } +type PatchServicePrincipalRequest struct { + // Unique ID in the Databricks workspace. + Id string `json:"-" url:"-"` + + Operations []Patch `json:"Operations,omitempty"` + // The schema of the patch request. Must be + // ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. + Schemas []PatchSchema `json:"schemas,omitempty"` +} + +type PatchUserRequest struct { + // Unique ID in the Databricks workspace. + Id string `json:"-" url:"-"` + + Operations []Patch `json:"Operations,omitempty"` + // The schema of the patch request. Must be + // ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. + Schemas []PatchSchema `json:"schemas,omitempty"` +} + type Permission struct { Inherited bool `json:"inherited,omitempty"` @@ -1495,6 +1876,120 @@ type SetObjectPermissions struct { RequestObjectType string `json:"-" url:"-"` } +type UpdateAccountGroupRequest struct { + // String that represents a human-readable group name + DisplayName string `json:"displayName,omitempty"` + + ExternalId string `json:"externalId,omitempty"` + // Databricks group ID + Id string `json:"-" url:"-"` + + Members []ComplexValue `json:"members,omitempty"` + // Container for the group identifier. Workspace local versus account. + Meta *ResourceMeta `json:"meta,omitempty"` + // Indicates if the group has the admin role. + Roles []ComplexValue `json:"roles,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateAccountGroupRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateAccountGroupRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type UpdateAccountServicePrincipalRequest struct { + // If this user is active + Active bool `json:"active,omitempty"` + // UUID relating to the service principal + ApplicationId string `json:"applicationId,omitempty"` + // String that represents a concatenation of given and family names. + DisplayName string `json:"displayName,omitempty"` + + ExternalId string `json:"externalId,omitempty"` + // Databricks service principal ID. + Id string `json:"-" url:"-"` + // Indicates if the group has the admin role. + Roles []ComplexValue `json:"roles,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateAccountServicePrincipalRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateAccountServicePrincipalRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type UpdateAccountUserRequest struct { + // If this user is active + Active bool `json:"active,omitempty"` + // String that represents a concatenation of given and family names. For + // example `John Smith`. + DisplayName string `json:"displayName,omitempty"` + // All the emails associated with the Databricks user. + Emails []ComplexValue `json:"emails,omitempty"` + // External ID is not currently supported. It is reserved for future use. + ExternalId string `json:"externalId,omitempty"` + // Databricks user ID. + Id string `json:"-" url:"-"` + + Name *Name `json:"name,omitempty"` + // Indicates if the group has the admin role. + Roles []ComplexValue `json:"roles,omitempty"` + // Email address of the Databricks user. + UserName string `json:"userName,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateAccountUserRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateAccountUserRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type UpdateGroupRequest struct { + // String that represents a human-readable group name + DisplayName string `json:"displayName,omitempty"` + // Entitlements assigned to the group. See [assigning entitlements] for a + // full list of supported values. + // + // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements + Entitlements []ComplexValue `json:"entitlements,omitempty"` + + ExternalId string `json:"externalId,omitempty"` + + Groups []ComplexValue `json:"groups,omitempty"` + // Databricks group ID + Id string `json:"-" url:"-"` + + Members []ComplexValue `json:"members,omitempty"` + // Container for the group identifier. Workspace local versus account. + Meta *ResourceMeta `json:"meta,omitempty"` + // Corresponds to AWS instance profile/arn role. + Roles []ComplexValue `json:"roles,omitempty"` + // The schema of the group. + Schemas []GroupSchema `json:"schemas,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateGroupRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateGroupRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type UpdateObjectPermissions struct { AccessControlList []AccessControlRequest `json:"access_control_list,omitempty"` // The id of the request object. @@ -1514,6 +2009,83 @@ type UpdateRuleSetRequest struct { RuleSet RuleSetUpdateRequest `json:"rule_set"` } +type UpdateServicePrincipalRequest struct { + // If this user is active + Active bool `json:"active,omitempty"` + // UUID relating to the service principal + ApplicationId string `json:"applicationId,omitempty"` + // String that represents a concatenation of given and family names. + DisplayName string `json:"displayName,omitempty"` + // Entitlements assigned to the service principal. See [assigning + // entitlements] for a full list of supported values. + // + // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements + Entitlements []ComplexValue `json:"entitlements,omitempty"` + + ExternalId string `json:"externalId,omitempty"` + + Groups []ComplexValue `json:"groups,omitempty"` + // Databricks service principal ID. + Id string `json:"-" url:"-"` + // Corresponds to AWS instance profile/arn role. + Roles []ComplexValue `json:"roles,omitempty"` + // The schema of the List response. + Schemas []ServicePrincipalSchema `json:"schemas,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateServicePrincipalRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateServicePrincipalRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type UpdateUserRequest struct { + // If this user is active + Active bool `json:"active,omitempty"` + // String that represents a concatenation of given and family names. For + // example `John Smith`. This field cannot be updated through the Workspace + // SCIM APIs when [identity federation is enabled]. Use Account SCIM APIs to + // update `displayName`. + // + // [identity federation is enabled]: https://docs.databricks.com/administration-guide/users-groups/best-practices.html#enable-identity-federation + DisplayName string `json:"displayName,omitempty"` + // All the emails associated with the Databricks user. + Emails []ComplexValue `json:"emails,omitempty"` + // Entitlements assigned to the user. See [assigning entitlements] for a + // full list of supported values. + // + // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements + Entitlements []ComplexValue `json:"entitlements,omitempty"` + // External ID is not currently supported. It is reserved for future use. + ExternalId string `json:"externalId,omitempty"` + + Groups []ComplexValue `json:"groups,omitempty"` + // Databricks user ID. + Id string `json:"-" url:"-"` + + Name *Name `json:"name,omitempty"` + // Corresponds to AWS instance profile/arn role. + Roles []ComplexValue `json:"roles,omitempty"` + // The schema of the user. + Schemas []UserSchema `json:"schemas,omitempty"` + // Email address of the Databricks user. + UserName string `json:"userName,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateUserRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateUserRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type UpdateWorkspaceAssignments struct { // Array of permissions assignments to update on the workspace. Valid values // are "USER" and "ADMIN" (case-sensitive). If both "USER" and "ADMIN" are diff --git a/service/iamv2/api.go b/service/iamv2/api.go new file mode 100755 index 000000000..67bccd4f7 --- /dev/null +++ b/service/iamv2/api.go @@ -0,0 +1,206 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +// These APIs allow you to manage Account Iam V2, Workspace Iam V2, etc. +package iamv2 + +import ( + "context" + + "github.com/databricks/databricks-sdk-go/client" +) + +type AccountIamV2Interface interface { + + // TODO: Write description later when this method is implemented + CreateGroup(ctx context.Context, request CreateGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + CreateServicePrincipal(ctx context.Context, request CreateServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + CreateUser(ctx context.Context, request CreateUserRequest) (*User, error) + + // TODO: Write description later when this method is implemented + CreateWorkspaceAccessDetail(ctx context.Context, request CreateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + DeleteGroup(ctx context.Context, request DeleteGroupRequest) error + + // TODO: Write description later when this method is implemented + DeleteServicePrincipal(ctx context.Context, request DeleteServicePrincipalRequest) error + + // TODO: Write description later when this method is implemented + DeleteUser(ctx context.Context, request DeleteUserRequest) error + + // TODO: Write description later when this method is implemented + DeleteWorkspaceAccessDetail(ctx context.Context, request DeleteWorkspaceAccessDetailRequest) error + + // TODO: Write description later when this method is implemented + GetGroup(ctx context.Context, request GetGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + GetServicePrincipal(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + GetUser(ctx context.Context, request GetUserRequest) (*User, error) + + // Returns the access details for a principal in a workspace. Allows for + // checking access details for any provisioned principal (user, service + // principal, or group) in a workspace. * Provisioned principal here refers to + // one that has been synced into Databricks from the customer's IdP or added + // explicitly to Databricks via SCIM/UI. Allows for passing in a "view" + // parameter to control what fields are returned (BASIC by default or FULL). + GetWorkspaceAccessDetail(ctx context.Context, request GetWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + ListGroups(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) + + // TODO: Write description later when this method is implemented + ListServicePrincipals(ctx context.Context, request ListServicePrincipalsRequest) (*ListServicePrincipalsResponse, error) + + // TODO: Write description later when this method is implemented + ListUsers(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) + + // TODO: Write description later when this method is implemented + ListWorkspaceAccessDetails(ctx context.Context, request ListWorkspaceAccessDetailsRequest) (*ListWorkspaceAccessDetailsResponse, error) + + // Resolves a group with the given external ID from the customer's IdP. If the + // group does not exist, it will be created in the account. If the customer is + // not onboarded onto Automatic Identity Management (AIM), this will return an + // error. + ResolveGroup(ctx context.Context, request ResolveGroupRequest) (*ResolveGroupResponse, error) + + // Resolves an SP with the given external ID from the customer's IdP. If the SP + // does not exist, it will be created. If the customer is not onboarded onto + // Automatic Identity Management (AIM), this will return an error. + ResolveServicePrincipal(ctx context.Context, request ResolveServicePrincipalRequest) (*ResolveServicePrincipalResponse, error) + + // Resolves a user with the given external ID from the customer's IdP. If the + // user does not exist, it will be created. If the customer is not onboarded + // onto Automatic Identity Management (AIM), this will return an error. + ResolveUser(ctx context.Context, request ResolveUserRequest) (*ResolveUserResponse, error) + + // TODO: Write description later when this method is implemented + UpdateGroup(ctx context.Context, request UpdateGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + UpdateServicePrincipal(ctx context.Context, request UpdateServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + UpdateUser(ctx context.Context, request UpdateUserRequest) (*User, error) + + // TODO: Write description later when this method is implemented + UpdateWorkspaceAccessDetail(ctx context.Context, request UpdateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) +} + +func NewAccountIamV2(client *client.DatabricksClient) *AccountIamV2API { + return &AccountIamV2API{ + accountIamV2Impl: accountIamV2Impl{ + client: client, + }, + } +} + +// These APIs are used to manage identities and the workspace access of these +// identities in . +type AccountIamV2API struct { + accountIamV2Impl +} + +type WorkspaceIamV2Interface interface { + + // TODO: Write description later when this method is implemented + CreateGroupProxy(ctx context.Context, request CreateGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + CreateServicePrincipalProxy(ctx context.Context, request CreateServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + CreateUserProxy(ctx context.Context, request CreateUserProxyRequest) (*User, error) + + // TODO: Write description later when this method is implemented + CreateWorkspaceAccessDetailLocal(ctx context.Context, request CreateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + DeleteGroupProxy(ctx context.Context, request DeleteGroupProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteServicePrincipalProxy(ctx context.Context, request DeleteServicePrincipalProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteUserProxy(ctx context.Context, request DeleteUserProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteWorkspaceAccessDetailLocal(ctx context.Context, request DeleteWorkspaceAccessDetailLocalRequest) error + + // TODO: Write description later when this method is implemented + GetGroupProxy(ctx context.Context, request GetGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + GetServicePrincipalProxy(ctx context.Context, request GetServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + GetUserProxy(ctx context.Context, request GetUserProxyRequest) (*User, error) + + // Returns the access details for a principal in the current workspace. Allows + // for checking access details for any provisioned principal (user, service + // principal, or group) in the current workspace. * Provisioned principal here + // refers to one that has been synced into Databricks from the customer's IdP or + // added explicitly to Databricks via SCIM/UI. Allows for passing in a "view" + // parameter to control what fields are returned (BASIC by default or FULL). + GetWorkspaceAccessDetailLocal(ctx context.Context, request GetWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + ListGroupsProxy(ctx context.Context, request ListGroupsProxyRequest) (*ListGroupsResponse, error) + + // TODO: Write description later when this method is implemented + ListServicePrincipalsProxy(ctx context.Context, request ListServicePrincipalsProxyRequest) (*ListServicePrincipalsResponse, error) + + // TODO: Write description later when this method is implemented + ListUsersProxy(ctx context.Context, request ListUsersProxyRequest) (*ListUsersResponse, error) + + // TODO: Write description later when this method is implemented + ListWorkspaceAccessDetailsLocal(ctx context.Context, request ListWorkspaceAccessDetailsLocalRequest) (*ListWorkspaceAccessDetailsResponse, error) + + // Resolves a group with the given external ID from the customer's IdP. If the + // group does not exist, it will be created in the account. If the customer is + // not onboarded onto Automatic Identity Management (AIM), this will return an + // error. + ResolveGroupProxy(ctx context.Context, request ResolveGroupProxyRequest) (*ResolveGroupResponse, error) + + // Resolves an SP with the given external ID from the customer's IdP. If the SP + // does not exist, it will be created. If the customer is not onboarded onto + // Automatic Identity Management (AIM), this will return an error. + ResolveServicePrincipalProxy(ctx context.Context, request ResolveServicePrincipalProxyRequest) (*ResolveServicePrincipalResponse, error) + + // Resolves a user with the given external ID from the customer's IdP. If the + // user does not exist, it will be created. If the customer is not onboarded + // onto Automatic Identity Management (AIM), this will return an error. + ResolveUserProxy(ctx context.Context, request ResolveUserProxyRequest) (*ResolveUserResponse, error) + + // TODO: Write description later when this method is implemented + UpdateGroupProxy(ctx context.Context, request UpdateGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + UpdateServicePrincipalProxy(ctx context.Context, request UpdateServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + UpdateUserProxy(ctx context.Context, request UpdateUserProxyRequest) (*User, error) + + // TODO: Write description later when this method is implemented + UpdateWorkspaceAccessDetailLocal(ctx context.Context, request UpdateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) +} + +func NewWorkspaceIamV2(client *client.DatabricksClient) *WorkspaceIamV2API { + return &WorkspaceIamV2API{ + workspaceIamV2Impl: workspaceIamV2Impl{ + client: client, + }, + } +} + +// These APIs are used to manage identities and the workspace access of these +// identities in . +type WorkspaceIamV2API struct { + workspaceIamV2Impl +} diff --git a/service/iamv2/impl.go b/service/iamv2/impl.go new file mode 100755 index 000000000..beb16d1f7 --- /dev/null +++ b/service/iamv2/impl.go @@ -0,0 +1,527 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package iamv2 + +import ( + "context" + "fmt" + "net/http" + + "github.com/databricks/databricks-sdk-go/client" +) + +// unexported type that holds implementations of just AccountIamV2 API methods +type accountIamV2Impl struct { + client *client.DatabricksClient +} + +func (a *accountIamV2Impl) CreateGroup(ctx context.Context, request CreateGroupRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Group, &group) + return &group, err +} + +func (a *accountIamV2Impl) CreateServicePrincipal(ctx context.Context, request CreateServicePrincipalRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/servicePrincipals", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.ServicePrincipal, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *accountIamV2Impl) CreateUser(ctx context.Context, request CreateUserRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/users", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.User, &user) + return &user, err +} + +func (a *accountIamV2Impl) CreateWorkspaceAccessDetail(ctx context.Context, request CreateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) { + var workspaceAccessDetail WorkspaceAccessDetail + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/workspaces/%v/workspaceAccessDetails", a.client.ConfiguredAccountID(), request.Parent) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.WorkspaceAccessDetail, &workspaceAccessDetail) + return &workspaceAccessDetail, err +} + +func (a *accountIamV2Impl) DeleteGroup(ctx context.Context, request DeleteGroupRequest) error { + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *accountIamV2Impl) DeleteServicePrincipal(ctx context.Context, request DeleteServicePrincipalRequest) error { + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/servicePrincipals/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *accountIamV2Impl) DeleteUser(ctx context.Context, request DeleteUserRequest) error { + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/users/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *accountIamV2Impl) DeleteWorkspaceAccessDetail(ctx context.Context, request DeleteWorkspaceAccessDetailRequest) error { + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/workspaces/%v/workspaceAccessDetails/%v", a.client.ConfiguredAccountID(), request.WorkspaceId, request.PrincipalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *accountIamV2Impl) GetGroup(ctx context.Context, request GetGroupRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &group) + return &group, err +} + +func (a *accountIamV2Impl) GetServicePrincipal(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/servicePrincipals/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *accountIamV2Impl) GetUser(ctx context.Context, request GetUserRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/users/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &user) + return &user, err +} + +func (a *accountIamV2Impl) GetWorkspaceAccessDetail(ctx context.Context, request GetWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) { + var workspaceAccessDetail WorkspaceAccessDetail + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/workspaces/%v/workspaceAccessDetails/%v", a.client.ConfiguredAccountID(), request.WorkspaceId, request.PrincipalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspaceAccessDetail) + return &workspaceAccessDetail, err +} + +func (a *accountIamV2Impl) ListGroups(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) { + var listGroupsResponse ListGroupsResponse + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listGroupsResponse) + return &listGroupsResponse, err +} + +func (a *accountIamV2Impl) ListServicePrincipals(ctx context.Context, request ListServicePrincipalsRequest) (*ListServicePrincipalsResponse, error) { + var listServicePrincipalsResponse ListServicePrincipalsResponse + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/servicePrincipals", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listServicePrincipalsResponse) + return &listServicePrincipalsResponse, err +} + +func (a *accountIamV2Impl) ListUsers(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) { + var listUsersResponse ListUsersResponse + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/users", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listUsersResponse) + return &listUsersResponse, err +} + +func (a *accountIamV2Impl) ListWorkspaceAccessDetails(ctx context.Context, request ListWorkspaceAccessDetailsRequest) (*ListWorkspaceAccessDetailsResponse, error) { + var listWorkspaceAccessDetailsResponse ListWorkspaceAccessDetailsResponse + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/workspaces/%v/workspaceAccessDetails", a.client.ConfiguredAccountID(), request.WorkspaceId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listWorkspaceAccessDetailsResponse) + return &listWorkspaceAccessDetailsResponse, err +} + +func (a *accountIamV2Impl) ResolveGroup(ctx context.Context, request ResolveGroupRequest) (*ResolveGroupResponse, error) { + var resolveGroupResponse ResolveGroupResponse + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups/resolveByExternalId", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resolveGroupResponse) + return &resolveGroupResponse, err +} + +func (a *accountIamV2Impl) ResolveServicePrincipal(ctx context.Context, request ResolveServicePrincipalRequest) (*ResolveServicePrincipalResponse, error) { + var resolveServicePrincipalResponse ResolveServicePrincipalResponse + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/servicePrincipals/resolveByExternalId", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resolveServicePrincipalResponse) + return &resolveServicePrincipalResponse, err +} + +func (a *accountIamV2Impl) ResolveUser(ctx context.Context, request ResolveUserRequest) (*ResolveUserResponse, error) { + var resolveUserResponse ResolveUserResponse + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/users/resolveByExternalId", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resolveUserResponse) + return &resolveUserResponse, err +} + +func (a *accountIamV2Impl) UpdateGroup(ctx context.Context, request UpdateGroupRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Group, &group) + return &group, err +} + +func (a *accountIamV2Impl) UpdateServicePrincipal(ctx context.Context, request UpdateServicePrincipalRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/servicePrincipals/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.ServicePrincipal, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *accountIamV2Impl) UpdateUser(ctx context.Context, request UpdateUserRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/users/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.User, &user) + return &user, err +} + +func (a *accountIamV2Impl) UpdateWorkspaceAccessDetail(ctx context.Context, request UpdateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) { + var workspaceAccessDetail WorkspaceAccessDetail + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/workspaces/%v/workspaceAccessDetails/%v", a.client.ConfiguredAccountID(), request.WorkspaceId, request.PrincipalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.WorkspaceAccessDetail, &workspaceAccessDetail) + return &workspaceAccessDetail, err +} + +// unexported type that holds implementations of just WorkspaceIamV2 API methods +type workspaceIamV2Impl struct { + client *client.DatabricksClient +} + +func (a *workspaceIamV2Impl) CreateGroupProxy(ctx context.Context, request CreateGroupProxyRequest) (*Group, error) { + var group Group + path := "/api/2.0/identity/groups" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Group, &group) + return &group, err +} + +func (a *workspaceIamV2Impl) CreateServicePrincipalProxy(ctx context.Context, request CreateServicePrincipalProxyRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := "/api/2.0/identity/servicePrincipals" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.ServicePrincipal, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *workspaceIamV2Impl) CreateUserProxy(ctx context.Context, request CreateUserProxyRequest) (*User, error) { + var user User + path := "/api/2.0/identity/users" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.User, &user) + return &user, err +} + +func (a *workspaceIamV2Impl) CreateWorkspaceAccessDetailLocal(ctx context.Context, request CreateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) { + var workspaceAccessDetail WorkspaceAccessDetail + path := "/api/2.0/identity/workspaceAccessDetails" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.WorkspaceAccessDetail, &workspaceAccessDetail) + return &workspaceAccessDetail, err +} + +func (a *workspaceIamV2Impl) DeleteGroupProxy(ctx context.Context, request DeleteGroupProxyRequest) error { + path := fmt.Sprintf("/api/2.0/identity/groups/%v", request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *workspaceIamV2Impl) DeleteServicePrincipalProxy(ctx context.Context, request DeleteServicePrincipalProxyRequest) error { + path := fmt.Sprintf("/api/2.0/identity/servicePrincipals/%v", request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *workspaceIamV2Impl) DeleteUserProxy(ctx context.Context, request DeleteUserProxyRequest) error { + path := fmt.Sprintf("/api/2.0/identity/users/%v", request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *workspaceIamV2Impl) DeleteWorkspaceAccessDetailLocal(ctx context.Context, request DeleteWorkspaceAccessDetailLocalRequest) error { + path := fmt.Sprintf("/api/2.0/identity/workspaceAccessDetails/%v", request.PrincipalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *workspaceIamV2Impl) GetGroupProxy(ctx context.Context, request GetGroupProxyRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/identity/groups/%v", request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &group) + return &group, err +} + +func (a *workspaceIamV2Impl) GetServicePrincipalProxy(ctx context.Context, request GetServicePrincipalProxyRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/identity/servicePrincipals/%v", request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *workspaceIamV2Impl) GetUserProxy(ctx context.Context, request GetUserProxyRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/identity/users/%v", request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &user) + return &user, err +} + +func (a *workspaceIamV2Impl) GetWorkspaceAccessDetailLocal(ctx context.Context, request GetWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) { + var workspaceAccessDetail WorkspaceAccessDetail + path := fmt.Sprintf("/api/2.0/identity/workspaceAccessDetails/%v", request.PrincipalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspaceAccessDetail) + return &workspaceAccessDetail, err +} + +func (a *workspaceIamV2Impl) ListGroupsProxy(ctx context.Context, request ListGroupsProxyRequest) (*ListGroupsResponse, error) { + var listGroupsResponse ListGroupsResponse + path := "/api/2.0/identity/groups" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listGroupsResponse) + return &listGroupsResponse, err +} + +func (a *workspaceIamV2Impl) ListServicePrincipalsProxy(ctx context.Context, request ListServicePrincipalsProxyRequest) (*ListServicePrincipalsResponse, error) { + var listServicePrincipalsResponse ListServicePrincipalsResponse + path := "/api/2.0/identity/servicePrincipals" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listServicePrincipalsResponse) + return &listServicePrincipalsResponse, err +} + +func (a *workspaceIamV2Impl) ListUsersProxy(ctx context.Context, request ListUsersProxyRequest) (*ListUsersResponse, error) { + var listUsersResponse ListUsersResponse + path := "/api/2.0/identity/users" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listUsersResponse) + return &listUsersResponse, err +} + +func (a *workspaceIamV2Impl) ListWorkspaceAccessDetailsLocal(ctx context.Context, request ListWorkspaceAccessDetailsLocalRequest) (*ListWorkspaceAccessDetailsResponse, error) { + var listWorkspaceAccessDetailsResponse ListWorkspaceAccessDetailsResponse + path := "/api/2.0/identity/workspaceAccessDetails" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listWorkspaceAccessDetailsResponse) + return &listWorkspaceAccessDetailsResponse, err +} + +func (a *workspaceIamV2Impl) ResolveGroupProxy(ctx context.Context, request ResolveGroupProxyRequest) (*ResolveGroupResponse, error) { + var resolveGroupResponse ResolveGroupResponse + path := "/api/2.0/identity/groups/resolveByExternalId" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resolveGroupResponse) + return &resolveGroupResponse, err +} + +func (a *workspaceIamV2Impl) ResolveServicePrincipalProxy(ctx context.Context, request ResolveServicePrincipalProxyRequest) (*ResolveServicePrincipalResponse, error) { + var resolveServicePrincipalResponse ResolveServicePrincipalResponse + path := "/api/2.0/identity/servicePrincipals/resolveByExternalId" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resolveServicePrincipalResponse) + return &resolveServicePrincipalResponse, err +} + +func (a *workspaceIamV2Impl) ResolveUserProxy(ctx context.Context, request ResolveUserProxyRequest) (*ResolveUserResponse, error) { + var resolveUserResponse ResolveUserResponse + path := "/api/2.0/identity/users/resolveByExternalId" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resolveUserResponse) + return &resolveUserResponse, err +} + +func (a *workspaceIamV2Impl) UpdateGroupProxy(ctx context.Context, request UpdateGroupProxyRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/identity/groups/%v", request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Group, &group) + return &group, err +} + +func (a *workspaceIamV2Impl) UpdateServicePrincipalProxy(ctx context.Context, request UpdateServicePrincipalProxyRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/identity/servicePrincipals/%v", request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.ServicePrincipal, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *workspaceIamV2Impl) UpdateUserProxy(ctx context.Context, request UpdateUserProxyRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/identity/users/%v", request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.User, &user) + return &user, err +} + +func (a *workspaceIamV2Impl) UpdateWorkspaceAccessDetailLocal(ctx context.Context, request UpdateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) { + var workspaceAccessDetail WorkspaceAccessDetail + path := fmt.Sprintf("/api/2.0/identity/workspaceAccessDetails/%v", request.PrincipalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.WorkspaceAccessDetail, &workspaceAccessDetail) + return &workspaceAccessDetail, err +} diff --git a/service/iamv2/interface.go b/service/iamv2/interface.go new file mode 100755 index 000000000..dcb422147 --- /dev/null +++ b/service/iamv2/interface.go @@ -0,0 +1,187 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package iamv2 + +import ( + "context" +) + +// These APIs are used to manage identities and the workspace access of these +// identities in . +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type AccountIamV2Service interface { + + // TODO: Write description later when this method is implemented + CreateGroup(ctx context.Context, request CreateGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + CreateServicePrincipal(ctx context.Context, request CreateServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + CreateUser(ctx context.Context, request CreateUserRequest) (*User, error) + + // TODO: Write description later when this method is implemented + CreateWorkspaceAccessDetail(ctx context.Context, request CreateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + DeleteGroup(ctx context.Context, request DeleteGroupRequest) error + + // TODO: Write description later when this method is implemented + DeleteServicePrincipal(ctx context.Context, request DeleteServicePrincipalRequest) error + + // TODO: Write description later when this method is implemented + DeleteUser(ctx context.Context, request DeleteUserRequest) error + + // TODO: Write description later when this method is implemented + DeleteWorkspaceAccessDetail(ctx context.Context, request DeleteWorkspaceAccessDetailRequest) error + + // TODO: Write description later when this method is implemented + GetGroup(ctx context.Context, request GetGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + GetServicePrincipal(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + GetUser(ctx context.Context, request GetUserRequest) (*User, error) + + // Returns the access details for a principal in a workspace. Allows for + // checking access details for any provisioned principal (user, service + // principal, or group) in a workspace. * Provisioned principal here refers + // to one that has been synced into Databricks from the customer's IdP or + // added explicitly to Databricks via SCIM/UI. Allows for passing in a + // "view" parameter to control what fields are returned (BASIC by default or + // FULL). + GetWorkspaceAccessDetail(ctx context.Context, request GetWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + ListGroups(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) + + // TODO: Write description later when this method is implemented + ListServicePrincipals(ctx context.Context, request ListServicePrincipalsRequest) (*ListServicePrincipalsResponse, error) + + // TODO: Write description later when this method is implemented + ListUsers(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) + + // TODO: Write description later when this method is implemented + ListWorkspaceAccessDetails(ctx context.Context, request ListWorkspaceAccessDetailsRequest) (*ListWorkspaceAccessDetailsResponse, error) + + // Resolves a group with the given external ID from the customer's IdP. If + // the group does not exist, it will be created in the account. If the + // customer is not onboarded onto Automatic Identity Management (AIM), this + // will return an error. + ResolveGroup(ctx context.Context, request ResolveGroupRequest) (*ResolveGroupResponse, error) + + // Resolves an SP with the given external ID from the customer's IdP. If the + // SP does not exist, it will be created. If the customer is not onboarded + // onto Automatic Identity Management (AIM), this will return an error. + ResolveServicePrincipal(ctx context.Context, request ResolveServicePrincipalRequest) (*ResolveServicePrincipalResponse, error) + + // Resolves a user with the given external ID from the customer's IdP. If + // the user does not exist, it will be created. If the customer is not + // onboarded onto Automatic Identity Management (AIM), this will return an + // error. + ResolveUser(ctx context.Context, request ResolveUserRequest) (*ResolveUserResponse, error) + + // TODO: Write description later when this method is implemented + UpdateGroup(ctx context.Context, request UpdateGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + UpdateServicePrincipal(ctx context.Context, request UpdateServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + UpdateUser(ctx context.Context, request UpdateUserRequest) (*User, error) + + // TODO: Write description later when this method is implemented + UpdateWorkspaceAccessDetail(ctx context.Context, request UpdateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) +} + +// These APIs are used to manage identities and the workspace access of these +// identities in . +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type WorkspaceIamV2Service interface { + + // TODO: Write description later when this method is implemented + CreateGroupProxy(ctx context.Context, request CreateGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + CreateServicePrincipalProxy(ctx context.Context, request CreateServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + CreateUserProxy(ctx context.Context, request CreateUserProxyRequest) (*User, error) + + // TODO: Write description later when this method is implemented + CreateWorkspaceAccessDetailLocal(ctx context.Context, request CreateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + DeleteGroupProxy(ctx context.Context, request DeleteGroupProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteServicePrincipalProxy(ctx context.Context, request DeleteServicePrincipalProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteUserProxy(ctx context.Context, request DeleteUserProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteWorkspaceAccessDetailLocal(ctx context.Context, request DeleteWorkspaceAccessDetailLocalRequest) error + + // TODO: Write description later when this method is implemented + GetGroupProxy(ctx context.Context, request GetGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + GetServicePrincipalProxy(ctx context.Context, request GetServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + GetUserProxy(ctx context.Context, request GetUserProxyRequest) (*User, error) + + // Returns the access details for a principal in the current workspace. + // Allows for checking access details for any provisioned principal (user, + // service principal, or group) in the current workspace. * Provisioned + // principal here refers to one that has been synced into Databricks from + // the customer's IdP or added explicitly to Databricks via SCIM/UI. Allows + // for passing in a "view" parameter to control what fields are returned + // (BASIC by default or FULL). + GetWorkspaceAccessDetailLocal(ctx context.Context, request GetWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + ListGroupsProxy(ctx context.Context, request ListGroupsProxyRequest) (*ListGroupsResponse, error) + + // TODO: Write description later when this method is implemented + ListServicePrincipalsProxy(ctx context.Context, request ListServicePrincipalsProxyRequest) (*ListServicePrincipalsResponse, error) + + // TODO: Write description later when this method is implemented + ListUsersProxy(ctx context.Context, request ListUsersProxyRequest) (*ListUsersResponse, error) + + // TODO: Write description later when this method is implemented + ListWorkspaceAccessDetailsLocal(ctx context.Context, request ListWorkspaceAccessDetailsLocalRequest) (*ListWorkspaceAccessDetailsResponse, error) + + // Resolves a group with the given external ID from the customer's IdP. If + // the group does not exist, it will be created in the account. If the + // customer is not onboarded onto Automatic Identity Management (AIM), this + // will return an error. + ResolveGroupProxy(ctx context.Context, request ResolveGroupProxyRequest) (*ResolveGroupResponse, error) + + // Resolves an SP with the given external ID from the customer's IdP. If the + // SP does not exist, it will be created. If the customer is not onboarded + // onto Automatic Identity Management (AIM), this will return an error. + ResolveServicePrincipalProxy(ctx context.Context, request ResolveServicePrincipalProxyRequest) (*ResolveServicePrincipalResponse, error) + + // Resolves a user with the given external ID from the customer's IdP. If + // the user does not exist, it will be created. If the customer is not + // onboarded onto Automatic Identity Management (AIM), this will return an + // error. + ResolveUserProxy(ctx context.Context, request ResolveUserProxyRequest) (*ResolveUserResponse, error) + + // TODO: Write description later when this method is implemented + UpdateGroupProxy(ctx context.Context, request UpdateGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + UpdateServicePrincipalProxy(ctx context.Context, request UpdateServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + UpdateUserProxy(ctx context.Context, request UpdateUserProxyRequest) (*User, error) + + // TODO: Write description later when this method is implemented + UpdateWorkspaceAccessDetailLocal(ctx context.Context, request UpdateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) +} diff --git a/service/iamv2/model.go b/service/iamv2/model.go new file mode 100755 index 000000000..4fe8774cf --- /dev/null +++ b/service/iamv2/model.go @@ -0,0 +1,823 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package iamv2 + +import ( + "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" +) + +type CreateGroupProxyRequest struct { + // Required. Group to be created in + Group Group `json:"group"` +} + +type CreateGroupRequest struct { + // Required. Group to be created in + Group Group `json:"group"` +} + +type CreateServicePrincipalProxyRequest struct { + // Required. Service principal to be created in + ServicePrincipal ServicePrincipal `json:"service_principal"` +} + +type CreateServicePrincipalRequest struct { + // Required. Service principal to be created in + ServicePrincipal ServicePrincipal `json:"service_principal"` +} + +type CreateUserProxyRequest struct { + // Required. User to be created in + User User `json:"user"` +} + +type CreateUserRequest struct { + // Required. User to be created in + User User `json:"user"` +} + +type CreateWorkspaceAccessDetailLocalRequest struct { + // Required. Workspace access detail to be created in . + WorkspaceAccessDetail WorkspaceAccessDetail `json:"workspace_access_detail"` +} + +type CreateWorkspaceAccessDetailRequest struct { + // Required. The parent path for workspace access detail. + Parent string `json:"-" url:"-"` + // Required. Workspace access detail to be created in . + WorkspaceAccessDetail WorkspaceAccessDetail `json:"workspace_access_detail"` +} + +type DeleteGroupProxyRequest struct { + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteGroupRequest struct { + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteServicePrincipalProxyRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteServicePrincipalRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteUserProxyRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteUserRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteWorkspaceAccessDetailLocalRequest struct { + // Required. ID of the principal in Databricks. + PrincipalId int64 `json:"-" url:"-"` +} + +type DeleteWorkspaceAccessDetailRequest struct { + // Required. ID of the principal in Databricks to delete workspace access + // for. + PrincipalId int64 `json:"-" url:"-"` + // The workspace ID where the principal has access. + WorkspaceId int64 `json:"-" url:"-"` +} + +type GetGroupProxyRequest struct { + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type GetGroupRequest struct { + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type GetServicePrincipalProxyRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type GetServicePrincipalRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type GetUserProxyRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type GetUserRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type GetWorkspaceAccessDetailLocalRequest struct { + // Required. The internal ID of the principal (user/sp/group) for which the + // access details are being requested. + PrincipalId int64 `json:"-" url:"-"` + // Controls what fields are returned. + View WorkspaceAccessDetailView `json:"-" url:"view,omitempty"` +} + +type GetWorkspaceAccessDetailRequest struct { + // Required. The internal ID of the principal (user/sp/group) for which the + // access details are being requested. + PrincipalId int64 `json:"-" url:"-"` + // Controls what fields are returned. + View WorkspaceAccessDetailView `json:"-" url:"view,omitempty"` + // Required. The workspace ID for which the access details are being + // requested. + WorkspaceId int64 `json:"-" url:"-"` +} + +// The details of a Group resource. +type Group struct { + // The parent account ID for group in Databricks. + AccountId string `json:"account_id,omitempty"` + // ExternalId of the group in the customer's IdP. + ExternalId string `json:"external_id,omitempty"` + // Display name of the group. + GroupName string `json:"group_name,omitempty"` + // Internal group ID of the group in Databricks. + InternalId int64 `json:"internal_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Group) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Group) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListGroupsProxyRequest struct { + // The maximum number of groups to return. The service may return fewer than + // this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListGroups call. Provide this to + // retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListGroupsProxyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListGroupsProxyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListGroupsRequest struct { + // The maximum number of groups to return. The service may return fewer than + // this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListGroups call. Provide this to + // retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListGroupsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListGroupsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// TODO: Write description later when this method is implemented +type ListGroupsResponse struct { + Groups []Group `json:"groups,omitempty"` + // A token, which can be sent as page_token to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListGroupsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListGroupsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListServicePrincipalsProxyRequest struct { + // The maximum number of SPs to return. The service may return fewer than + // this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListServicePrincipals call. + // Provide this to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListServicePrincipalsProxyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListServicePrincipalsProxyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListServicePrincipalsRequest struct { + // The maximum number of service principals to return. The service may + // return fewer than this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListServicePrincipals call. + // Provide this to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListServicePrincipalsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListServicePrincipalsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// TODO: Write description later when this method is implemented +type ListServicePrincipalsResponse struct { + // A token, which can be sent as page_token to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + + ServicePrincipals []ServicePrincipal `json:"service_principals,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListServicePrincipalsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListServicePrincipalsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListUsersProxyRequest struct { + // The maximum number of users to return. The service may return fewer than + // this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListUsers call. Provide this to + // retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListUsersProxyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListUsersProxyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListUsersRequest struct { + // The maximum number of users to return. The service may return fewer than + // this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListUsers call. Provide this to + // retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListUsersRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListUsersRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// TODO: Write description later when this method is implemented +type ListUsersResponse struct { + // A token, which can be sent as page_token to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + + Users []User `json:"users,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListUsersResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListUsersResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListWorkspaceAccessDetailsLocalRequest struct { + // The maximum number of workspace access details to return. The service may + // return fewer than this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListWorkspaceAccessDetails call. + // Provide this to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListWorkspaceAccessDetailsLocalRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListWorkspaceAccessDetailsLocalRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListWorkspaceAccessDetailsRequest struct { + // The maximum number of workspace access details to return. The service may + // return fewer than this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListWorkspaceAccessDetails call. + // Provide this to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + // The workspace ID for which the workspace access details are being + // fetched. + WorkspaceId int64 `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListWorkspaceAccessDetailsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListWorkspaceAccessDetailsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// TODO: Write description later when this method is implemented +type ListWorkspaceAccessDetailsResponse struct { + // A token, which can be sent as page_token to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + + WorkspaceAccessDetails []WorkspaceAccessDetail `json:"workspace_access_details,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListWorkspaceAccessDetailsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListWorkspaceAccessDetailsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// The type of the principal (user/sp/group). +type PrincipalType string + +const PrincipalTypeGroup PrincipalType = `GROUP` + +const PrincipalTypeServicePrincipal PrincipalType = `SERVICE_PRINCIPAL` + +const PrincipalTypeUser PrincipalType = `USER` + +// String representation for [fmt.Print] +func (f *PrincipalType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *PrincipalType) Set(v string) error { + switch v { + case `GROUP`, `SERVICE_PRINCIPAL`, `USER`: + *f = PrincipalType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "GROUP", "SERVICE_PRINCIPAL", "USER"`, v) + } +} + +// Values returns all possible values for PrincipalType. +// +// There is no guarantee on the order of the values in the slice. +func (f *PrincipalType) Values() []PrincipalType { + return []PrincipalType{ + PrincipalTypeGroup, + PrincipalTypeServicePrincipal, + PrincipalTypeUser, + } +} + +// Type always returns PrincipalType to satisfy [pflag.Value] interface +func (f *PrincipalType) Type() string { + return "PrincipalType" +} + +// Request message for resolving a group with the given external ID from the +// customer's IdP into Databricks. Will resolve metadata such as the group's +// groupname, and inherited parent groups. +type ResolveGroupProxyRequest struct { + // Required. The external ID of the group in the customer's IdP. + ExternalId string `json:"external_id"` +} + +// Request message for resolving a group with the given external ID from the +// customer's IdP into Databricks. Will resolve metadata such as the group's +// groupname, and inherited parent groups. +type ResolveGroupRequest struct { + // Required. The external ID of the group in the customer's IdP. + ExternalId string `json:"external_id"` +} + +type ResolveGroupResponse struct { + // The group that was resolved. + Group *Group `json:"group,omitempty"` +} + +// Request message for resolving a service principal with the given external ID +// from the customer's IdP into Databricks. Will resolve metadata such as the +// service principal's displayname, status, and inherited parent groups. +type ResolveServicePrincipalProxyRequest struct { + // Required. The external ID of the service principal in the customer's IdP. + ExternalId string `json:"external_id"` +} + +// Request message for resolving a service principal with the given external ID +// from the customer's IdP into Databricks. Will resolve metadata such as the +// service principal's displayname, status, and inherited parent groups. +type ResolveServicePrincipalRequest struct { + // Required. The external ID of the service principal in the customer's IdP. + ExternalId string `json:"external_id"` +} + +type ResolveServicePrincipalResponse struct { + // The service principal that was resolved. + ServicePrincipal *ServicePrincipal `json:"service_principal,omitempty"` +} + +// Request message for resolving a user with the given external ID from the +// customer's IdP into Databricks. Will resolve metadata such as the user's +// displayname, status, and inherited parent groups. +type ResolveUserProxyRequest struct { + // Required. The external ID of the user in the customer's IdP. + ExternalId string `json:"external_id"` +} + +// Request message for resolving a user with the given external ID from the +// customer's IdP into Databricks. Will resolve metadata such as the user's +// displayname, status, and inherited parent groups. +type ResolveUserRequest struct { + // Required. The external ID of the user in the customer's IdP. + ExternalId string `json:"external_id"` +} + +type ResolveUserResponse struct { + // The user that was resolved. + User *User `json:"user,omitempty"` +} + +// The details of a ServicePrincipal resource. +type ServicePrincipal struct { + // The parent account ID for the service principal in Databricks. + AccountId string `json:"account_id,omitempty"` + // The activity status of a service principal in a Databricks account. + AccountSpStatus State `json:"account_sp_status,omitempty"` + // Application ID of the service principal. + ApplicationId string `json:"application_id,omitempty"` + // Display name of the service principal. + DisplayName string `json:"display_name,omitempty"` + // ExternalId of the service principal in the customer's IdP. + ExternalId string `json:"external_id,omitempty"` + // Internal service principal ID of the service principal in Databricks. + InternalId int64 `json:"internal_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ServicePrincipal) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ServicePrincipal) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// The activity status of a user or service principal in a Databricks account or +// workspace. +type State string + +const StateActive State = `ACTIVE` + +const StateInactive State = `INACTIVE` + +// String representation for [fmt.Print] +func (f *State) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *State) Set(v string) error { + switch v { + case `ACTIVE`, `INACTIVE`: + *f = State(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ACTIVE", "INACTIVE"`, v) + } +} + +// Values returns all possible values for State. +// +// There is no guarantee on the order of the values in the slice. +func (f *State) Values() []State { + return []State{ + StateActive, + StateInactive, + } +} + +// Type always returns State to satisfy [pflag.Value] interface +func (f *State) Type() string { + return "State" +} + +type UpdateGroupProxyRequest struct { + // Required. Group to be updated in + Group Group `json:"group"` + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` +} + +type UpdateGroupRequest struct { + // Required. Group to be updated in + Group Group `json:"group"` + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` +} + +type UpdateServicePrincipalProxyRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` + // Required. Service principal to be updated in + ServicePrincipal ServicePrincipal `json:"service_principal"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` +} + +type UpdateServicePrincipalRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` + // Required. Service Principal to be updated in + ServicePrincipal ServicePrincipal `json:"service_principal"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` +} + +type UpdateUserProxyRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` + // Required. User to be updated in + User User `json:"user"` +} + +type UpdateUserRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` + // Required. User to be updated in + User User `json:"user"` +} + +type UpdateWorkspaceAccessDetailLocalRequest struct { + // Required. ID of the principal in Databricks. + PrincipalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` + // Required. WorkspaceAccessDetail to be updated in + WorkspaceAccessDetail WorkspaceAccessDetail `json:"workspace_access_detail"` +} + +type UpdateWorkspaceAccessDetailRequest struct { + // Required. ID of the principal in Databricks. + PrincipalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` + // Required. Workspace access detail to be updated in + WorkspaceAccessDetail WorkspaceAccessDetail `json:"workspace_access_detail"` + // Required. The workspace ID for which the workspace access detail is being + // updated. + WorkspaceId int64 `json:"-" url:"-"` +} + +// The details of a User resource. +type User struct { + // The accountId parent of the user in Databricks. + AccountId string `json:"account_id,omitempty"` + // The activity status of a user in a Databricks account. + AccountUserStatus State `json:"account_user_status,omitempty"` + // ExternalId of the user in the customer's IdP. + ExternalId string `json:"external_id,omitempty"` + // Internal userId of the user in Databricks. + InternalId int64 `json:"internal_id,omitempty"` + + Name *UserName `json:"name,omitempty"` + // Username/email of the user. + Username string `json:"username"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *User) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s User) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type UserName struct { + FamilyName string `json:"family_name,omitempty"` + + GivenName string `json:"given_name,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UserName) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UserName) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// The details of a principal's access to a workspace. +type WorkspaceAccessDetail struct { + AccessType WorkspaceAccessDetailAccessType `json:"access_type,omitempty"` + // The account ID parent of the workspace where the principal has access. + AccountId string `json:"account_id,omitempty"` + // The permissions granted to the principal in the workspace. + Permissions []WorkspacePermission `json:"permissions,omitempty"` + // The internal ID of the principal (user/sp/group) in Databricks. + PrincipalId int64 `json:"principal_id,omitempty"` + + PrincipalType PrincipalType `json:"principal_type,omitempty"` + // The activity status of the principal in the workspace. Not applicable for + // groups at the moment. + Status State `json:"status,omitempty"` + // The workspace ID where the principal has access. + WorkspaceId int64 `json:"workspace_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *WorkspaceAccessDetail) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s WorkspaceAccessDetail) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// The type of access the principal has to the workspace. +type WorkspaceAccessDetailAccessType string + +const WorkspaceAccessDetailAccessTypeDirect WorkspaceAccessDetailAccessType = `DIRECT` + +const WorkspaceAccessDetailAccessTypeIndirect WorkspaceAccessDetailAccessType = `INDIRECT` + +// String representation for [fmt.Print] +func (f *WorkspaceAccessDetailAccessType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *WorkspaceAccessDetailAccessType) Set(v string) error { + switch v { + case `DIRECT`, `INDIRECT`: + *f = WorkspaceAccessDetailAccessType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DIRECT", "INDIRECT"`, v) + } +} + +// Values returns all possible values for WorkspaceAccessDetailAccessType. +// +// There is no guarantee on the order of the values in the slice. +func (f *WorkspaceAccessDetailAccessType) Values() []WorkspaceAccessDetailAccessType { + return []WorkspaceAccessDetailAccessType{ + WorkspaceAccessDetailAccessTypeDirect, + WorkspaceAccessDetailAccessTypeIndirect, + } +} + +// Type always returns WorkspaceAccessDetailAccessType to satisfy [pflag.Value] interface +func (f *WorkspaceAccessDetailAccessType) Type() string { + return "WorkspaceAccessDetailAccessType" +} + +// Controls what fields are returned in the GetWorkspaceAccessDetail response. +type WorkspaceAccessDetailView string + +const WorkspaceAccessDetailViewBasic WorkspaceAccessDetailView = `BASIC` + +const WorkspaceAccessDetailViewFull WorkspaceAccessDetailView = `FULL` + +// String representation for [fmt.Print] +func (f *WorkspaceAccessDetailView) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *WorkspaceAccessDetailView) Set(v string) error { + switch v { + case `BASIC`, `FULL`: + *f = WorkspaceAccessDetailView(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "BASIC", "FULL"`, v) + } +} + +// Values returns all possible values for WorkspaceAccessDetailView. +// +// There is no guarantee on the order of the values in the slice. +func (f *WorkspaceAccessDetailView) Values() []WorkspaceAccessDetailView { + return []WorkspaceAccessDetailView{ + WorkspaceAccessDetailViewBasic, + WorkspaceAccessDetailViewFull, + } +} + +// Type always returns WorkspaceAccessDetailView to satisfy [pflag.Value] interface +func (f *WorkspaceAccessDetailView) Type() string { + return "WorkspaceAccessDetailView" +} + +// The type of permission a principal has to a workspace (admin/user). +type WorkspacePermission string + +const WorkspacePermissionAdminPermission WorkspacePermission = `ADMIN_PERMISSION` + +const WorkspacePermissionUserPermission WorkspacePermission = `USER_PERMISSION` + +// String representation for [fmt.Print] +func (f *WorkspacePermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *WorkspacePermission) Set(v string) error { + switch v { + case `ADMIN_PERMISSION`, `USER_PERMISSION`: + *f = WorkspacePermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ADMIN_PERMISSION", "USER_PERMISSION"`, v) + } +} + +// Values returns all possible values for WorkspacePermission. +// +// There is no guarantee on the order of the values in the slice. +func (f *WorkspacePermission) Values() []WorkspacePermission { + return []WorkspacePermission{ + WorkspacePermissionAdminPermission, + WorkspacePermissionUserPermission, + } +} + +// Type always returns WorkspacePermission to satisfy [pflag.Value] interface +func (f *WorkspacePermission) Type() string { + return "WorkspacePermission" +} diff --git a/service/jobs/model.go b/service/jobs/model.go index 817f9c1bf..568d85e87 100755 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -60,6 +60,9 @@ type BaseJob struct { // based on accessible budget policies of the run_as identity on job // creation or modification. EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + // The id of the usage policy used by this job for cost attribution + // purposes. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // Indicates if the job has more array properties (`tasks`, `job_clusters`) // that are not shown. They can be accessed via :method:jobs/get endpoint. // It is only relevant for API 2.2 :method:jobs/list requests with @@ -120,6 +123,9 @@ type BaseRun struct { // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` + // The id of the usage policy used by this run for cost attribution + // purposes. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The time at which this run ended in epoch milliseconds (milliseconds // since 1/1/1970 UTC). This field is set to 0 if the job is still running. EndTime int64 `json:"end_time,omitempty"` @@ -628,6 +634,9 @@ type Continuous struct { // Indicate whether the continuous execution of the job is paused or not. // Defaults to UNPAUSED. PauseStatus PauseStatus `json:"pause_status,omitempty"` + // Indicate whether the continuous job is applying task level retries or + // not. Defaults to NEVER. + TaskRetryMode TaskRetryMode `json:"task_retry_mode,omitempty"` } type CreateJob struct { @@ -744,7 +753,7 @@ type CreateJob struct { Trigger *TriggerSettings `json:"trigger,omitempty"` // The id of the user specified usage policy to use for this job. If not // specified, a default usage policy may be applied when creating or - // modifying the job. See `effective_budget_policy_id` for the budget policy + // modifying the job. See `effective_usage_policy_id` for the usage policy // used by this workload. UsagePolicyId string `json:"usage_policy_id,omitempty"` // A collection of system notification IDs to notify when runs of this job @@ -1605,6 +1614,9 @@ type Job struct { // based on accessible budget policies of the run_as identity on job // creation or modification. EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + // The id of the usage policy used by this job for cost attribution + // purposes. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // Indicates if the job has more array properties (`tasks`, `job_clusters`) // that are not shown. They can be accessed via :method:jobs/get endpoint. // It is only relevant for API 2.2 :method:jobs/list requests with @@ -2150,7 +2162,7 @@ type JobSettings struct { Trigger *TriggerSettings `json:"trigger,omitempty"` // The id of the user specified usage policy to use for this job. If not // specified, a default usage policy may be applied when creating or - // modifying the job. See `effective_budget_policy_id` for the budget policy + // modifying the job. See `effective_usage_policy_id` for the usage policy // used by this workload. UsagePolicyId string `json:"usage_policy_id,omitempty"` // A collection of system notification IDs to notify when runs of this job @@ -2529,6 +2541,77 @@ func (s ListRunsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ModelTriggerConfiguration struct { + // Aliases of the model versions to monitor. Can only be used in conjunction + // with condition MODEL_ALIAS_SET. + Aliases []string `json:"aliases,omitempty"` + // The condition based on which to trigger a job run. + Condition ModelTriggerConfigurationCondition `json:"condition"` + // If set, the trigger starts a run only after the specified amount of time + // has passed since the last time the trigger fired. The minimum allowed + // value is 60 seconds. + MinTimeBetweenTriggersSeconds int `json:"min_time_between_triggers_seconds,omitempty"` + // Name of the securable to monitor ("mycatalog.myschema.mymodel" in the + // case of model-level triggers, "mycatalog.myschema" in the case of + // schema-level triggers) or empty in the case of metastore-level triggers. + SecurableName string `json:"securable_name,omitempty"` + // If set, the trigger starts a run only after no model updates have + // occurred for the specified time and can be used to wait for a series of + // model updates before triggering a run. The minimum allowed value is 60 + // seconds. + WaitAfterLastChangeSeconds int `json:"wait_after_last_change_seconds,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ModelTriggerConfiguration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ModelTriggerConfiguration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ModelTriggerConfigurationCondition string + +const ModelTriggerConfigurationConditionModelAliasSet ModelTriggerConfigurationCondition = `MODEL_ALIAS_SET` + +const ModelTriggerConfigurationConditionModelCreated ModelTriggerConfigurationCondition = `MODEL_CREATED` + +const ModelTriggerConfigurationConditionModelVersionReady ModelTriggerConfigurationCondition = `MODEL_VERSION_READY` + +// String representation for [fmt.Print] +func (f *ModelTriggerConfigurationCondition) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ModelTriggerConfigurationCondition) Set(v string) error { + switch v { + case `MODEL_ALIAS_SET`, `MODEL_CREATED`, `MODEL_VERSION_READY`: + *f = ModelTriggerConfigurationCondition(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "MODEL_ALIAS_SET", "MODEL_CREATED", "MODEL_VERSION_READY"`, v) + } +} + +// Values returns all possible values for ModelTriggerConfigurationCondition. +// +// There is no guarantee on the order of the values in the slice. +func (f *ModelTriggerConfigurationCondition) Values() []ModelTriggerConfigurationCondition { + return []ModelTriggerConfigurationCondition{ + ModelTriggerConfigurationConditionModelAliasSet, + ModelTriggerConfigurationConditionModelCreated, + ModelTriggerConfigurationConditionModelVersionReady, + } +} + +// Type always returns ModelTriggerConfigurationCondition to satisfy [pflag.Value] interface +func (f *ModelTriggerConfigurationCondition) Type() string { + return "ModelTriggerConfigurationCondition" +} + type NotebookOutput struct { // The value passed to // [dbutils.notebook.exit()](/notebooks/notebook-workflows.html#notebook-workflows-exit). @@ -3266,6 +3349,9 @@ type Run struct { // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` + // The id of the usage policy used by this run for cost attribution + // purposes. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The time at which this run ended in epoch milliseconds (milliseconds // since 1/1/1970 UTC). This field is set to 0 if the job is still running. EndTime int64 `json:"end_time,omitempty"` @@ -4212,7 +4298,8 @@ type RunTask struct { DependsOn []TaskDependency `json:"depends_on,omitempty"` // An optional description for this task. Description string `json:"description,omitempty"` - // Deprecated, field was never used in production. + // An optional flag to disable the task. If set to true, the task will not + // run even if it is part of a job. Disabled bool `json:"disabled,omitempty"` // The actual performance target used by the serverless run during // execution. This can differ from the client-set performance target on the @@ -5019,6 +5106,9 @@ type SubmitTask struct { DependsOn []TaskDependency `json:"depends_on,omitempty"` // An optional description for this task. Description string `json:"description,omitempty"` + // An optional flag to disable the task. If set to true, the task will not + // run even if it is part of a job. + Disabled bool `json:"disabled,omitempty"` // An optional set of email addresses notified when the task run begins or // completes. The default behavior is to not send any emails. EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` @@ -5249,6 +5339,9 @@ type Task struct { Description string `json:"description,omitempty"` // An option to disable auto optimization in serverless DisableAutoOptimization bool `json:"disable_auto_optimization,omitempty"` + // An optional flag to disable the task. If set to true, the task will not + // run even if it is part of a job. + Disabled bool `json:"disabled,omitempty"` // An optional set of email addresses that is notified when runs of this // task begin or complete as well as when this task is deleted. The default // behavior is to not send any emails. @@ -5455,6 +5548,48 @@ func (s TaskNotificationSettings) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// task retry mode of the continuous job * NEVER: The failed task will not be +// retried. * ON_FAILURE: Retry a failed task if at least one other task in the +// job is still running its first attempt. When this condition is no longer met +// or the retry limit is reached, the job run is cancelled and a new run is +// started. +type TaskRetryMode string + +const TaskRetryModeNever TaskRetryMode = `NEVER` + +const TaskRetryModeOnFailure TaskRetryMode = `ON_FAILURE` + +// String representation for [fmt.Print] +func (f *TaskRetryMode) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *TaskRetryMode) Set(v string) error { + switch v { + case `NEVER`, `ON_FAILURE`: + *f = TaskRetryMode(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "NEVER", "ON_FAILURE"`, v) + } +} + +// Values returns all possible values for TaskRetryMode. +// +// There is no guarantee on the order of the values in the slice. +func (f *TaskRetryMode) Values() []TaskRetryMode { + return []TaskRetryMode{ + TaskRetryModeNever, + TaskRetryModeOnFailure, + } +} + +// Type always returns TaskRetryMode to satisfy [pflag.Value] interface +func (f *TaskRetryMode) Type() string { + return "TaskRetryMode" +} + // The code indicates why the run was terminated. Additional codes might be // introduced in future releases. * `SUCCESS`: The run was completed // successfully. * `SUCCESS_WITH_FAILURES`: The run was completed successfully @@ -5753,6 +5888,8 @@ func (s TriggerInfo) MarshalJSON() ([]byte, error) { type TriggerSettings struct { // File arrival trigger settings. FileArrival *FileArrivalTriggerConfiguration `json:"file_arrival,omitempty"` + + Model *ModelTriggerConfiguration `json:"model,omitempty"` // Whether this trigger is paused or not. PauseStatus PauseStatus `json:"pause_status,omitempty"` // Periodic trigger settings. diff --git a/service/ml/api.go b/service/ml/api.go index d74d7d91e..bc90b60c0 100755 --- a/service/ml/api.go +++ b/service/ml/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Experiments, Feature Store, Forecasting, Materialized Features, Model Registry, etc. +// These APIs allow you to manage Experiments, Feature Engineering, Feature Store, Forecasting, Materialized Features, Model Registry, etc. package ml import ( @@ -95,6 +95,9 @@ type ExperimentsInterface interface { // Get a logged model. GetLoggedModelByModelId(ctx context.Context, modelId string) (*GetLoggedModelResponse, error) + // Batch endpoint for getting logged models from a list of model IDs + GetLoggedModels(ctx context.Context, request GetLoggedModelsRequest) (*GetLoggedModelsRequestResponse, error) + // Gets the permission levels that a user can have on an object. GetPermissionLevels(ctx context.Context, request GetExperimentPermissionLevelsRequest) (*GetExperimentPermissionLevelsResponse, error) @@ -354,6 +357,44 @@ func (a *ExperimentsAPI) GetPermissionsByExperimentId(ctx context.Context, exper }) } +type FeatureEngineeringInterface interface { + + // Create a Feature. + CreateFeature(ctx context.Context, request CreateFeatureRequest) (*Feature, error) + + // Delete a Feature. + DeleteFeature(ctx context.Context, request DeleteFeatureRequest) error + + // Get a Feature. + GetFeature(ctx context.Context, request GetFeatureRequest) (*Feature, error) + + // List Features. + // + // This method is generated by Databricks SDK Code Generator. + ListFeatures(ctx context.Context, request ListFeaturesRequest) listing.Iterator[Feature] + + // List Features. + // + // This method is generated by Databricks SDK Code Generator. + ListFeaturesAll(ctx context.Context, request ListFeaturesRequest) ([]Feature, error) + + // Update a Feature. + UpdateFeature(ctx context.Context, request UpdateFeatureRequest) (*Feature, error) +} + +func NewFeatureEngineering(client *client.DatabricksClient) *FeatureEngineeringAPI { + return &FeatureEngineeringAPI{ + featureEngineeringImpl: featureEngineeringImpl{ + client: client, + }, + } +} + +// [description] +type FeatureEngineeringAPI struct { + featureEngineeringImpl +} + type FeatureStoreInterface interface { // Create an Online Feature Store. diff --git a/service/ml/impl.go b/service/ml/impl.go index 83cfb3423..bcbf91b95 100755 --- a/service/ml/impl.go +++ b/service/ml/impl.go @@ -192,6 +192,16 @@ func (a *experimentsImpl) GetLoggedModel(ctx context.Context, request GetLoggedM return &getLoggedModelResponse, err } +func (a *experimentsImpl) GetLoggedModels(ctx context.Context, request GetLoggedModelsRequest) (*GetLoggedModelsRequestResponse, error) { + var getLoggedModelsRequestResponse GetLoggedModelsRequestResponse + path := "/api/2.0/mlflow/logged-models:batchGet" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getLoggedModelsRequestResponse) + return &getLoggedModelsRequestResponse, err +} + func (a *experimentsImpl) GetPermissionLevels(ctx context.Context, request GetExperimentPermissionLevelsRequest) (*GetExperimentPermissionLevelsResponse, error) { var getExperimentPermissionLevelsResponse GetExperimentPermissionLevelsResponse path := fmt.Sprintf("/api/2.0/permissions/experiments/%v/permissionLevels", request.ExperimentId) @@ -587,6 +597,97 @@ func (a *experimentsImpl) UpdateRun(ctx context.Context, request UpdateRun) (*Up return &updateRunResponse, err } +// unexported type that holds implementations of just FeatureEngineering API methods +type featureEngineeringImpl struct { + client *client.DatabricksClient +} + +func (a *featureEngineeringImpl) CreateFeature(ctx context.Context, request CreateFeatureRequest) (*Feature, error) { + var feature Feature + path := "/api/2.0/feature-engineering/features" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Feature, &feature) + return &feature, err +} + +func (a *featureEngineeringImpl) DeleteFeature(ctx context.Context, request DeleteFeatureRequest) error { + path := fmt.Sprintf("/api/2.0/feature-engineering/features/%v", request.FullName) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *featureEngineeringImpl) GetFeature(ctx context.Context, request GetFeatureRequest) (*Feature, error) { + var feature Feature + path := fmt.Sprintf("/api/2.0/feature-engineering/features/%v", request.FullName) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &feature) + return &feature, err +} + +// List Features. +func (a *featureEngineeringImpl) ListFeatures(ctx context.Context, request ListFeaturesRequest) listing.Iterator[Feature] { + + getNextPage := func(ctx context.Context, req ListFeaturesRequest) (*ListFeaturesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListFeatures(ctx, req) + } + getItems := func(resp *ListFeaturesResponse) []Feature { + return resp.Features + } + getNextReq := func(resp *ListFeaturesResponse) *ListFeaturesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List Features. +func (a *featureEngineeringImpl) ListFeaturesAll(ctx context.Context, request ListFeaturesRequest) ([]Feature, error) { + iterator := a.ListFeatures(ctx, request) + return listing.ToSlice[Feature](ctx, iterator) +} + +func (a *featureEngineeringImpl) internalListFeatures(ctx context.Context, request ListFeaturesRequest) (*ListFeaturesResponse, error) { + var listFeaturesResponse ListFeaturesResponse + path := "/api/2.0/feature-engineering/features" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFeaturesResponse) + return &listFeaturesResponse, err +} + +func (a *featureEngineeringImpl) UpdateFeature(ctx context.Context, request UpdateFeatureRequest) (*Feature, error) { + var feature Feature + path := fmt.Sprintf("/api/2.0/feature-engineering/features/%v", request.FullName) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Feature, &feature) + return &feature, err +} + // unexported type that holds implementations of just FeatureStore API methods type featureStoreImpl struct { client *client.DatabricksClient @@ -678,6 +779,7 @@ func (a *featureStoreImpl) UpdateOnlineStore(ctx context.Context, request Update var onlineStore OnlineStore path := fmt.Sprintf("/api/2.0/feature-store/online-stores/%v", request.Name) queryParams := make(map[string]any) + if request.UpdateMask != "" { queryParams["update_mask"] = request.UpdateMask } @@ -804,6 +906,7 @@ func (a *materializedFeaturesImpl) UpdateFeatureTag(ctx context.Context, request var featureTag FeatureTag path := fmt.Sprintf("/api/2.0/feature-store/feature-tables/%v/features/%v/tags/%v", request.TableName, request.FeatureName, request.Key) queryParams := make(map[string]any) + if request.UpdateMask != "" || slices.Contains(request.ForceSendFields, "UpdateMask") { queryParams["update_mask"] = request.UpdateMask } diff --git a/service/ml/interface.go b/service/ml/interface.go index 4a1df9dcb..c4e11d32d 100755 --- a/service/ml/interface.go +++ b/service/ml/interface.go @@ -85,6 +85,9 @@ type ExperimentsService interface { // Get a logged model. GetLoggedModel(ctx context.Context, request GetLoggedModelRequest) (*GetLoggedModelResponse, error) + // Batch endpoint for getting logged models from a list of model IDs + GetLoggedModels(ctx context.Context, request GetLoggedModelsRequest) (*GetLoggedModelsRequestResponse, error) + // Gets the permission levels that a user can have on an object. GetPermissionLevels(ctx context.Context, request GetExperimentPermissionLevelsRequest) (*GetExperimentPermissionLevelsResponse, error) @@ -252,6 +255,27 @@ type ExperimentsService interface { UpdateRun(ctx context.Context, request UpdateRun) (*UpdateRunResponse, error) } +// [description] +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type FeatureEngineeringService interface { + + // Create a Feature. + CreateFeature(ctx context.Context, request CreateFeatureRequest) (*Feature, error) + + // Delete a Feature. + DeleteFeature(ctx context.Context, request DeleteFeatureRequest) error + + // Get a Feature. + GetFeature(ctx context.Context, request GetFeatureRequest) (*Feature, error) + + // List Features. + ListFeatures(ctx context.Context, request ListFeaturesRequest) (*ListFeaturesResponse, error) + + // Update a Feature. + UpdateFeature(ctx context.Context, request UpdateFeatureRequest) (*Feature, error) +} + // A feature store is a centralized repository that enables data scientists to // find and share features. Using a feature store also ensures that the code // used to compute feature values is the same during model training and when the diff --git a/service/ml/model.go b/service/ml/model.go index 48020df24..aac1cac41 100755 --- a/service/ml/model.go +++ b/service/ml/model.go @@ -385,6 +385,11 @@ func (s CreateExperimentResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateFeatureRequest struct { + // Feature to create. + Feature Feature `json:"feature"` +} + type CreateFeatureTagRequest struct { FeatureName string `json:"-" url:"-"` @@ -707,6 +712,10 @@ type CreateWebhookResponse struct { Webhook *RegistryWebhook `json:"webhook,omitempty"` } +type DataSource struct { + DeltaTableSource *DeltaTableSource `json:"delta_table_source,omitempty"` +} + // Dataset. Represents a reference to data used for training, testing, or // evaluation during the model development process. type Dataset struct { @@ -761,6 +770,11 @@ type DeleteExperiment struct { ExperimentId string `json:"experiment_id"` } +type DeleteFeatureRequest struct { + // Name of the feature to delete. + FullName string `json:"-" url:"-"` +} + type DeleteFeatureTagRequest struct { // The name of the feature within the feature table. FeatureName string `json:"-" url:"-"` @@ -909,6 +923,15 @@ type DeleteWebhookRequest struct { Id string `json:"-" url:"id"` } +type DeltaTableSource struct { + // The entity columns of the Delta table. + EntityColumns []string `json:"entity_columns"` + // The full three-part (catalog, schema, table) name of the Delta table. + FullName string `json:"full_name"` + // The timeseries column of the Delta table. + TimeseriesColumn string `json:"timeseries_column"` +} + // An experiment and its metadata. type Experiment struct { // Location where artifacts for the experiment are stored. @@ -1099,14 +1122,19 @@ func (s ExperimentTag) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Feature for model version. type Feature struct { - // Feature name - FeatureName string `json:"feature_name,omitempty"` - // Feature table id - FeatureTableId string `json:"feature_table_id,omitempty"` - // Feature table name - FeatureTableName string `json:"feature_table_name,omitempty"` + // The description of the feature. + Description string `json:"description,omitempty"` + // The full three-part name (catalog, schema, name) of the feature. + FullName string `json:"full_name"` + // The function by which the feature is computed. + Function Function `json:"function"` + // The input columns from which the feature is computed. + Inputs []string `json:"inputs"` + // The data source of the feature. + Source DataSource `json:"source"` + // The time window in which the feature is computed. + TimeWindow TimeWindow `json:"time_window"` ForceSendFields []string `json:"-" url:"-"` } @@ -1179,7 +1207,7 @@ func (s FeatureLineageOnlineFeature) MarshalJSON() ([]byte, error) { // Feature list wrap all the features for a model version type FeatureList struct { - Features []Feature `json:"features,omitempty"` + Features []LinkedFeature `json:"features,omitempty"` } // Represents a tag on a feature in a feature table. @@ -1300,6 +1328,90 @@ func (f *ForecastingExperimentState) Type() string { return "ForecastingExperimentState" } +type Function struct { + // Extra parameters for parameterized functions. + ExtraParameters []FunctionExtraParameter `json:"extra_parameters,omitempty"` + // The type of the function. + FunctionType FunctionFunctionType `json:"function_type"` +} + +type FunctionExtraParameter struct { + // The name of the parameter. + Key string `json:"key"` + // The value of the parameter. + Value string `json:"value"` +} + +type FunctionFunctionType string + +const FunctionFunctionTypeApproxCountDistinct FunctionFunctionType = `APPROX_COUNT_DISTINCT` + +const FunctionFunctionTypeApproxPercentile FunctionFunctionType = `APPROX_PERCENTILE` + +const FunctionFunctionTypeAvg FunctionFunctionType = `AVG` + +const FunctionFunctionTypeCount FunctionFunctionType = `COUNT` + +const FunctionFunctionTypeFirst FunctionFunctionType = `FIRST` + +const FunctionFunctionTypeLast FunctionFunctionType = `LAST` + +const FunctionFunctionTypeMax FunctionFunctionType = `MAX` + +const FunctionFunctionTypeMin FunctionFunctionType = `MIN` + +const FunctionFunctionTypeStddevPop FunctionFunctionType = `STDDEV_POP` + +const FunctionFunctionTypeStddevSamp FunctionFunctionType = `STDDEV_SAMP` + +const FunctionFunctionTypeSum FunctionFunctionType = `SUM` + +const FunctionFunctionTypeVarPop FunctionFunctionType = `VAR_POP` + +const FunctionFunctionTypeVarSamp FunctionFunctionType = `VAR_SAMP` + +// String representation for [fmt.Print] +func (f *FunctionFunctionType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *FunctionFunctionType) Set(v string) error { + switch v { + case `APPROX_COUNT_DISTINCT`, `APPROX_PERCENTILE`, `AVG`, `COUNT`, `FIRST`, `LAST`, `MAX`, `MIN`, `STDDEV_POP`, `STDDEV_SAMP`, `SUM`, `VAR_POP`, `VAR_SAMP`: + *f = FunctionFunctionType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "APPROX_COUNT_DISTINCT", "APPROX_PERCENTILE", "AVG", "COUNT", "FIRST", "LAST", "MAX", "MIN", "STDDEV_POP", "STDDEV_SAMP", "SUM", "VAR_POP", "VAR_SAMP"`, v) + } +} + +// Values returns all possible values for FunctionFunctionType. +// +// There is no guarantee on the order of the values in the slice. +func (f *FunctionFunctionType) Values() []FunctionFunctionType { + return []FunctionFunctionType{ + FunctionFunctionTypeApproxCountDistinct, + FunctionFunctionTypeApproxPercentile, + FunctionFunctionTypeAvg, + FunctionFunctionTypeCount, + FunctionFunctionTypeFirst, + FunctionFunctionTypeLast, + FunctionFunctionTypeMax, + FunctionFunctionTypeMin, + FunctionFunctionTypeStddevPop, + FunctionFunctionTypeStddevSamp, + FunctionFunctionTypeSum, + FunctionFunctionTypeVarPop, + FunctionFunctionTypeVarSamp, + } +} + +// Type always returns FunctionFunctionType to satisfy [pflag.Value] interface +func (f *FunctionFunctionType) Type() string { + return "FunctionFunctionType" +} + type GetByNameRequest struct { // Name of the associated experiment. ExperimentName string `json:"-" url:"experiment_name"` @@ -1342,6 +1454,11 @@ type GetFeatureLineageRequest struct { TableName string `json:"-" url:"-"` } +type GetFeatureRequest struct { + // Name of the feature to get. + FullName string `json:"-" url:"-"` +} + type GetFeatureTagRequest struct { FeatureName string `json:"-" url:"-"` @@ -1405,6 +1522,16 @@ type GetLoggedModelResponse struct { Model *LoggedModel `json:"model,omitempty"` } +type GetLoggedModelsRequest struct { + // The IDs of the logged models to retrieve. Max threshold is 100. + ModelIds []string `json:"-" url:"model_ids,omitempty"` +} + +type GetLoggedModelsRequestResponse struct { + // The retrieved logged models. + Models []LoggedModel `json:"models,omitempty"` +} + type GetMetricHistoryResponse struct { // All logged values for this metric if `max_results` is not specified in // the request or if the total count of metrics returned is less than the @@ -1616,6 +1743,26 @@ func (s JobSpecWithoutSecret) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Feature for model version. ([ML-57150] Renamed from Feature to LinkedFeature) +type LinkedFeature struct { + // Feature name + FeatureName string `json:"feature_name,omitempty"` + // Feature table id + FeatureTableId string `json:"feature_table_id,omitempty"` + // Feature table name + FeatureTableName string `json:"feature_table_name,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *LinkedFeature) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s LinkedFeature) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListArtifactsRequest struct { // The token indicating the page of artifact results to fetch. `page_token` // is not supported when listing artifacts in UC Volumes. A maximum of 1000 @@ -1743,6 +1890,40 @@ func (s ListFeatureTagsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListFeaturesRequest struct { + // The maximum number of results to return. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page based on a previous query. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListFeaturesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListFeaturesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListFeaturesResponse struct { + // List of features. + Features []Feature `json:"features,omitempty"` + // Pagination token to request the next page of results for this query. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListFeaturesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListFeaturesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListModelsRequest struct { // Maximum number of registered models desired. Max threshold is 1000. MaxResults int64 `json:"-" url:"max_results,omitempty"` @@ -3721,6 +3902,23 @@ func (s TestRegistryWebhookResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type TimeWindow struct { + // The duration of the time window. + Duration string `json:"duration"` + // The offset of the time window. + Offset string `json:"offset,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *TimeWindow) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s TimeWindow) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Details required to transition a model version's stage. type TransitionModelVersionStageDatabricks struct { // Specifies whether to archive all current model versions in the target @@ -3826,6 +4024,15 @@ func (s UpdateExperiment) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateFeatureRequest struct { + // Feature to update. + Feature Feature `json:"feature"` + // The full three-part name (catalog, schema, name) of the feature. + FullName string `json:"-" url:"-"` + // The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateFeatureTagRequest struct { FeatureName string `json:"-" url:"-"` diff --git a/service/oauth2/impl.go b/service/oauth2/impl.go index 0adf12013..7d3ebe096 100755 --- a/service/oauth2/impl.go +++ b/service/oauth2/impl.go @@ -22,6 +22,7 @@ func (a *accountFederationPolicyImpl) Create(ctx context.Context, request Create var federationPolicy FederationPolicy path := fmt.Sprintf("/api/2.0/accounts/%v/federationPolicies", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) + if request.PolicyId != "" || slices.Contains(request.ForceSendFields, "PolicyId") { queryParams["policy_id"] = request.PolicyId } @@ -96,6 +97,7 @@ func (a *accountFederationPolicyImpl) Update(ctx context.Context, request Update var federationPolicy FederationPolicy path := fmt.Sprintf("/api/2.0/accounts/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), request.PolicyId) queryParams := make(map[string]any) + if request.UpdateMask != "" || slices.Contains(request.ForceSendFields, "UpdateMask") { queryParams["update_mask"] = request.UpdateMask } @@ -337,6 +339,7 @@ func (a *servicePrincipalFederationPolicyImpl) Create(ctx context.Context, reque var federationPolicy FederationPolicy path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies", a.client.ConfiguredAccountID(), request.ServicePrincipalId) queryParams := make(map[string]any) + if request.PolicyId != "" || slices.Contains(request.ForceSendFields, "PolicyId") { queryParams["policy_id"] = request.PolicyId } @@ -411,6 +414,7 @@ func (a *servicePrincipalFederationPolicyImpl) Update(ctx context.Context, reque var federationPolicy FederationPolicy path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), request.ServicePrincipalId, request.PolicyId) queryParams := make(map[string]any) + if request.UpdateMask != "" || slices.Contains(request.ForceSendFields, "UpdateMask") { queryParams["update_mask"] = request.UpdateMask } diff --git a/service/oauth2/model.go b/service/oauth2/model.go index 01e91fb1f..15b8f6475 100755 --- a/service/oauth2/model.go +++ b/service/oauth2/model.go @@ -214,10 +214,10 @@ type FederationPolicy struct { Name string `json:"name,omitempty"` OidcPolicy *OidcFederationPolicy `json:"oidc_policy,omitempty"` - // The ID of the federation policy. + // The ID of the federation policy. Output only. PolicyId string `json:"policy_id,omitempty"` - // The service principal ID that this federation policy applies to. Only set - // for service principal federation policies. + // The service principal ID that this federation policy applies to. Output + // only. Only set for service principal federation policies. ServicePrincipalId int64 `json:"service_principal_id,omitempty"` // Unique, immutable id of the federation policy. Uid string `json:"uid,omitempty"` @@ -617,8 +617,13 @@ func (s SecretInfo) MarshalJSON() ([]byte, error) { } type TokenAccessPolicy struct { + // absolute OAuth session TTL in minutes when single-use refresh tokens are + // enabled + AbsoluteSessionLifetimeInMinutes int `json:"absolute_session_lifetime_in_minutes,omitempty"` // access token time to live in minutes AccessTokenTtlInMinutes int `json:"access_token_ttl_in_minutes,omitempty"` + // whether to enable single-use refresh tokens + EnableSingleUseRefreshTokens bool `json:"enable_single_use_refresh_tokens,omitempty"` // refresh token time to live in minutes RefreshTokenTtlInMinutes int `json:"refresh_token_ttl_in_minutes,omitempty"` diff --git a/service/pipelines/api.go b/service/pipelines/api.go index d843e562a..71bfd699b 100755 --- a/service/pipelines/api.go +++ b/service/pipelines/api.go @@ -33,6 +33,10 @@ type PipelinesInterface interface { WaitGetPipelineIdle(ctx context.Context, pipelineId string, timeout time.Duration, callback func(*GetPipelineResponse)) (*GetPipelineResponse, error) + // * Applies the current pipeline environment onto the pipeline compute. The + // environment applied can be used by subsequent dev-mode updates. + ApplyEnvironment(ctx context.Context, request ApplyEnvironmentRequest) (*ApplyEnvironmentRequestResponse, error) + // Creates a new data processing pipeline based on the requested configuration. // If successful, this method returns the ID of the new pipeline. Create(ctx context.Context, request CreatePipeline) (*CreatePipelineResponse, error) @@ -118,6 +122,10 @@ type PipelinesInterface interface { // List updates for an active pipeline. ListUpdatesByPipelineId(ctx context.Context, pipelineId string) (*ListUpdatesResponse, error) + // * Restores a pipeline that was previously deleted, if within the restoration + // window. All tables deleted at pipeline deletion will be undropped as well. + RestorePipeline(ctx context.Context, request RestorePipelineRequest) (*RestorePipelineRequestResponse, error) + // Sets permissions on an object, replacing existing permissions if they exist. // Deletes all direct permissions if none are specified. Objects can inherit // permissions from their root object. diff --git a/service/pipelines/impl.go b/service/pipelines/impl.go index 1147be7b8..fe3438e2a 100755 --- a/service/pipelines/impl.go +++ b/service/pipelines/impl.go @@ -17,6 +17,16 @@ type pipelinesImpl struct { client *client.DatabricksClient } +func (a *pipelinesImpl) ApplyEnvironment(ctx context.Context, request ApplyEnvironmentRequest) (*ApplyEnvironmentRequestResponse, error) { + var applyEnvironmentRequestResponse ApplyEnvironmentRequestResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v/environment/apply", request.PipelineId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &applyEnvironmentRequestResponse) + return &applyEnvironmentRequestResponse, err +} + func (a *pipelinesImpl) Create(ctx context.Context, request CreatePipeline) (*CreatePipelineResponse, error) { var createPipelineResponse CreatePipelineResponse path := "/api/2.0/pipelines" @@ -169,6 +179,16 @@ func (a *pipelinesImpl) ListUpdates(ctx context.Context, request ListUpdatesRequ return &listUpdatesResponse, err } +func (a *pipelinesImpl) RestorePipeline(ctx context.Context, request RestorePipelineRequest) (*RestorePipelineRequestResponse, error) { + var restorePipelineRequestResponse RestorePipelineRequestResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v/restore", request.PipelineId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &restorePipelineRequestResponse) + return &restorePipelineRequestResponse, err +} + func (a *pipelinesImpl) SetPermissions(ctx context.Context, request PipelinePermissionsRequest) (*PipelinePermissions, error) { var pipelinePermissions PipelinePermissions path := fmt.Sprintf("/api/2.0/permissions/pipelines/%v", request.PipelineId) diff --git a/service/pipelines/interface.go b/service/pipelines/interface.go index 31816b10d..961f3780f 100755 --- a/service/pipelines/interface.go +++ b/service/pipelines/interface.go @@ -24,6 +24,10 @@ import ( // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. type PipelinesService interface { + // * Applies the current pipeline environment onto the pipeline compute. The + // environment applied can be used by subsequent dev-mode updates. + ApplyEnvironment(ctx context.Context, request ApplyEnvironmentRequest) (*ApplyEnvironmentRequestResponse, error) + // Creates a new data processing pipeline based on the requested // configuration. If successful, this method returns the ID of the new // pipeline. @@ -55,6 +59,11 @@ type PipelinesService interface { // List updates for an active pipeline. ListUpdates(ctx context.Context, request ListUpdatesRequest) (*ListUpdatesResponse, error) + // * Restores a pipeline that was previously deleted, if within the + // restoration window. All tables deleted at pipeline deletion will be + // undropped as well. + RestorePipeline(ctx context.Context, request RestorePipelineRequest) (*RestorePipelineRequestResponse, error) + // Sets permissions on an object, replacing existing permissions if they // exist. Deletes all direct permissions if none are specified. Objects can // inherit permissions from their root object. diff --git a/service/pipelines/model.go b/service/pipelines/model.go index 34b17d54c..602abba23 100755 --- a/service/pipelines/model.go +++ b/service/pipelines/model.go @@ -9,6 +9,31 @@ import ( "github.com/databricks/databricks-sdk-go/service/compute" ) +type ApplyEnvironmentRequest struct { + PipelineId string `json:"-" url:"-"` +} + +type ApplyEnvironmentRequestResponse struct { +} + +type ConnectionParameters struct { + // Source catalog for initial connection. This is necessary for schema + // exploration in some database systems like Oracle, and optional but + // nice-to-have in some other database systems like Postgres. For Oracle + // databases, this maps to a service name. + SourceCatalog string `json:"source_catalog,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ConnectionParameters) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ConnectionParameters) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type CreatePipeline struct { // If false, deployment will fail if name conflicts with that of another // pipeline. @@ -83,6 +108,8 @@ type CreatePipeline struct { Target string `json:"target,omitempty"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. Trigger *PipelineTrigger `json:"trigger,omitempty"` + // Usage policy of this pipeline. + UsagePolicyId string `json:"usage_policy_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -319,6 +346,8 @@ type EditPipeline struct { Target string `json:"target,omitempty"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. Trigger *PipelineTrigger `json:"trigger,omitempty"` + // Usage policy of this pipeline. + UsagePolicyId string `json:"usage_policy_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -462,6 +491,8 @@ type GetPipelineResponse struct { CreatorUserName string `json:"creator_user_name,omitempty"` // Serverless budget policy ID of this pipeline. EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + // Serverless usage policy ID of the pipeline. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The health of a pipeline. Health GetPipelineResponseHealth `json:"health,omitempty"` // The last time the pipeline settings were modified or created. @@ -564,6 +595,9 @@ type IngestionGatewayPipelineDefinition struct { // Immutable. The Unity Catalog connection that this gateway pipeline uses // to communicate with the source. ConnectionName string `json:"connection_name"` + // Optional, Internal. Parameters required to establish an initial + // connection with the source. + ConnectionParameters *ConnectionParameters `json:"connection_parameters,omitempty"` // Required, Immutable. The name of the catalog for the gateway pipeline's // storage location. GatewayStorageCatalog string `json:"gateway_storage_catalog"` @@ -592,13 +626,25 @@ type IngestionPipelineDefinition struct { // to communicate with the source. This is used with connectors for // applications like Salesforce, Workday, and so on. ConnectionName string `json:"connection_name,omitempty"` + // Immutable. If set to true, the pipeline will ingest tables from the UC + // foreign catalogs directly without the need to specify a UC connection or + // ingestion gateway. The `source_catalog` fields in objects of + // IngestionConfig are interpreted as the UC foreign catalogs to ingest + // from. + IngestFromUcForeignCatalog bool `json:"ingest_from_uc_foreign_catalog,omitempty"` // Immutable. Identifier for the gateway that is used by this ingestion // pipeline to communicate with the source database. This is used with // connectors to databases like SQL Server. IngestionGatewayId string `json:"ingestion_gateway_id,omitempty"` + // Netsuite only configuration. When the field is set for a netsuite + // connector, the jar stored in the field will be validated and added to the + // classpath of pipeline's cluster. + NetsuiteJarPath string `json:"netsuite_jar_path,omitempty"` // Required. Settings specifying tables to replicate and the destination for // the replicated tables. Objects []IngestionConfig `json:"objects,omitempty"` + // Top-level source configurations + SourceConfigurations []SourceConfig `json:"source_configurations,omitempty"` // The type of the foreign source. The source type will be inferred from the // source connection or ingestion gateway. This field is output only and // will be ignored if provided. @@ -657,6 +703,54 @@ func (s IngestionPipelineDefinitionTableSpecificConfigQueryBasedConnectorConfig) return marshal.Marshal(s) } +type IngestionPipelineDefinitionWorkdayReportParameters struct { + // (Optional) Marks the report as incremental. This field is deprecated and + // should not be used. Use `parameters` instead. The incremental behavior is + // now controlled by the `parameters` field. + Incremental bool `json:"incremental,omitempty"` + // Parameters for the Workday report. Each key represents the parameter name + // (e.g., "start_date", "end_date"), and the corresponding value is a + // SQL-like expression used to compute the parameter value at runtime. + // Example: { "start_date": "{ coalesce(current_offset(), + // date(\"2025-02-01\")) }", "end_date": "{ current_date() - INTERVAL 1 DAY + // }" } + Parameters map[string]string `json:"parameters,omitempty"` + // (Optional) Additional custom parameters for Workday Report This field is + // deprecated and should not be used. Use `parameters` instead. + ReportParameters []IngestionPipelineDefinitionWorkdayReportParametersQueryKeyValue `json:"report_parameters,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *IngestionPipelineDefinitionWorkdayReportParameters) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s IngestionPipelineDefinitionWorkdayReportParameters) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type IngestionPipelineDefinitionWorkdayReportParametersQueryKeyValue struct { + // Key for the report parameter, can be a column name or other metadata + Key string `json:"key,omitempty"` + // Value for the report parameter. Possible values it can take are these sql + // functions: 1. coalesce(current_offset(), date("YYYY-MM-DD")) -> if + // current_offset() is null, then the passed date, else current_offset() 2. + // current_date() 3. date_sub(current_date(), x) -> subtract x (some + // non-negative integer) days from current date + Value string `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *IngestionPipelineDefinitionWorkdayReportParametersQueryKeyValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s IngestionPipelineDefinitionWorkdayReportParametersQueryKeyValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type IngestionSourceType string const IngestionSourceTypeBigquery IngestionSourceType = `BIGQUERY` @@ -665,6 +759,8 @@ const IngestionSourceTypeConfluence IngestionSourceType = `CONFLUENCE` const IngestionSourceTypeDynamics365 IngestionSourceType = `DYNAMICS365` +const IngestionSourceTypeForeignCatalog IngestionSourceType = `FOREIGN_CATALOG` + const IngestionSourceTypeGa4RawData IngestionSourceType = `GA4_RAW_DATA` const IngestionSourceTypeManagedPostgresql IngestionSourceType = `MANAGED_POSTGRESQL` @@ -703,11 +799,11 @@ func (f *IngestionSourceType) String() string { // Set raw string value and validate it against allowed values func (f *IngestionSourceType) Set(v string) error { switch v { - case `BIGQUERY`, `CONFLUENCE`, `DYNAMICS365`, `GA4_RAW_DATA`, `MANAGED_POSTGRESQL`, `META_MARKETING`, `MYSQL`, `NETSUITE`, `ORACLE`, `POSTGRESQL`, `REDSHIFT`, `SALESFORCE`, `SERVICENOW`, `SHAREPOINT`, `SQLDW`, `SQLSERVER`, `TERADATA`, `WORKDAY_RAAS`: + case `BIGQUERY`, `CONFLUENCE`, `DYNAMICS365`, `FOREIGN_CATALOG`, `GA4_RAW_DATA`, `MANAGED_POSTGRESQL`, `META_MARKETING`, `MYSQL`, `NETSUITE`, `ORACLE`, `POSTGRESQL`, `REDSHIFT`, `SALESFORCE`, `SERVICENOW`, `SHAREPOINT`, `SQLDW`, `SQLSERVER`, `TERADATA`, `WORKDAY_RAAS`: *f = IngestionSourceType(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "BIGQUERY", "CONFLUENCE", "DYNAMICS365", "GA4_RAW_DATA", "MANAGED_POSTGRESQL", "META_MARKETING", "MYSQL", "NETSUITE", "ORACLE", "POSTGRESQL", "REDSHIFT", "SALESFORCE", "SERVICENOW", "SHAREPOINT", "SQLDW", "SQLSERVER", "TERADATA", "WORKDAY_RAAS"`, v) + return fmt.Errorf(`value "%s" is not one of "BIGQUERY", "CONFLUENCE", "DYNAMICS365", "FOREIGN_CATALOG", "GA4_RAW_DATA", "MANAGED_POSTGRESQL", "META_MARKETING", "MYSQL", "NETSUITE", "ORACLE", "POSTGRESQL", "REDSHIFT", "SALESFORCE", "SERVICENOW", "SHAREPOINT", "SQLDW", "SQLSERVER", "TERADATA", "WORKDAY_RAAS"`, v) } } @@ -719,6 +815,7 @@ func (f *IngestionSourceType) Values() []IngestionSourceType { IngestionSourceTypeBigquery, IngestionSourceTypeConfluence, IngestionSourceTypeDynamics365, + IngestionSourceTypeForeignCatalog, IngestionSourceTypeGa4RawData, IngestionSourceTypeManagedPostgresql, IngestionSourceTypeMetaMarketing, @@ -1480,6 +1577,8 @@ type PipelineSpec struct { Target string `json:"target,omitempty"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. Trigger *PipelineTrigger `json:"trigger,omitempty"` + // Usage policy of this pipeline. + UsagePolicyId string `json:"usage_policy_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -1639,6 +1738,31 @@ type PipelinesEnvironment struct { Dependencies []string `json:"dependencies,omitempty"` } +// PG-specific catalog-level configuration parameters +type PostgresCatalogConfig struct { + // Optional. The Postgres slot configuration to use for logical replication + SlotConfig *PostgresSlotConfig `json:"slot_config,omitempty"` +} + +// PostgresSlotConfig contains the configuration for a Postgres logical +// replication slot +type PostgresSlotConfig struct { + // The name of the publication to use for the Postgres source + PublicationName string `json:"publication_name,omitempty"` + // The name of the logical replication slot to use for the Postgres source + SlotName string `json:"slot_name,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *PostgresSlotConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s PostgresSlotConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ReportSpec struct { // Required. Destination catalog to store table. DestinationCatalog string `json:"destination_catalog"` @@ -1690,6 +1814,14 @@ func (s RestartWindow) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type RestorePipelineRequest struct { + // The ID of the pipeline to restore + PipelineId string `json:"-" url:"-"` +} + +type RestorePipelineRequestResponse struct { +} + // Write-only setting, available only in Create/Update calls. Specifies the user // or service principal that the pipeline runs as. If not specified, the // pipeline runs as the user who created the pipeline. @@ -1779,6 +1911,30 @@ func (s SerializedException) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// SourceCatalogConfig contains catalog-level custom configuration parameters +// for each source +type SourceCatalogConfig struct { + // Postgres-specific catalog-level configuration parameters + Postgres *PostgresCatalogConfig `json:"postgres,omitempty"` + // Source catalog name + SourceCatalog string `json:"source_catalog,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *SourceCatalogConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s SourceCatalogConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type SourceConfig struct { + // Catalog-level source configuration parameters + Catalog *SourceCatalogConfig `json:"catalog,omitempty"` +} + type StackFrame struct { // Class from which the method call originated DeclaringClass string `json:"declaring_class,omitempty"` @@ -1950,6 +2106,10 @@ type TableSpecificConfig struct { PrimaryKeys []string `json:"primary_keys,omitempty"` QueryBasedConnectorConfig *IngestionPipelineDefinitionTableSpecificConfigQueryBasedConnectorConfig `json:"query_based_connector_config,omitempty"` + // (Optional, Immutable) The row filter condition to be applied to the + // table. It must not contain the WHERE keyword, only the actual filter + // condition. It must be in DBSQL format. + RowFilter string `json:"row_filter,omitempty"` // If true, formula fields defined in the table are included in the // ingestion. This setting is only valid for the Salesforce connector SalesforceIncludeFormulaFields bool `json:"salesforce_include_formula_fields,omitempty"` @@ -1959,6 +2119,8 @@ type TableSpecificConfig struct { // data. Delta Live Tables uses this sequencing to handle change events that // arrive out of order. SequenceBy []string `json:"sequence_by,omitempty"` + // (Optional) Additional custom parameters for Workday Report + WorkdayReportParameters *IngestionPipelineDefinitionWorkdayReportParameters `json:"workday_report_parameters,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -2029,6 +2191,9 @@ type UpdateInfo struct { // Refresh on a table means that the states of the table will be reset // before the refresh. FullRefreshSelection []string `json:"full_refresh_selection,omitempty"` + // Indicates whether the update is either part of a continuous job run, or + // running in legacy continuous pipeline mode. + Mode UpdateMode `json:"mode,omitempty"` // The ID of the pipeline. PipelineId string `json:"pipeline_id,omitempty"` // A list of tables to update without fullRefresh. If both refresh_selection @@ -2173,6 +2338,43 @@ func (f *UpdateInfoState) Type() string { return "UpdateInfoState" } +type UpdateMode string + +const UpdateModeContinuous UpdateMode = `CONTINUOUS` + +const UpdateModeDefault UpdateMode = `DEFAULT` + +// String representation for [fmt.Print] +func (f *UpdateMode) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *UpdateMode) Set(v string) error { + switch v { + case `CONTINUOUS`, `DEFAULT`: + *f = UpdateMode(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CONTINUOUS", "DEFAULT"`, v) + } +} + +// Values returns all possible values for UpdateMode. +// +// There is no guarantee on the order of the values in the slice. +func (f *UpdateMode) Values() []UpdateMode { + return []UpdateMode{ + UpdateModeContinuous, + UpdateModeDefault, + } +} + +// Type always returns UpdateMode to satisfy [pflag.Value] interface +func (f *UpdateMode) Type() string { + return "UpdateMode" +} + type UpdateStateInfo struct { CreationTime string `json:"creation_time,omitempty"` diff --git a/service/pkg.go b/service/pkg.go index 975b8fd71..8dabc0a0c 100644 --- a/service/pkg.go +++ b/service/pkg.go @@ -20,6 +20,8 @@ // // - [apps.AppsAPI]: Apps run directly on a customer’s Databricks instance, integrate with their data, use and extend Databricks services, and enable users to interact through single sign-on. // +// - [apps.AppsSettingsAPI]: Apps Settings manage the settings for the Apps service on a customer's Databricks instance. +// // - [catalog.ArtifactAllowlistsAPI]: In Databricks Runtime 13.3 and above, you can add libraries and init scripts to the `allowlist` in UC so that users can leverage these artifacts on compute configured with shared access mode. // // - [settings.AutomaticClusterUpdateAPI]: Controls whether automatic cluster update is enabled for the current workspace. @@ -84,6 +86,8 @@ // // - [database.DatabaseAPI]: Database Instances provide access to a database via REST API or direct SQL. // +// - [database.DatabaseProjectAPI]: Database Projects provide access to a database via REST API or direct SQL. +// // - [files.DbfsAPI]: DBFS API makes it simple to interact with various data sources without having to include a users credentials every time to read a file. // // - [sql.DbsqlPermissionsAPI]: The SQL Permissions API is similar to the endpoints of the :method:permissions/set. @@ -110,6 +114,8 @@ // // - [settings.EnhancedSecurityMonitoringAPI]: Controls whether enhanced security monitoring is enabled for the current workspace. // +// - [catalog.EntityTagAssignmentsAPI]: Tags are attributes that include keys and optional values that you can use to organize and categorize entities in Unity Catalog. +// // - [settings.EsmEnablementAccountAPI]: The enhanced security monitoring setting at the account level controls whether to enable the feature on new workspaces. // // - [ml.ExperimentsAPI]: Experiments are the primary unit of organization in MLflow; all MLflow runs belong to an experiment. @@ -120,6 +126,8 @@ // // - [catalog.ExternalMetadataAPI]: External Metadata objects enable customers to register and manage metadata about external systems within Unity Catalog. // +// - [ml.FeatureEngineeringAPI]: [description]. +// // - [ml.FeatureStoreAPI]: A feature store is a centralized repository that enables data scientists to find and share features. // // - [oauth2.AccountFederationPolicyAPI]: These APIs manage account federation policies. @@ -138,9 +146,11 @@ // // - [catalog.GrantsAPI]: In Unity Catalog, data is secure by default. // -// - [iam.GroupsAPI]: Groups simplify identity management, making it easier to assign access to Databricks workspace, data, and other securable objects. +// - [iam.GroupsV2API]: Groups simplify identity management, making it easier to assign access to Databricks workspace, data, and other securable objects. // -// - [iam.AccountGroupsAPI]: Groups simplify identity management, making it easier to assign access to Databricks account, data, and other securable objects. +// - [iam.AccountGroupsV2API]: Groups simplify identity management, making it easier to assign access to Databricks account, data, and other securable objects. +// +// - [iamv2.AccountIamV2API]: These APIs are used to manage identities and the workspace access of these identities in . // // - [compute.InstancePoolsAPI]: Instance Pools API are used to create, edit, delete and list instance pools by using ready-to-use cloud instances which reduces a cluster start and auto-scaling times. // @@ -234,6 +244,8 @@ // // - [sql.QueriesLegacyAPI]: These endpoints are used for CRUD operations on query definitions. // +// - [dashboards.QueryExecutionAPI]: Query execution APIs for AI / BI Dashboards. +// // - [sql.QueryHistoryAPI]: A service responsible for storing and retrieving the list of queries run against SQL endpoints and serverless compute. // // - [sql.QueryVisualizationsAPI]: This is an evolving API that facilitates the addition and removal of visualizations from existing queries in the Databricks Workspace. @@ -256,6 +268,8 @@ // // - [settings.RestrictWorkspaceAdminsAPI]: The Restrict Workspace Admins setting lets you control the capabilities of workspace admins. // +// - [catalog.RfaAPI]: Request for Access enables customers to request access to and manage access request destinations for Unity Catalog securables. +// // - [catalog.SchemasAPI]: A schema (also called a database) is the second layer of Unity Catalog’s three-level namespace. // // - [workspace.SecretsAPI]: The Secrets API allows you to manage secrets, secret scopes, and access permissions. @@ -266,9 +280,9 @@ // // - [oauth2.ServicePrincipalSecretsProxyAPI]: These APIs enable administrators to manage service principal secrets at the workspace level. // -// - [iam.ServicePrincipalsAPI]: Identities for use with jobs, automated tools, and systems such as scripts, apps, and CI/CD platforms. +// - [iam.ServicePrincipalsV2API]: Identities for use with jobs, automated tools, and systems such as scripts, apps, and CI/CD platforms. // -// - [iam.AccountServicePrincipalsAPI]: Identities for use with jobs, automated tools, and systems such as scripts, apps, and CI/CD platforms. +// - [iam.AccountServicePrincipalsV2API]: Identities for use with jobs, automated tools, and systems such as scripts, apps, and CI/CD platforms. // // - [serving.ServingEndpointsAPI]: The Serving Endpoints API allows you to create, update, and delete model serving endpoints. // @@ -278,6 +292,8 @@ // // - [settings.AccountSettingsAPI]: Accounts Settings API allows users to manage settings at the account level. // +// - [settingsv2.AccountSettingsV2API]: APIs to manage account level settings. +// // - [sharing.SharesAPI]: A share is a container instantiated with :method:shares/create. // // - [settings.SqlResultsDownloadAPI]: Controls whether users within the workspace are allowed to download results from the SQL Editor and AI/BI Dashboards UIs. @@ -296,6 +312,10 @@ // // - [catalog.TablesAPI]: A table resides in the third layer of Unity Catalog’s three-level namespace. // +// - [tags.TagAssignmentsAPI]: Manage tag assignments on workspace-scoped objects. +// +// - [tags.TagPoliciesAPI]: The Tag Policy API allows you to manage policies for governed tags in Databricks. +// // - [catalog.TemporaryPathCredentialsAPI]: Temporary Path Credentials refer to short-lived, downscoped credentials used to access external cloud storage locations registered in Databricks. // // - [catalog.TemporaryTableCredentialsAPI]: Temporary Table Credentials refer to short-lived, downscoped credentials used to access cloud storage locations where table data is stored in Databricks. @@ -306,9 +326,9 @@ // // - [billing.UsageDashboardsAPI]: These APIs manage usage dashboards for this account. // -// - [iam.UsersAPI]: User identities recognized by Databricks and represented by email addresses. +// - [iam.UsersV2API]: User identities recognized by Databricks and represented by email addresses. // -// - [iam.AccountUsersAPI]: User identities recognized by Databricks and represented by email addresses. +// - [iam.AccountUsersV2API]: User identities recognized by Databricks and represented by email addresses. // // - [vectorsearch.VectorSearchEndpointsAPI]: **Endpoint**: Represents the compute resources to host vector search indexes. // @@ -328,8 +348,12 @@ // // - [settings.WorkspaceConfAPI]: This API allows updating known workspace settings for advanced users. // +// - [iamv2.WorkspaceIamV2API]: These APIs are used to manage identities and the workspace access of these identities in . +// // - [settings.WorkspaceNetworkConfigurationAPI]: These APIs allow configuration of network settings for Databricks workspaces by selecting which network policy to associate with the workspace. // +// - [settingsv2.WorkspaceSettingsV2API]: APIs to manage workspace level settings. +// // - [provisioning.WorkspacesAPI]: These APIs manage workspaces for this account. package service @@ -344,6 +368,7 @@ import ( "github.com/databricks/databricks-sdk-go/service/database" "github.com/databricks/databricks-sdk-go/service/files" "github.com/databricks/databricks-sdk-go/service/iam" + "github.com/databricks/databricks-sdk-go/service/iamv2" "github.com/databricks/databricks-sdk-go/service/jobs" "github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/ml" @@ -353,8 +378,10 @@ import ( "github.com/databricks/databricks-sdk-go/service/qualitymonitorv2" "github.com/databricks/databricks-sdk-go/service/serving" "github.com/databricks/databricks-sdk-go/service/settings" + "github.com/databricks/databricks-sdk-go/service/settingsv2" "github.com/databricks/databricks-sdk-go/service/sharing" "github.com/databricks/databricks-sdk-go/service/sql" + "github.com/databricks/databricks-sdk-go/service/tags" "github.com/databricks/databricks-sdk-go/service/vectorsearch" "github.com/databricks/databricks-sdk-go/service/workspace" ) @@ -374,6 +401,7 @@ var ( _ *sql.AlertsLegacyAPI = nil _ *sql.AlertsV2API = nil _ *apps.AppsAPI = nil + _ *apps.AppsSettingsAPI = nil _ *catalog.ArtifactAllowlistsAPI = nil _ *settings.AutomaticClusterUpdateAPI = nil _ *billing.BillableUsageAPI = nil @@ -395,8 +423,8 @@ var ( _ *marketplace.ConsumerListingsAPI = nil _ *marketplace.ConsumerPersonalizationRequestsAPI = nil _ *marketplace.ConsumerProvidersAPI = nil - _ *provisioning.CredentialsAPI = nil _ *catalog.CredentialsAPI = nil + _ *provisioning.CredentialsAPI = nil _ *settings.CredentialsManagerAPI = nil _ *settings.CspEnablementAccountAPI = nil _ *iam.CurrentUserAPI = nil @@ -406,6 +434,7 @@ var ( _ *sql.DashboardsAPI = nil _ *sql.DataSourcesAPI = nil _ *database.DatabaseAPI = nil + _ *database.DatabaseProjectAPI = nil _ *files.DbfsAPI = nil _ *sql.DbsqlPermissionsAPI = nil _ *settings.DefaultNamespaceAPI = nil @@ -419,11 +448,13 @@ var ( _ *settings.EnableResultsDownloadingAPI = nil _ *provisioning.EncryptionKeysAPI = nil _ *settings.EnhancedSecurityMonitoringAPI = nil + _ *catalog.EntityTagAssignmentsAPI = nil _ *settings.EsmEnablementAccountAPI = nil _ *ml.ExperimentsAPI = nil _ *catalog.ExternalLineageAPI = nil _ *catalog.ExternalLocationsAPI = nil _ *catalog.ExternalMetadataAPI = nil + _ *ml.FeatureEngineeringAPI = nil _ *ml.FeatureStoreAPI = nil _ *oauth2.AccountFederationPolicyAPI = nil _ *files.FilesAPI = nil @@ -433,8 +464,9 @@ var ( _ *workspace.GitCredentialsAPI = nil _ *compute.GlobalInitScriptsAPI = nil _ *catalog.GrantsAPI = nil - _ *iam.GroupsAPI = nil - _ *iam.AccountGroupsAPI = nil + _ *iam.GroupsV2API = nil + _ *iam.AccountGroupsV2API = nil + _ *iamv2.AccountIamV2API = nil _ *compute.InstancePoolsAPI = nil _ *compute.InstanceProfilesAPI = nil _ *settings.IpAccessListsAPI = nil @@ -481,6 +513,7 @@ var ( _ *catalog.QualityMonitorsAPI = nil _ *sql.QueriesAPI = nil _ *sql.QueriesLegacyAPI = nil + _ *dashboards.QueryExecutionAPI = nil _ *sql.QueryHistoryAPI = nil _ *sql.QueryVisualizationsAPI = nil _ *sql.QueryVisualizationsLegacyAPI = nil @@ -492,17 +525,19 @@ var ( _ *workspace.ReposAPI = nil _ *catalog.ResourceQuotasAPI = nil _ *settings.RestrictWorkspaceAdminsAPI = nil + _ *catalog.RfaAPI = nil _ *catalog.SchemasAPI = nil _ *workspace.SecretsAPI = nil _ *oauth2.ServicePrincipalFederationPolicyAPI = nil _ *oauth2.ServicePrincipalSecretsAPI = nil _ *oauth2.ServicePrincipalSecretsProxyAPI = nil - _ *iam.ServicePrincipalsAPI = nil - _ *iam.AccountServicePrincipalsAPI = nil + _ *iam.ServicePrincipalsV2API = nil + _ *iam.AccountServicePrincipalsV2API = nil _ *serving.ServingEndpointsAPI = nil _ *serving.ServingEndpointsDataPlaneAPI = nil _ *settings.SettingsAPI = nil _ *settings.AccountSettingsAPI = nil + _ *settingsv2.AccountSettingsV2API = nil _ *sharing.SharesAPI = nil _ *settings.SqlResultsDownloadAPI = nil _ *sql.StatementExecutionAPI = nil @@ -512,13 +547,15 @@ var ( _ *catalog.SystemSchemasAPI = nil _ *catalog.TableConstraintsAPI = nil _ *catalog.TablesAPI = nil + _ *tags.TagAssignmentsAPI = nil + _ *tags.TagPoliciesAPI = nil _ *catalog.TemporaryPathCredentialsAPI = nil _ *catalog.TemporaryTableCredentialsAPI = nil _ *settings.TokenManagementAPI = nil _ *settings.TokensAPI = nil _ *billing.UsageDashboardsAPI = nil - _ *iam.UsersAPI = nil - _ *iam.AccountUsersAPI = nil + _ *iam.UsersV2API = nil + _ *iam.AccountUsersV2API = nil _ *vectorsearch.VectorSearchEndpointsAPI = nil _ *vectorsearch.VectorSearchIndexesAPI = nil _ *catalog.VolumesAPI = nil @@ -528,6 +565,8 @@ var ( _ *iam.WorkspaceAssignmentAPI = nil _ *catalog.WorkspaceBindingsAPI = nil _ *settings.WorkspaceConfAPI = nil + _ *iamv2.WorkspaceIamV2API = nil _ *settings.WorkspaceNetworkConfigurationAPI = nil + _ *settingsv2.WorkspaceSettingsV2API = nil _ *provisioning.WorkspacesAPI = nil ) diff --git a/service/qualitymonitorv2/model.go b/service/qualitymonitorv2/model.go index b7a13ee2f..091dd0c82 100755 --- a/service/qualitymonitorv2/model.go +++ b/service/qualitymonitorv2/model.go @@ -9,6 +9,8 @@ import ( ) type AnomalyDetectionConfig struct { + // The type of the last run of the workflow. + JobType AnomalyDetectionJobType `json:"job_type,omitempty"` // Run id of the last run of the workflow LastRunId string `json:"last_run_id,omitempty"` // The status of the last run of the workflow. @@ -25,6 +27,43 @@ func (s AnomalyDetectionConfig) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type AnomalyDetectionJobType string + +const AnomalyDetectionJobTypeAnomalyDetectionJobTypeInternalHidden AnomalyDetectionJobType = `ANOMALY_DETECTION_JOB_TYPE_INTERNAL_HIDDEN` + +const AnomalyDetectionJobTypeAnomalyDetectionJobTypeNormal AnomalyDetectionJobType = `ANOMALY_DETECTION_JOB_TYPE_NORMAL` + +// String representation for [fmt.Print] +func (f *AnomalyDetectionJobType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AnomalyDetectionJobType) Set(v string) error { + switch v { + case `ANOMALY_DETECTION_JOB_TYPE_INTERNAL_HIDDEN`, `ANOMALY_DETECTION_JOB_TYPE_NORMAL`: + *f = AnomalyDetectionJobType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ANOMALY_DETECTION_JOB_TYPE_INTERNAL_HIDDEN", "ANOMALY_DETECTION_JOB_TYPE_NORMAL"`, v) + } +} + +// Values returns all possible values for AnomalyDetectionJobType. +// +// There is no guarantee on the order of the values in the slice. +func (f *AnomalyDetectionJobType) Values() []AnomalyDetectionJobType { + return []AnomalyDetectionJobType{ + AnomalyDetectionJobTypeAnomalyDetectionJobTypeInternalHidden, + AnomalyDetectionJobTypeAnomalyDetectionJobTypeNormal, + } +} + +// Type always returns AnomalyDetectionJobType to satisfy [pflag.Value] interface +func (f *AnomalyDetectionJobType) Type() string { + return "AnomalyDetectionJobType" +} + // Status of Anomaly Detection Job Run type AnomalyDetectionRunStatus string diff --git a/service/serving/model.go b/service/serving/model.go index 3472ae2c8..f72b19ffa 100755 --- a/service/serving/model.go +++ b/service/serving/model.go @@ -168,6 +168,9 @@ type AiGatewayRateLimit struct { // Renewal period field for a rate limit. Currently, only 'minute' is // supported. RenewalPeriod AiGatewayRateLimitRenewalPeriod `json:"renewal_period"` + // Used to specify how many tokens are allowed for a key within the + // renewal_period. + Tokens int64 `json:"tokens,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -2255,6 +2258,8 @@ type ServingEndpoint struct { Tags []EndpointTag `json:"tags,omitempty"` // The task type of the serving endpoint. Task string `json:"task,omitempty"` + // The usage policy associated with serving endpoint. + UsagePolicyId string `json:"usage_policy_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } diff --git a/service/settings/impl.go b/service/settings/impl.go index 47cc8fc7e..54b635a74 100755 --- a/service/settings/impl.go +++ b/service/settings/impl.go @@ -981,6 +981,7 @@ func (a *networkConnectivityImpl) UpdatePrivateEndpointRule(ctx context.Context, var nccPrivateEndpointRule NccPrivateEndpointRule path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v/private-endpoint-rules/%v", a.client.ConfiguredAccountID(), request.NetworkConnectivityConfigId, request.PrivateEndpointRuleId) queryParams := make(map[string]any) + if request.UpdateMask != "" { queryParams["update_mask"] = request.UpdateMask } diff --git a/service/settings/model.go b/service/settings/model.go index c90ae4022..bce586b03 100755 --- a/service/settings/model.go +++ b/service/settings/model.go @@ -3206,7 +3206,23 @@ func (s LlmProxyPartnerPoweredWorkspace) MarshalJSON() ([]byte, error) { } type MicrosoftTeamsConfig struct { - // [Input-Only] URL for Microsoft Teams. + // [Input-Only] App ID for Microsoft Teams App. + AppId string `json:"app_id,omitempty"` + // [Output-Only] Whether App ID is set. + AppIdSet bool `json:"app_id_set,omitempty"` + // [Input-Only] Secret for Microsoft Teams App authentication. + AuthSecret string `json:"auth_secret,omitempty"` + // [Output-Only] Whether secret is set. + AuthSecretSet bool `json:"auth_secret_set,omitempty"` + // [Input-Only] Channel URL for Microsoft Teams App. + ChannelUrl string `json:"channel_url,omitempty"` + // [Output-Only] Whether Channel URL is set. + ChannelUrlSet bool `json:"channel_url_set,omitempty"` + // [Input-Only] Tenant ID for Microsoft Teams App. + TenantId string `json:"tenant_id,omitempty"` + // [Output-Only] Whether Tenant ID is set. + TenantIdSet bool `json:"tenant_id_set,omitempty"` + // [Input-Only] URL for Microsoft Teams webhook. Url string `json:"url,omitempty"` // [Output-Only] Whether URL is set. UrlSet bool `json:"url_set,omitempty"` diff --git a/service/settingsv2/api.go b/service/settingsv2/api.go new file mode 100755 index 000000000..077c2875a --- /dev/null +++ b/service/settingsv2/api.go @@ -0,0 +1,91 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +// These APIs allow you to manage Account Settings V2, Workspace Settings V2, etc. +package settingsv2 + +import ( + "context" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" +) + +type AccountSettingsV2Interface interface { + + // Get a setting value at account level. See + // :method:settingsv2/listaccountsettingsmetadata for list of setting available + // via public APIs at account level. + GetPublicAccountSetting(ctx context.Context, request GetPublicAccountSettingRequest) (*Setting, error) + + // List valid setting keys and metadata. These settings are available to be + // referenced via GET :method:settingsv2/getpublicaccountsetting and PATCH + // :method:settingsv2/patchpublicaccountsetting APIs + // + // This method is generated by Databricks SDK Code Generator. + ListAccountSettingsMetadata(ctx context.Context, request ListAccountSettingsMetadataRequest) listing.Iterator[SettingsMetadata] + + // List valid setting keys and metadata. These settings are available to be + // referenced via GET :method:settingsv2/getpublicaccountsetting and PATCH + // :method:settingsv2/patchpublicaccountsetting APIs + // + // This method is generated by Databricks SDK Code Generator. + ListAccountSettingsMetadataAll(ctx context.Context, request ListAccountSettingsMetadataRequest) ([]SettingsMetadata, error) + + // Patch a setting value at account level. See + // :method:settingsv2/listaccountsettingsmetadata for list of setting available + // via public APIs at account level. + PatchPublicAccountSetting(ctx context.Context, request PatchPublicAccountSettingRequest) (*Setting, error) +} + +func NewAccountSettingsV2(client *client.DatabricksClient) *AccountSettingsV2API { + return &AccountSettingsV2API{ + accountSettingsV2Impl: accountSettingsV2Impl{ + client: client, + }, + } +} + +// APIs to manage account level settings +type AccountSettingsV2API struct { + accountSettingsV2Impl +} + +type WorkspaceSettingsV2Interface interface { + + // Get a setting value at workspace level. See + // :method:settingsv2/listworkspacesettingsmetadata for list of setting + // available via public APIs. + GetPublicWorkspaceSetting(ctx context.Context, request GetPublicWorkspaceSettingRequest) (*Setting, error) + + // List valid setting keys and metadata. These settings are available to be + // referenced via GET :method:settingsv2/getpublicworkspacesetting and PATCH + // :method:settingsv2/patchpublicworkspacesetting APIs + // + // This method is generated by Databricks SDK Code Generator. + ListWorkspaceSettingsMetadata(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) listing.Iterator[SettingsMetadata] + + // List valid setting keys and metadata. These settings are available to be + // referenced via GET :method:settingsv2/getpublicworkspacesetting and PATCH + // :method:settingsv2/patchpublicworkspacesetting APIs + // + // This method is generated by Databricks SDK Code Generator. + ListWorkspaceSettingsMetadataAll(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) ([]SettingsMetadata, error) + + // Patch a setting value at workspace level. See + // :method:settingsv2/listworkspacesettingsmetadata for list of setting + // available via public APIs at workspace level. + PatchPublicWorkspaceSetting(ctx context.Context, request PatchPublicWorkspaceSettingRequest) (*Setting, error) +} + +func NewWorkspaceSettingsV2(client *client.DatabricksClient) *WorkspaceSettingsV2API { + return &WorkspaceSettingsV2API{ + workspaceSettingsV2Impl: workspaceSettingsV2Impl{ + client: client, + }, + } +} + +// APIs to manage workspace level settings +type WorkspaceSettingsV2API struct { + workspaceSettingsV2Impl +} diff --git a/service/settingsv2/impl.go b/service/settingsv2/impl.go new file mode 100755 index 000000000..ed1c84748 --- /dev/null +++ b/service/settingsv2/impl.go @@ -0,0 +1,155 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package settingsv2 + +import ( + "context" + "fmt" + "net/http" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" + "github.com/databricks/databricks-sdk-go/useragent" +) + +// unexported type that holds implementations of just AccountSettingsV2 API methods +type accountSettingsV2Impl struct { + client *client.DatabricksClient +} + +func (a *accountSettingsV2Impl) GetPublicAccountSetting(ctx context.Context, request GetPublicAccountSettingRequest) (*Setting, error) { + var setting Setting + path := fmt.Sprintf("/api/2.1/accounts/%v/settings/%v", a.client.ConfiguredAccountID(), request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &setting) + return &setting, err +} + +// List valid setting keys and metadata. These settings are available to be +// referenced via GET :method:settingsv2/getpublicaccountsetting and PATCH +// :method:settingsv2/patchpublicaccountsetting APIs +func (a *accountSettingsV2Impl) ListAccountSettingsMetadata(ctx context.Context, request ListAccountSettingsMetadataRequest) listing.Iterator[SettingsMetadata] { + + getNextPage := func(ctx context.Context, req ListAccountSettingsMetadataRequest) (*ListAccountSettingsMetadataResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListAccountSettingsMetadata(ctx, req) + } + getItems := func(resp *ListAccountSettingsMetadataResponse) []SettingsMetadata { + return resp.SettingsMetadata + } + getNextReq := func(resp *ListAccountSettingsMetadataResponse) *ListAccountSettingsMetadataRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List valid setting keys and metadata. These settings are available to be +// referenced via GET :method:settingsv2/getpublicaccountsetting and PATCH +// :method:settingsv2/patchpublicaccountsetting APIs +func (a *accountSettingsV2Impl) ListAccountSettingsMetadataAll(ctx context.Context, request ListAccountSettingsMetadataRequest) ([]SettingsMetadata, error) { + iterator := a.ListAccountSettingsMetadata(ctx, request) + return listing.ToSlice[SettingsMetadata](ctx, iterator) +} + +func (a *accountSettingsV2Impl) internalListAccountSettingsMetadata(ctx context.Context, request ListAccountSettingsMetadataRequest) (*ListAccountSettingsMetadataResponse, error) { + var listAccountSettingsMetadataResponse ListAccountSettingsMetadataResponse + path := fmt.Sprintf("/api/2.1/accounts/%v/settings-metadata", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAccountSettingsMetadataResponse) + return &listAccountSettingsMetadataResponse, err +} + +func (a *accountSettingsV2Impl) PatchPublicAccountSetting(ctx context.Context, request PatchPublicAccountSettingRequest) (*Setting, error) { + var setting Setting + path := fmt.Sprintf("/api/2.1/accounts/%v/settings/%v", a.client.ConfiguredAccountID(), request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Setting, &setting) + return &setting, err +} + +// unexported type that holds implementations of just WorkspaceSettingsV2 API methods +type workspaceSettingsV2Impl struct { + client *client.DatabricksClient +} + +func (a *workspaceSettingsV2Impl) GetPublicWorkspaceSetting(ctx context.Context, request GetPublicWorkspaceSettingRequest) (*Setting, error) { + var setting Setting + path := fmt.Sprintf("/api/2.1/settings/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &setting) + return &setting, err +} + +// List valid setting keys and metadata. These settings are available to be +// referenced via GET :method:settingsv2/getpublicworkspacesetting and PATCH +// :method:settingsv2/patchpublicworkspacesetting APIs +func (a *workspaceSettingsV2Impl) ListWorkspaceSettingsMetadata(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) listing.Iterator[SettingsMetadata] { + + getNextPage := func(ctx context.Context, req ListWorkspaceSettingsMetadataRequest) (*ListWorkspaceSettingsMetadataResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListWorkspaceSettingsMetadata(ctx, req) + } + getItems := func(resp *ListWorkspaceSettingsMetadataResponse) []SettingsMetadata { + return resp.SettingsMetadata + } + getNextReq := func(resp *ListWorkspaceSettingsMetadataResponse) *ListWorkspaceSettingsMetadataRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List valid setting keys and metadata. These settings are available to be +// referenced via GET :method:settingsv2/getpublicworkspacesetting and PATCH +// :method:settingsv2/patchpublicworkspacesetting APIs +func (a *workspaceSettingsV2Impl) ListWorkspaceSettingsMetadataAll(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) ([]SettingsMetadata, error) { + iterator := a.ListWorkspaceSettingsMetadata(ctx, request) + return listing.ToSlice[SettingsMetadata](ctx, iterator) +} + +func (a *workspaceSettingsV2Impl) internalListWorkspaceSettingsMetadata(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) (*ListWorkspaceSettingsMetadataResponse, error) { + var listWorkspaceSettingsMetadataResponse ListWorkspaceSettingsMetadataResponse + path := "/api/2.1/settings-metadata" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listWorkspaceSettingsMetadataResponse) + return &listWorkspaceSettingsMetadataResponse, err +} + +func (a *workspaceSettingsV2Impl) PatchPublicWorkspaceSetting(ctx context.Context, request PatchPublicWorkspaceSettingRequest) (*Setting, error) { + var setting Setting + path := fmt.Sprintf("/api/2.1/settings/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Setting, &setting) + return &setting, err +} diff --git a/service/settingsv2/interface.go b/service/settingsv2/interface.go new file mode 100755 index 000000000..96e8ac399 --- /dev/null +++ b/service/settingsv2/interface.go @@ -0,0 +1,49 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package settingsv2 + +import ( + "context" +) + +// APIs to manage account level settings +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type AccountSettingsV2Service interface { + + // Get a setting value at account level. See + // :method:settingsv2/listaccountsettingsmetadata for list of setting + // available via public APIs at account level. + GetPublicAccountSetting(ctx context.Context, request GetPublicAccountSettingRequest) (*Setting, error) + + // List valid setting keys and metadata. These settings are available to be + // referenced via GET :method:settingsv2/getpublicaccountsetting and PATCH + // :method:settingsv2/patchpublicaccountsetting APIs + ListAccountSettingsMetadata(ctx context.Context, request ListAccountSettingsMetadataRequest) (*ListAccountSettingsMetadataResponse, error) + + // Patch a setting value at account level. See + // :method:settingsv2/listaccountsettingsmetadata for list of setting + // available via public APIs at account level. + PatchPublicAccountSetting(ctx context.Context, request PatchPublicAccountSettingRequest) (*Setting, error) +} + +// APIs to manage workspace level settings +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type WorkspaceSettingsV2Service interface { + + // Get a setting value at workspace level. See + // :method:settingsv2/listworkspacesettingsmetadata for list of setting + // available via public APIs. + GetPublicWorkspaceSetting(ctx context.Context, request GetPublicWorkspaceSettingRequest) (*Setting, error) + + // List valid setting keys and metadata. These settings are available to be + // referenced via GET :method:settingsv2/getpublicworkspacesetting and PATCH + // :method:settingsv2/patchpublicworkspacesetting APIs + ListWorkspaceSettingsMetadata(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) (*ListWorkspaceSettingsMetadataResponse, error) + + // Patch a setting value at workspace level. See + // :method:settingsv2/listworkspacesettingsmetadata for list of setting + // available via public APIs at workspace level. + PatchPublicWorkspaceSetting(ctx context.Context, request PatchPublicWorkspaceSettingRequest) (*Setting, error) +} diff --git a/service/settingsv2/model.go b/service/settingsv2/model.go new file mode 100755 index 000000000..411be751b --- /dev/null +++ b/service/settingsv2/model.go @@ -0,0 +1,542 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package settingsv2 + +import ( + "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" +) + +type AibiDashboardEmbeddingAccessPolicy struct { + AccessPolicyType AibiDashboardEmbeddingAccessPolicyAccessPolicyType `json:"access_policy_type"` +} + +type AibiDashboardEmbeddingAccessPolicyAccessPolicyType string + +const AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeAllowAllDomains AibiDashboardEmbeddingAccessPolicyAccessPolicyType = `ALLOW_ALL_DOMAINS` + +const AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeAllowApprovedDomains AibiDashboardEmbeddingAccessPolicyAccessPolicyType = `ALLOW_APPROVED_DOMAINS` + +const AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeDenyAllDomains AibiDashboardEmbeddingAccessPolicyAccessPolicyType = `DENY_ALL_DOMAINS` + +// String representation for [fmt.Print] +func (f *AibiDashboardEmbeddingAccessPolicyAccessPolicyType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AibiDashboardEmbeddingAccessPolicyAccessPolicyType) Set(v string) error { + switch v { + case `ALLOW_ALL_DOMAINS`, `ALLOW_APPROVED_DOMAINS`, `DENY_ALL_DOMAINS`: + *f = AibiDashboardEmbeddingAccessPolicyAccessPolicyType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ALLOW_ALL_DOMAINS", "ALLOW_APPROVED_DOMAINS", "DENY_ALL_DOMAINS"`, v) + } +} + +// Values returns all possible values for AibiDashboardEmbeddingAccessPolicyAccessPolicyType. +// +// There is no guarantee on the order of the values in the slice. +func (f *AibiDashboardEmbeddingAccessPolicyAccessPolicyType) Values() []AibiDashboardEmbeddingAccessPolicyAccessPolicyType { + return []AibiDashboardEmbeddingAccessPolicyAccessPolicyType{ + AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeAllowAllDomains, + AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeAllowApprovedDomains, + AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeDenyAllDomains, + } +} + +// Type always returns AibiDashboardEmbeddingAccessPolicyAccessPolicyType to satisfy [pflag.Value] interface +func (f *AibiDashboardEmbeddingAccessPolicyAccessPolicyType) Type() string { + return "AibiDashboardEmbeddingAccessPolicyAccessPolicyType" +} + +type AibiDashboardEmbeddingApprovedDomains struct { + ApprovedDomains []string `json:"approved_domains,omitempty"` +} + +type BooleanMessage struct { + Value bool `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *BooleanMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s BooleanMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ClusterAutoRestartMessage struct { + CanToggle bool `json:"can_toggle,omitempty"` + + Enabled bool `json:"enabled,omitempty"` + + EnablementDetails *ClusterAutoRestartMessageEnablementDetails `json:"enablement_details,omitempty"` + + MaintenanceWindow *ClusterAutoRestartMessageMaintenanceWindow `json:"maintenance_window,omitempty"` + + RestartEvenIfNoUpdatesAvailable bool `json:"restart_even_if_no_updates_available,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ClusterAutoRestartMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ClusterAutoRestartMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Contains an information about the enablement status judging (e.g. whether the +// enterprise tier is enabled) This is only additional information that MUST NOT +// be used to decide whether the setting is enabled or not. This is intended to +// use only for purposes like showing an error message to the customer with the +// additional details. For example, using these details we can check why exactly +// the feature is disabled for this customer. +type ClusterAutoRestartMessageEnablementDetails struct { + // The feature is force enabled if compliance mode is active + ForcedForComplianceMode bool `json:"forced_for_compliance_mode,omitempty"` + // The feature is unavailable if the corresponding entitlement disabled (see + // getShieldEntitlementEnable) + UnavailableForDisabledEntitlement bool `json:"unavailable_for_disabled_entitlement,omitempty"` + // The feature is unavailable if the customer doesn't have enterprise tier + UnavailableForNonEnterpriseTier bool `json:"unavailable_for_non_enterprise_tier,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ClusterAutoRestartMessageEnablementDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ClusterAutoRestartMessageEnablementDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ClusterAutoRestartMessageMaintenanceWindow struct { + WeekDayBasedSchedule *ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule `json:"week_day_based_schedule,omitempty"` +} + +type ClusterAutoRestartMessageMaintenanceWindowDayOfWeek string + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekFriday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `FRIDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekMonday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `MONDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekSaturday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `SATURDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekSunday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `SUNDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekThursday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `THURSDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekTuesday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `TUESDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekWednesday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `WEDNESDAY` + +// String representation for [fmt.Print] +func (f *ClusterAutoRestartMessageMaintenanceWindowDayOfWeek) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ClusterAutoRestartMessageMaintenanceWindowDayOfWeek) Set(v string) error { + switch v { + case `FRIDAY`, `MONDAY`, `SATURDAY`, `SUNDAY`, `THURSDAY`, `TUESDAY`, `WEDNESDAY`: + *f = ClusterAutoRestartMessageMaintenanceWindowDayOfWeek(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "FRIDAY", "MONDAY", "SATURDAY", "SUNDAY", "THURSDAY", "TUESDAY", "WEDNESDAY"`, v) + } +} + +// Values returns all possible values for ClusterAutoRestartMessageMaintenanceWindowDayOfWeek. +// +// There is no guarantee on the order of the values in the slice. +func (f *ClusterAutoRestartMessageMaintenanceWindowDayOfWeek) Values() []ClusterAutoRestartMessageMaintenanceWindowDayOfWeek { + return []ClusterAutoRestartMessageMaintenanceWindowDayOfWeek{ + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekFriday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekMonday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekSaturday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekSunday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekThursday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekTuesday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekWednesday, + } +} + +// Type always returns ClusterAutoRestartMessageMaintenanceWindowDayOfWeek to satisfy [pflag.Value] interface +func (f *ClusterAutoRestartMessageMaintenanceWindowDayOfWeek) Type() string { + return "ClusterAutoRestartMessageMaintenanceWindowDayOfWeek" +} + +type ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule struct { + DayOfWeek ClusterAutoRestartMessageMaintenanceWindowDayOfWeek `json:"day_of_week,omitempty"` + + Frequency ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency `json:"frequency,omitempty"` + + WindowStartTime *ClusterAutoRestartMessageMaintenanceWindowWindowStartTime `json:"window_start_time,omitempty"` +} + +type ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency string + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyEveryWeek ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `EVERY_WEEK` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFirstAndThirdOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `FIRST_AND_THIRD_OF_MONTH` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFirstOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `FIRST_OF_MONTH` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFourthOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `FOURTH_OF_MONTH` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencySecondAndFourthOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `SECOND_AND_FOURTH_OF_MONTH` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencySecondOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `SECOND_OF_MONTH` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyThirdOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `THIRD_OF_MONTH` + +// String representation for [fmt.Print] +func (f *ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency) Set(v string) error { + switch v { + case `EVERY_WEEK`, `FIRST_AND_THIRD_OF_MONTH`, `FIRST_OF_MONTH`, `FOURTH_OF_MONTH`, `SECOND_AND_FOURTH_OF_MONTH`, `SECOND_OF_MONTH`, `THIRD_OF_MONTH`: + *f = ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "EVERY_WEEK", "FIRST_AND_THIRD_OF_MONTH", "FIRST_OF_MONTH", "FOURTH_OF_MONTH", "SECOND_AND_FOURTH_OF_MONTH", "SECOND_OF_MONTH", "THIRD_OF_MONTH"`, v) + } +} + +// Values returns all possible values for ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency. +// +// There is no guarantee on the order of the values in the slice. +func (f *ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency) Values() []ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency { + return []ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency{ + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyEveryWeek, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFirstAndThirdOfMonth, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFirstOfMonth, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFourthOfMonth, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencySecondAndFourthOfMonth, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencySecondOfMonth, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyThirdOfMonth, + } +} + +// Type always returns ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency to satisfy [pflag.Value] interface +func (f *ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency) Type() string { + return "ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency" +} + +type ClusterAutoRestartMessageMaintenanceWindowWindowStartTime struct { + Hours int `json:"hours,omitempty"` + + Minutes int `json:"minutes,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type GetPublicAccountSettingRequest struct { + Name string `json:"-" url:"-"` +} + +type GetPublicWorkspaceSettingRequest struct { + Name string `json:"-" url:"-"` +} + +type IntegerMessage struct { + Value int `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *IntegerMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s IntegerMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListAccountSettingsMetadataRequest struct { + // The maximum number of settings to return. The service may return fewer + // than this value. If unspecified, at most 200 settings will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous + // `ListAccountSettingsMetadataRequest` call. Provide this to retrieve the + // subsequent page. + // + // When paginating, all other parameters provided to + // `ListAccountSettingsMetadataRequest` must match the call that provided + // the page token. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListAccountSettingsMetadataRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListAccountSettingsMetadataRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListAccountSettingsMetadataResponse struct { + // A token that can be sent as `page_token` to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + // List of all settings available via public APIs and their metadata + SettingsMetadata []SettingsMetadata `json:"settings_metadata,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListAccountSettingsMetadataResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListAccountSettingsMetadataResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListWorkspaceSettingsMetadataRequest struct { + // The maximum number of settings to return. The service may return fewer + // than this value. If unspecified, at most 200 settings will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous + // `ListWorkspaceSettingsMetadataRequest` call. Provide this to retrieve the + // subsequent page. + // + // When paginating, all other parameters provided to + // `ListWorkspaceSettingsMetadataRequest` must match the call that provided + // the page token. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListWorkspaceSettingsMetadataRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListWorkspaceSettingsMetadataRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListWorkspaceSettingsMetadataResponse struct { + // A token that can be sent as `page_token` to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + // List of all settings available via public APIs and their metadata + SettingsMetadata []SettingsMetadata `json:"settings_metadata,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListWorkspaceSettingsMetadataResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListWorkspaceSettingsMetadataResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type PatchPublicAccountSettingRequest struct { + Name string `json:"-" url:"-"` + + Setting Setting `json:"setting"` +} + +type PatchPublicWorkspaceSettingRequest struct { + Name string `json:"-" url:"-"` + + Setting Setting `json:"setting"` +} + +type PersonalComputeMessage struct { + Value PersonalComputeMessagePersonalComputeMessageEnum `json:"value,omitempty"` +} + +// ON: Grants all users in all workspaces access to the Personal Compute default +// policy, allowing all users to create single-machine compute resources. +// DELEGATE: Moves access control for the Personal Compute default policy to +// individual workspaces and requires a workspace’s users or groups to be +// added to the ACLs of that workspace’s Personal Compute default policy +// before they will be able to create compute resources through that policy. +type PersonalComputeMessagePersonalComputeMessageEnum string + +const PersonalComputeMessagePersonalComputeMessageEnumDelegate PersonalComputeMessagePersonalComputeMessageEnum = `DELEGATE` + +const PersonalComputeMessagePersonalComputeMessageEnumOn PersonalComputeMessagePersonalComputeMessageEnum = `ON` + +// String representation for [fmt.Print] +func (f *PersonalComputeMessagePersonalComputeMessageEnum) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *PersonalComputeMessagePersonalComputeMessageEnum) Set(v string) error { + switch v { + case `DELEGATE`, `ON`: + *f = PersonalComputeMessagePersonalComputeMessageEnum(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DELEGATE", "ON"`, v) + } +} + +// Values returns all possible values for PersonalComputeMessagePersonalComputeMessageEnum. +// +// There is no guarantee on the order of the values in the slice. +func (f *PersonalComputeMessagePersonalComputeMessageEnum) Values() []PersonalComputeMessagePersonalComputeMessageEnum { + return []PersonalComputeMessagePersonalComputeMessageEnum{ + PersonalComputeMessagePersonalComputeMessageEnumDelegate, + PersonalComputeMessagePersonalComputeMessageEnumOn, + } +} + +// Type always returns PersonalComputeMessagePersonalComputeMessageEnum to satisfy [pflag.Value] interface +func (f *PersonalComputeMessagePersonalComputeMessageEnum) Type() string { + return "PersonalComputeMessagePersonalComputeMessageEnum" +} + +type RestrictWorkspaceAdminsMessage struct { + Status RestrictWorkspaceAdminsMessageStatus `json:"status"` +} + +type RestrictWorkspaceAdminsMessageStatus string + +const RestrictWorkspaceAdminsMessageStatusAllowAll RestrictWorkspaceAdminsMessageStatus = `ALLOW_ALL` + +const RestrictWorkspaceAdminsMessageStatusRestrictTokensAndJobRunAs RestrictWorkspaceAdminsMessageStatus = `RESTRICT_TOKENS_AND_JOB_RUN_AS` + +// String representation for [fmt.Print] +func (f *RestrictWorkspaceAdminsMessageStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *RestrictWorkspaceAdminsMessageStatus) Set(v string) error { + switch v { + case `ALLOW_ALL`, `RESTRICT_TOKENS_AND_JOB_RUN_AS`: + *f = RestrictWorkspaceAdminsMessageStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ALLOW_ALL", "RESTRICT_TOKENS_AND_JOB_RUN_AS"`, v) + } +} + +// Values returns all possible values for RestrictWorkspaceAdminsMessageStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *RestrictWorkspaceAdminsMessageStatus) Values() []RestrictWorkspaceAdminsMessageStatus { + return []RestrictWorkspaceAdminsMessageStatus{ + RestrictWorkspaceAdminsMessageStatusAllowAll, + RestrictWorkspaceAdminsMessageStatusRestrictTokensAndJobRunAs, + } +} + +// Type always returns RestrictWorkspaceAdminsMessageStatus to satisfy [pflag.Value] interface +func (f *RestrictWorkspaceAdminsMessageStatus) Type() string { + return "RestrictWorkspaceAdminsMessageStatus" +} + +type Setting struct { + AibiDashboardEmbeddingAccessPolicy *AibiDashboardEmbeddingAccessPolicy `json:"aibi_dashboard_embedding_access_policy,omitempty"` + + AibiDashboardEmbeddingApprovedDomains *AibiDashboardEmbeddingApprovedDomains `json:"aibi_dashboard_embedding_approved_domains,omitempty"` + + AutomaticClusterUpdateWorkspace *ClusterAutoRestartMessage `json:"automatic_cluster_update_workspace,omitempty"` + + BooleanVal *BooleanMessage `json:"boolean_val,omitempty"` + + EffectiveAibiDashboardEmbeddingAccessPolicy *AibiDashboardEmbeddingAccessPolicy `json:"effective_aibi_dashboard_embedding_access_policy,omitempty"` + + EffectiveAibiDashboardEmbeddingApprovedDomains *AibiDashboardEmbeddingApprovedDomains `json:"effective_aibi_dashboard_embedding_approved_domains,omitempty"` + + EffectiveAutomaticClusterUpdateWorkspace *ClusterAutoRestartMessage `json:"effective_automatic_cluster_update_workspace,omitempty"` + + EffectiveBooleanVal *BooleanMessage `json:"effective_boolean_val,omitempty"` + + EffectiveIntegerVal *IntegerMessage `json:"effective_integer_val,omitempty"` + + EffectivePersonalCompute *PersonalComputeMessage `json:"effective_personal_compute,omitempty"` + + EffectiveRestrictWorkspaceAdmins *RestrictWorkspaceAdminsMessage `json:"effective_restrict_workspace_admins,omitempty"` + + EffectiveStringVal *StringMessage `json:"effective_string_val,omitempty"` + + IntegerVal *IntegerMessage `json:"integer_val,omitempty"` + // Name of the setting. + Name string `json:"name,omitempty"` + + PersonalCompute *PersonalComputeMessage `json:"personal_compute,omitempty"` + + RestrictWorkspaceAdmins *RestrictWorkspaceAdminsMessage `json:"restrict_workspace_admins,omitempty"` + + StringVal *StringMessage `json:"string_val,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Setting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Setting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type SettingsMetadata struct { + // Setting description for what this setting controls + Description string `json:"description,omitempty"` + // Link to databricks documentation for the setting + DocsLink string `json:"docs_link,omitempty"` + // Name of the setting. + Name string `json:"name,omitempty"` + // Type of the setting. To set this setting, the value sent must match this + // type. + Type string `json:"type,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *SettingsMetadata) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s SettingsMetadata) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type StringMessage struct { + // Represents a generic string value. + Value string `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *StringMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s StringMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} diff --git a/service/sharing/impl.go b/service/sharing/impl.go index 203666228..9e50d2596 100755 --- a/service/sharing/impl.go +++ b/service/sharing/impl.go @@ -272,6 +272,7 @@ func (a *recipientFederationPoliciesImpl) Update(ctx context.Context, request Up var federationPolicy FederationPolicy path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies/%v", request.RecipientName, request.Name) queryParams := make(map[string]any) + if request.UpdateMask != "" || slices.Contains(request.ForceSendFields, "UpdateMask") { queryParams["update_mask"] = request.UpdateMask } diff --git a/service/sharing/model.go b/service/sharing/model.go index c25069757..995d1e95f 100755 --- a/service/sharing/model.go +++ b/service/sharing/model.go @@ -223,6 +223,9 @@ type CreateShare struct { Comment string `json:"comment,omitempty"` // Name of the share. Name string `json:"name"` + // Serverless budget policy id (can only be created/updated when calling + // data-sharing service) [Create,Update:IGN] + ServerlessBudgetPolicyId string `json:"serverless_budget_policy_id,omitempty"` // Storage root URL for the share. StorageRoot string `json:"storage_root,omitempty"` @@ -950,6 +953,16 @@ type PermissionsChange struct { // The principal whose privileges we are changing. Only one of principal or // principal_id should be specified, never both at the same time. Principal string `json:"principal,omitempty"` + // An opaque internal ID that identifies the principal whose privileges + // should be removed. + // + // This field is intended for removing privileges associated with a deleted + // user. When set, only the entries specified in the remove field are + // processed; any entries in the add field will be rejected. + // + // Only one of principal or principal_id should be specified, never both at + // the same time. + PrincipalId int64 `json:"principal_id,omitempty"` // The set of privileges to remove. Remove []string `json:"remove,omitempty"` @@ -1134,6 +1147,9 @@ type PrivilegeAssignment struct { // The principal (user email address or group name). For deleted principals, // `principal` is empty while `principal_id` is populated. Principal string `json:"principal,omitempty"` + // Unique identifier of the principal. For active principals, both + // `principal` and `principal_id` are present. + PrincipalId int64 `json:"principal_id,omitempty"` // The privileges assigned to the principal. Privileges []Privilege `json:"privileges,omitempty"` @@ -1381,16 +1397,9 @@ type SecurablePropertiesKvPairs struct { } type Share struct { - // The comment of the share. - Comment string `json:"comment,omitempty"` - // The display name of the share. If defined, it will be shown in the UI. - DisplayName string `json:"display_name,omitempty"` - Id string `json:"id,omitempty"` Name string `json:"name,omitempty"` - // The tags of the share. - Tags []catalog.TagKeyValue `json:"tags,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -1416,6 +1425,9 @@ type ShareInfo struct { Objects []SharedDataObject `json:"objects,omitempty"` // Username of current owner of share. Owner string `json:"owner,omitempty"` + // Serverless budget policy id (can only be created/updated when calling + // data-sharing service) [Create,Update:IGN] + ServerlessBudgetPolicyId string `json:"serverless_budget_policy_id,omitempty"` // Storage Location URL (full path) for the share. StorageLocation string `json:"storage_location,omitempty"` // Storage root URL for the share. @@ -1796,6 +1808,8 @@ func (s Table) MarshalJSON() ([]byte, error) { // Internal information for D2D sharing that should not be disclosed to external // users. type TableInternalAttributes struct { + // Managed Delta Metadata location for foreign iceberg tables. + AuxiliaryManagedLocation string `json:"auxiliary_managed_location,omitempty"` // Will be populated in the reconciliation response for VIEW and // FOREIGN_TABLE, with the value of the parent UC entity's storage_location, // following the same logic as getManagedEntityPath in @@ -1832,6 +1846,8 @@ const TableInternalAttributesSharedTableTypeDirectoryBasedTable TableInternalAtt const TableInternalAttributesSharedTableTypeFileBasedTable TableInternalAttributesSharedTableType = `FILE_BASED_TABLE` +const TableInternalAttributesSharedTableTypeForeignIcebergTable TableInternalAttributesSharedTableType = `FOREIGN_ICEBERG_TABLE` + const TableInternalAttributesSharedTableTypeForeignTable TableInternalAttributesSharedTableType = `FOREIGN_TABLE` const TableInternalAttributesSharedTableTypeMaterializedView TableInternalAttributesSharedTableType = `MATERIALIZED_VIEW` @@ -1848,11 +1864,11 @@ func (f *TableInternalAttributesSharedTableType) String() string { // Set raw string value and validate it against allowed values func (f *TableInternalAttributesSharedTableType) Set(v string) error { switch v { - case `DELTA_ICEBERG_TABLE`, `DIRECTORY_BASED_TABLE`, `FILE_BASED_TABLE`, `FOREIGN_TABLE`, `MATERIALIZED_VIEW`, `STREAMING_TABLE`, `VIEW`: + case `DELTA_ICEBERG_TABLE`, `DIRECTORY_BASED_TABLE`, `FILE_BASED_TABLE`, `FOREIGN_ICEBERG_TABLE`, `FOREIGN_TABLE`, `MATERIALIZED_VIEW`, `STREAMING_TABLE`, `VIEW`: *f = TableInternalAttributesSharedTableType(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "DELTA_ICEBERG_TABLE", "DIRECTORY_BASED_TABLE", "FILE_BASED_TABLE", "FOREIGN_TABLE", "MATERIALIZED_VIEW", "STREAMING_TABLE", "VIEW"`, v) + return fmt.Errorf(`value "%s" is not one of "DELTA_ICEBERG_TABLE", "DIRECTORY_BASED_TABLE", "FILE_BASED_TABLE", "FOREIGN_ICEBERG_TABLE", "FOREIGN_TABLE", "MATERIALIZED_VIEW", "STREAMING_TABLE", "VIEW"`, v) } } @@ -1864,6 +1880,7 @@ func (f *TableInternalAttributesSharedTableType) Values() []TableInternalAttribu TableInternalAttributesSharedTableTypeDeltaIcebergTable, TableInternalAttributesSharedTableTypeDirectoryBasedTable, TableInternalAttributesSharedTableTypeFileBasedTable, + TableInternalAttributesSharedTableTypeForeignIcebergTable, TableInternalAttributesSharedTableTypeForeignTable, TableInternalAttributesSharedTableTypeMaterializedView, TableInternalAttributesSharedTableTypeStreamingTable, @@ -1966,6 +1983,9 @@ type UpdateShare struct { NewName string `json:"new_name,omitempty"` // Username of current owner of share. Owner string `json:"owner,omitempty"` + // Serverless budget policy id (can only be created/updated when calling + // data-sharing service) [Create,Update:IGN] + ServerlessBudgetPolicyId string `json:"serverless_budget_policy_id,omitempty"` // Storage root URL for the share. StorageRoot string `json:"storage_root,omitempty"` // Array of shared data object updates. diff --git a/service/sql/api.go b/service/sql/api.go index 9c9a4cdc9..ed6bbac66 100755 --- a/service/sql/api.go +++ b/service/sql/api.go @@ -1371,12 +1371,12 @@ type WarehousesInterface interface { // in a workspace. GetWorkspaceWarehouseConfig(ctx context.Context) (*GetWorkspaceWarehouseConfigResponse, error) - // Lists all SQL warehouses that a user has manager permissions on. + // Lists all SQL warehouses that a user has access to. // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListWarehousesRequest) listing.Iterator[EndpointInfo] - // Lists all SQL warehouses that a user has manager permissions on. + // Lists all SQL warehouses that a user has access to. // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListWarehousesRequest) ([]EndpointInfo, error) diff --git a/service/sql/impl.go b/service/sql/impl.go index 6f93fce35..739ff5590 100755 --- a/service/sql/impl.go +++ b/service/sql/impl.go @@ -238,6 +238,7 @@ func (a *alertsV2Impl) UpdateAlert(ctx context.Context, request UpdateAlertV2Req var alertV2 AlertV2 path := fmt.Sprintf("/api/2.0/alerts/%v", request.Id) queryParams := make(map[string]any) + if request.UpdateMask != "" { queryParams["update_mask"] = request.UpdateMask } @@ -900,7 +901,7 @@ func (a *warehousesImpl) GetWorkspaceWarehouseConfig(ctx context.Context) (*GetW return &getWorkspaceWarehouseConfigResponse, err } -// Lists all SQL warehouses that a user has manager permissions on. +// Lists all SQL warehouses that a user has access to. func (a *warehousesImpl) List(ctx context.Context, request ListWarehousesRequest) listing.Iterator[EndpointInfo] { getNextPage := func(ctx context.Context, req ListWarehousesRequest) (*ListWarehousesResponse, error) { @@ -919,7 +920,7 @@ func (a *warehousesImpl) List(ctx context.Context, request ListWarehousesRequest return iterator } -// Lists all SQL warehouses that a user has manager permissions on. +// Lists all SQL warehouses that a user has access to. func (a *warehousesImpl) ListAll(ctx context.Context, request ListWarehousesRequest) ([]EndpointInfo, error) { iterator := a.List(ctx, request) return listing.ToSlice[EndpointInfo](ctx, iterator) diff --git a/service/sql/interface.go b/service/sql/interface.go index a62cd4bcd..88d2cf76d 100755 --- a/service/sql/interface.go +++ b/service/sql/interface.go @@ -614,7 +614,7 @@ type WarehousesService interface { // warehouses in a workspace. GetWorkspaceWarehouseConfig(ctx context.Context) (*GetWorkspaceWarehouseConfigResponse, error) - // Lists all SQL warehouses that a user has manager permissions on. + // Lists all SQL warehouses that a user has access to. List(ctx context.Context, request ListWarehousesRequest) (*ListWarehousesResponse, error) // Sets permissions on an object, replacing existing permissions if they diff --git a/service/sql/model.go b/service/sql/model.go index 3fc8cb4d3..55be12746 100755 --- a/service/sql/model.go +++ b/service/sql/model.go @@ -468,6 +468,10 @@ type AlertV2 struct { CustomSummary string `json:"custom_summary,omitempty"` // The display name of the alert. DisplayName string `json:"display_name,omitempty"` + // The actual identity that will be used to execute the alert. This is an + // output-only field that shows the resolved run-as identity after applying + // permissions and defaults. + EffectiveRunAs *AlertV2RunAs `json:"effective_run_as,omitempty"` Evaluation *AlertV2Evaluation `json:"evaluation,omitempty"` // UUID identifying the alert. @@ -482,9 +486,19 @@ type AlertV2 struct { ParentPath string `json:"parent_path,omitempty"` // Text of the query to be run. QueryText string `json:"query_text,omitempty"` + // Specifies the identity that will be used to run the alert. This field + // allows you to configure alerts to run as a specific user or service + // principal. - For user identity: Set `user_name` to the email of an active + // workspace user. Users can only set this to their own email. - For service + // principal: Set `service_principal_name` to the application ID. Requires + // the `servicePrincipal/user` role. If not specified, the alert will run as + // the request user. + RunAs *AlertV2RunAs `json:"run_as,omitempty"` // The run as username or application ID of service principal. On Create and // Update, this field can be set to application ID of an active service // principal. Setting this field requires the servicePrincipal/user role. + // Deprecated: Use `run_as` field instead. This field will be removed in a + // future release. RunAsUserName string `json:"run_as_user_name,omitempty"` Schedule *CronSchedule `json:"schedule,omitempty"` @@ -507,7 +521,8 @@ func (s AlertV2) MarshalJSON() ([]byte, error) { type AlertV2Evaluation struct { // Operator used for comparison in alert evaluation. ComparisonOperator ComparisonOperator `json:"comparison_operator,omitempty"` - // Alert state if result is empty. + // Alert state if result is empty. Please avoid setting this field to be + // `UNKNOWN` because `UNKNOWN` state is planned to be deprecated. EmptyResultState AlertEvaluationState `json:"empty_result_state,omitempty"` // Timestamp of the last evaluation. LastEvaluatedAt string `json:"last_evaluated_at,omitempty"` @@ -594,6 +609,25 @@ func (s AlertV2OperandValue) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type AlertV2RunAs struct { + // Application ID of an active service principal. Setting this field + // requires the `servicePrincipal/user` role. + ServicePrincipalName string `json:"service_principal_name,omitempty"` + // The email of an active workspace user. Can only set this field to their + // own email. + UserName string `json:"user_name,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AlertV2RunAs) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AlertV2RunAs) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type AlertV2Subscription struct { DestinationId string `json:"destination_id,omitempty"` @@ -3004,8 +3038,10 @@ func (s ListAlertsV2Request) MarshalJSON() ([]byte, error) { } type ListAlertsV2Response struct { - NextPageToken string `json:"next_page_token,omitempty"` + Alerts []AlertV2 `json:"alerts,omitempty"` + NextPageToken string `json:"next_page_token,omitempty"` + // Deprecated. Use `alerts` instead. Results []AlertV2 `json:"results,omitempty"` ForceSendFields []string `json:"-" url:"-"` @@ -3796,6 +3832,8 @@ type QueryFilter struct { } type QueryInfo struct { + // The ID of the cached query if this result retrieved from cache + CacheQueryId string `json:"cache_query_id,omitempty"` // SQL Warehouse channel information at the time of query execution ChannelUsed *ChannelInfo `json:"channel_used,omitempty"` // Client application that ran the statement. For example: Databricks SQL diff --git a/service/tags/api.go b/service/tags/api.go new file mode 100755 index 000000000..780395e66 --- /dev/null +++ b/service/tags/api.go @@ -0,0 +1,92 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +// These APIs allow you to manage Tag Assignments, Tag Policies, etc. +package tags + +import ( + "context" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" +) + +type TagAssignmentsInterface interface { + + // Create a tag assignment + CreateTagAssignment(ctx context.Context, request CreateTagAssignmentRequest) (*TagAssignment, error) + + // Delete a tag assignment + DeleteTagAssignment(ctx context.Context, request DeleteTagAssignmentRequest) error + + // Get a tag assignment + GetTagAssignment(ctx context.Context, request GetTagAssignmentRequest) (*TagAssignment, error) + + // List the tag assignments for an entity + // + // This method is generated by Databricks SDK Code Generator. + ListTagAssignments(ctx context.Context, request ListTagAssignmentsRequest) listing.Iterator[TagAssignment] + + // List the tag assignments for an entity + // + // This method is generated by Databricks SDK Code Generator. + ListTagAssignmentsAll(ctx context.Context, request ListTagAssignmentsRequest) ([]TagAssignment, error) + + // Update a tag assignment + UpdateTagAssignment(ctx context.Context, request UpdateTagAssignmentRequest) (*TagAssignment, error) +} + +func NewTagAssignments(client *client.DatabricksClient) *TagAssignmentsAPI { + return &TagAssignmentsAPI{ + tagAssignmentsImpl: tagAssignmentsImpl{ + client: client, + }, + } +} + +// Manage tag assignments on workspace-scoped objects. +type TagAssignmentsAPI struct { + tagAssignmentsImpl +} + +type TagPoliciesInterface interface { + + // Creates a new tag policy, making the associated tag key governed. + CreateTagPolicy(ctx context.Context, request CreateTagPolicyRequest) (*TagPolicy, error) + + // Deletes a tag policy by its associated governed tag's key, leaving that tag + // key ungoverned. + DeleteTagPolicy(ctx context.Context, request DeleteTagPolicyRequest) error + + // Gets a single tag policy by its associated governed tag's key. + GetTagPolicy(ctx context.Context, request GetTagPolicyRequest) (*TagPolicy, error) + + // Lists the tag policies for all governed tags in the account. + // + // This method is generated by Databricks SDK Code Generator. + ListTagPolicies(ctx context.Context, request ListTagPoliciesRequest) listing.Iterator[TagPolicy] + + // Lists the tag policies for all governed tags in the account. + // + // This method is generated by Databricks SDK Code Generator. + ListTagPoliciesAll(ctx context.Context, request ListTagPoliciesRequest) ([]TagPolicy, error) + + // Updates an existing tag policy for a single governed tag. + UpdateTagPolicy(ctx context.Context, request UpdateTagPolicyRequest) (*TagPolicy, error) +} + +func NewTagPolicies(client *client.DatabricksClient) *TagPoliciesAPI { + return &TagPoliciesAPI{ + tagPoliciesImpl: tagPoliciesImpl{ + client: client, + }, + } +} + +// The Tag Policy API allows you to manage policies for governed tags in +// Databricks. Permissions for tag policies can be managed using the [Account +// Access Control Proxy API]. +// +// [Account Access Control Proxy API]: https://docs.databricks.com/api/workspace/accountaccesscontrolproxy +type TagPoliciesAPI struct { + tagPoliciesImpl +} diff --git a/service/tags/impl.go b/service/tags/impl.go new file mode 100755 index 000000000..01e91a164 --- /dev/null +++ b/service/tags/impl.go @@ -0,0 +1,195 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package tags + +import ( + "context" + "fmt" + "net/http" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" + "github.com/databricks/databricks-sdk-go/useragent" +) + +// unexported type that holds implementations of just TagAssignments API methods +type tagAssignmentsImpl struct { + client *client.DatabricksClient +} + +func (a *tagAssignmentsImpl) CreateTagAssignment(ctx context.Context, request CreateTagAssignmentRequest) (*TagAssignment, error) { + var tagAssignment TagAssignment + path := "/api/2.0/entity-tag-assignments" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.TagAssignment, &tagAssignment) + return &tagAssignment, err +} + +func (a *tagAssignmentsImpl) DeleteTagAssignment(ctx context.Context, request DeleteTagAssignmentRequest) error { + path := fmt.Sprintf("/api/2.0/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityId, request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *tagAssignmentsImpl) GetTagAssignment(ctx context.Context, request GetTagAssignmentRequest) (*TagAssignment, error) { + var tagAssignment TagAssignment + path := fmt.Sprintf("/api/2.0/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityId, request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &tagAssignment) + return &tagAssignment, err +} + +// List the tag assignments for an entity +func (a *tagAssignmentsImpl) ListTagAssignments(ctx context.Context, request ListTagAssignmentsRequest) listing.Iterator[TagAssignment] { + + getNextPage := func(ctx context.Context, req ListTagAssignmentsRequest) (*ListTagAssignmentsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListTagAssignments(ctx, req) + } + getItems := func(resp *ListTagAssignmentsResponse) []TagAssignment { + return resp.TagAssignments + } + getNextReq := func(resp *ListTagAssignmentsResponse) *ListTagAssignmentsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List the tag assignments for an entity +func (a *tagAssignmentsImpl) ListTagAssignmentsAll(ctx context.Context, request ListTagAssignmentsRequest) ([]TagAssignment, error) { + iterator := a.ListTagAssignments(ctx, request) + return listing.ToSlice[TagAssignment](ctx, iterator) +} + +func (a *tagAssignmentsImpl) internalListTagAssignments(ctx context.Context, request ListTagAssignmentsRequest) (*ListTagAssignmentsResponse, error) { + var listTagAssignmentsResponse ListTagAssignmentsResponse + path := fmt.Sprintf("/api/2.0/entity-tag-assignments/%v/%v", request.EntityType, request.EntityId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTagAssignmentsResponse) + return &listTagAssignmentsResponse, err +} + +func (a *tagAssignmentsImpl) UpdateTagAssignment(ctx context.Context, request UpdateTagAssignmentRequest) (*TagAssignment, error) { + var tagAssignment TagAssignment + path := fmt.Sprintf("/api/2.0/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityId, request.TagKey) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.TagAssignment, &tagAssignment) + return &tagAssignment, err +} + +// unexported type that holds implementations of just TagPolicies API methods +type tagPoliciesImpl struct { + client *client.DatabricksClient +} + +func (a *tagPoliciesImpl) CreateTagPolicy(ctx context.Context, request CreateTagPolicyRequest) (*TagPolicy, error) { + var tagPolicy TagPolicy + path := "/api/2.1/tag-policies" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.TagPolicy, &tagPolicy) + return &tagPolicy, err +} + +func (a *tagPoliciesImpl) DeleteTagPolicy(ctx context.Context, request DeleteTagPolicyRequest) error { + path := fmt.Sprintf("/api/2.1/tag-policies/%v", request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *tagPoliciesImpl) GetTagPolicy(ctx context.Context, request GetTagPolicyRequest) (*TagPolicy, error) { + var tagPolicy TagPolicy + path := fmt.Sprintf("/api/2.1/tag-policies/%v", request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &tagPolicy) + return &tagPolicy, err +} + +// Lists the tag policies for all governed tags in the account. +func (a *tagPoliciesImpl) ListTagPolicies(ctx context.Context, request ListTagPoliciesRequest) listing.Iterator[TagPolicy] { + + getNextPage := func(ctx context.Context, req ListTagPoliciesRequest) (*ListTagPoliciesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListTagPolicies(ctx, req) + } + getItems := func(resp *ListTagPoliciesResponse) []TagPolicy { + return resp.TagPolicies + } + getNextReq := func(resp *ListTagPoliciesResponse) *ListTagPoliciesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// Lists the tag policies for all governed tags in the account. +func (a *tagPoliciesImpl) ListTagPoliciesAll(ctx context.Context, request ListTagPoliciesRequest) ([]TagPolicy, error) { + iterator := a.ListTagPolicies(ctx, request) + return listing.ToSlice[TagPolicy](ctx, iterator) +} + +func (a *tagPoliciesImpl) internalListTagPolicies(ctx context.Context, request ListTagPoliciesRequest) (*ListTagPoliciesResponse, error) { + var listTagPoliciesResponse ListTagPoliciesResponse + path := "/api/2.1/tag-policies" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTagPoliciesResponse) + return &listTagPoliciesResponse, err +} + +func (a *tagPoliciesImpl) UpdateTagPolicy(ctx context.Context, request UpdateTagPolicyRequest) (*TagPolicy, error) { + var tagPolicy TagPolicy + path := fmt.Sprintf("/api/2.1/tag-policies/%v", request.TagKey) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.TagPolicy, &tagPolicy) + return &tagPolicy, err +} diff --git a/service/tags/interface.go b/service/tags/interface.go new file mode 100755 index 000000000..6fea50aa2 --- /dev/null +++ b/service/tags/interface.go @@ -0,0 +1,54 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package tags + +import ( + "context" +) + +// Manage tag assignments on workspace-scoped objects. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type TagAssignmentsService interface { + + // Create a tag assignment + CreateTagAssignment(ctx context.Context, request CreateTagAssignmentRequest) (*TagAssignment, error) + + // Delete a tag assignment + DeleteTagAssignment(ctx context.Context, request DeleteTagAssignmentRequest) error + + // Get a tag assignment + GetTagAssignment(ctx context.Context, request GetTagAssignmentRequest) (*TagAssignment, error) + + // List the tag assignments for an entity + ListTagAssignments(ctx context.Context, request ListTagAssignmentsRequest) (*ListTagAssignmentsResponse, error) + + // Update a tag assignment + UpdateTagAssignment(ctx context.Context, request UpdateTagAssignmentRequest) (*TagAssignment, error) +} + +// The Tag Policy API allows you to manage policies for governed tags in +// Databricks. Permissions for tag policies can be managed using the [Account +// Access Control Proxy API]. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +// +// [Account Access Control Proxy API]: https://docs.databricks.com/api/workspace/accountaccesscontrolproxy +type TagPoliciesService interface { + + // Creates a new tag policy, making the associated tag key governed. + CreateTagPolicy(ctx context.Context, request CreateTagPolicyRequest) (*TagPolicy, error) + + // Deletes a tag policy by its associated governed tag's key, leaving that + // tag key ungoverned. + DeleteTagPolicy(ctx context.Context, request DeleteTagPolicyRequest) error + + // Gets a single tag policy by its associated governed tag's key. + GetTagPolicy(ctx context.Context, request GetTagPolicyRequest) (*TagPolicy, error) + + // Lists the tag policies for all governed tags in the account. + ListTagPolicies(ctx context.Context, request ListTagPoliciesRequest) (*ListTagPoliciesResponse, error) + + // Updates an existing tag policy for a single governed tag. + UpdateTagPolicy(ctx context.Context, request UpdateTagPolicyRequest) (*TagPolicy, error) +} diff --git a/service/tags/model.go b/service/tags/model.go new file mode 100755 index 000000000..bd19a72f2 --- /dev/null +++ b/service/tags/model.go @@ -0,0 +1,207 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package tags + +import ( + "github.com/databricks/databricks-sdk-go/marshal" +) + +type CreateTagAssignmentRequest struct { + TagAssignment TagAssignment `json:"tag_assignment"` +} + +type CreateTagPolicyRequest struct { + TagPolicy TagPolicy `json:"tag_policy"` +} + +type DeleteTagAssignmentRequest struct { + // The identifier of the entity to which the tag is assigned + EntityId string `json:"-" url:"-"` + // The type of entity to which the tag is assigned + EntityType string `json:"-" url:"-"` + // The key of the tag + TagKey string `json:"-" url:"-"` +} + +type DeleteTagPolicyRequest struct { + TagKey string `json:"-" url:"-"` +} + +type GetTagAssignmentRequest struct { + // The identifier of the entity to which the tag is assigned + EntityId string `json:"-" url:"-"` + // The type of entity to which the tag is assigned + EntityType string `json:"-" url:"-"` + // The key of the tag + TagKey string `json:"-" url:"-"` +} + +type GetTagPolicyRequest struct { + TagKey string `json:"-" url:"-"` +} + +type ListTagAssignmentsRequest struct { + // The identifier of the entity to which the tag is assigned + EntityId string `json:"-" url:"-"` + // The type of entity to which the tag is assigned + EntityType string `json:"-" url:"-"` + // Optional. Maximum number of tag assignments to return in a single page + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page of tag assignments. Requests + // first page if absent. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListTagAssignmentsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListTagAssignmentsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListTagAssignmentsResponse struct { + // Pagination token to request the next page of tag assignments + NextPageToken string `json:"next_page_token,omitempty"` + + TagAssignments []TagAssignment `json:"tag_assignments,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListTagAssignmentsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListTagAssignmentsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListTagPoliciesRequest struct { + // The maximum number of results to return in this request. Fewer results + // may be returned than requested. If unspecified or set to 0, this defaults + // to 1000. The maximum value is 1000; values above 1000 will be coerced + // down to 1000. + PageSize int `json:"-" url:"page_size,omitempty"` + // An optional page token received from a previous list tag policies call. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListTagPoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListTagPoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListTagPoliciesResponse struct { + NextPageToken string `json:"next_page_token,omitempty"` + + TagPolicies []TagPolicy `json:"tag_policies,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListTagPoliciesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListTagPoliciesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type TagAssignment struct { + // The identifier of the entity to which the tag is assigned + EntityId string `json:"entity_id"` + // The type of entity to which the tag is assigned + EntityType string `json:"entity_type"` + // The key of the tag + TagKey string `json:"tag_key"` + // The value of the tag + TagValue string `json:"tag_value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *TagAssignment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s TagAssignment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type TagPolicy struct { + // Timestamp when the tag policy was created + CreateTime string `json:"create_time,omitempty"` + + Description string `json:"description,omitempty"` + + Id string `json:"id,omitempty"` + + TagKey string `json:"tag_key"` + // Timestamp when the tag policy was last updated + UpdateTime string `json:"update_time,omitempty"` + + Values []Value `json:"values,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *TagPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s TagPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type UpdateTagAssignmentRequest struct { + // The identifier of the entity to which the tag is assigned + EntityId string `json:"-" url:"-"` + // The type of entity to which the tag is assigned + EntityType string `json:"-" url:"-"` + + TagAssignment TagAssignment `json:"tag_assignment"` + // The key of the tag + TagKey string `json:"-" url:"-"` + // The field mask must be a single string, with multiple fields separated by + // commas (no spaces). The field path is relative to the resource object, + // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). + // Specification of elements in sequence or map fields is not allowed, as + // only the entire collection field can be specified. Field names must + // exactly match the resource field names. + // + // A field mask of `*` indicates full replacement. It’s recommended to + // always explicitly list the fields being updated and avoid using `*` + // wildcards, as it can lead to unintended results if the API changes in the + // future. + UpdateMask string `json:"-" url:"update_mask"` +} + +type UpdateTagPolicyRequest struct { + TagKey string `json:"-" url:"-"` + + TagPolicy TagPolicy `json:"tag_policy"` + // The field mask must be a single string, with multiple fields separated by + // commas (no spaces). The field path is relative to the resource object, + // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). + // Specification of elements in sequence or map fields is not allowed, as + // only the entire collection field can be specified. Field names must + // exactly match the resource field names. + // + // A field mask of `*` indicates full replacement. It’s recommended to + // always explicitly list the fields being updated and avoid using `*` + // wildcards, as it can lead to unintended results if the API changes in the + // future. + UpdateMask string `json:"-" url:"update_mask"` +} + +type Value struct { + Name string `json:"name"` +} diff --git a/service/vectorsearch/api.go b/service/vectorsearch/api.go index 505de8214..f1817941b 100755 --- a/service/vectorsearch/api.go +++ b/service/vectorsearch/api.go @@ -235,6 +235,9 @@ type VectorSearchIndexesInterface interface { // Triggers a synchronization process for a specified vector index. SyncIndex(ctx context.Context, request SyncIndexRequest) error + // Update the budget policy of an index + UpdateIndexBudgetPolicy(ctx context.Context, request UpdateVectorIndexUsagePolicyRequest) (*UpdateVectorIndexUsagePolicyResponse, error) + // Handles the upserting of data into a specified vector index. UpsertDataVectorIndex(ctx context.Context, request UpsertDataVectorIndexRequest) (*UpsertDataVectorIndexResponse, error) } diff --git a/service/vectorsearch/impl.go b/service/vectorsearch/impl.go index dfbc05884..a3f36325a 100755 --- a/service/vectorsearch/impl.go +++ b/service/vectorsearch/impl.go @@ -238,6 +238,16 @@ func (a *vectorSearchIndexesImpl) SyncIndex(ctx context.Context, request SyncInd return err } +func (a *vectorSearchIndexesImpl) UpdateIndexBudgetPolicy(ctx context.Context, request UpdateVectorIndexUsagePolicyRequest) (*UpdateVectorIndexUsagePolicyResponse, error) { + var updateVectorIndexUsagePolicyResponse UpdateVectorIndexUsagePolicyResponse + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/usage-policy", request.IndexName) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, nil, &updateVectorIndexUsagePolicyResponse) + return &updateVectorIndexUsagePolicyResponse, err +} + func (a *vectorSearchIndexesImpl) UpsertDataVectorIndex(ctx context.Context, request UpsertDataVectorIndexRequest) (*UpsertDataVectorIndexResponse, error) { var upsertDataVectorIndexResponse UpsertDataVectorIndexResponse path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/upsert-data", request.IndexName) diff --git a/service/vectorsearch/interface.go b/service/vectorsearch/interface.go index a5d4569da..7595219fa 100755 --- a/service/vectorsearch/interface.go +++ b/service/vectorsearch/interface.go @@ -73,6 +73,9 @@ type VectorSearchIndexesService interface { // Triggers a synchronization process for a specified vector index. SyncIndex(ctx context.Context, request SyncIndexRequest) error + // Update the budget policy of an index + UpdateIndexBudgetPolicy(ctx context.Context, request UpdateVectorIndexUsagePolicyRequest) (*UpdateVectorIndexUsagePolicyResponse, error) + // Handles the upserting of data into a specified vector index. UpsertDataVectorIndex(ctx context.Context, request UpsertDataVectorIndexRequest) (*UpsertDataVectorIndexResponse, error) } diff --git a/service/vectorsearch/model.go b/service/vectorsearch/model.go index 727e80175..ca9a4861a 100755 --- a/service/vectorsearch/model.go +++ b/service/vectorsearch/model.go @@ -30,6 +30,8 @@ type CreateEndpoint struct { EndpointType EndpointType `json:"endpoint_type"` // Name of the vector search endpoint Name string `json:"name"` + // The usage policy id to be applied once we've migrated to usage policies + UsagePolicyId string `json:"usage_policy_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -164,6 +166,10 @@ type DeltaSyncVectorIndexSpecRequest struct { // index. The primary key column and embedding source column or embedding // vector column are always synced. ColumnsToSync []string `json:"columns_to_sync,omitempty"` + // The budget policy id applied to the vector search index + EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The columns that contain the embedding source. EmbeddingSourceColumns []EmbeddingSourceColumn `json:"embedding_source_columns,omitempty"` // The columns that contain the embedding vectors. @@ -194,6 +200,10 @@ func (s DeltaSyncVectorIndexSpecRequest) MarshalJSON() ([]byte, error) { } type DeltaSyncVectorIndexSpecResponse struct { + // The budget policy id applied to the vector search index + EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The columns that contain the embedding source. EmbeddingSourceColumns []EmbeddingSourceColumn `json:"embedding_source_columns,omitempty"` // The columns that contain the embedding vectors. @@ -249,8 +259,12 @@ func (s DirectAccessVectorIndexSpec) MarshalJSON() ([]byte, error) { } type EmbeddingSourceColumn struct { - // Name of the embedding model endpoint + // Name of the embedding model endpoint, used by default for both ingestion + // and querying. EmbeddingModelEndpointName string `json:"embedding_model_endpoint_name,omitempty"` + // Name of the embedding model endpoint which, if specified, is used for + // querying (not ingestion). + ModelEndpointNameForQuery string `json:"model_endpoint_name_for_query,omitempty"` // Name of the column Name string `json:"name,omitempty"` @@ -417,8 +431,24 @@ type GetEndpointRequest struct { } type GetIndexRequest struct { + // If true, the URL returned for the index is guaranteed to be compatible + // with the reranker. Currently this means we return the CP URL regardless + // of how the index is being accessed. If not set or set to false, the URL + // may still be compatible with the reranker depending on what URL we + // return. + EnsureRerankerCompatible bool `json:"-" url:"ensure_reranker_compatible,omitempty"` // Name of the index IndexName string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GetIndexRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GetIndexRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListEndpointResponse struct { @@ -536,7 +566,8 @@ func (s MiniVectorIndex) MarshalJSON() ([]byte, error) { } type PatchEndpointBudgetPolicyRequest struct { - // The budget policy id to be applied + // The budget policy id to be applied (hima-sheth) TODO: remove this once + // we've migrated to usage policies BudgetPolicyId string `json:"budget_policy_id"` // Name of the vector search endpoint EndpointName string `json:"-" url:"-"` @@ -652,6 +683,8 @@ type QueryVectorIndexRequest struct { // Query vector. Required for Direct Vector Access Index and Delta Sync // Index using self-managed vectors. QueryVector []float64 `json:"query_vector,omitempty"` + + Reranker *RerankerConfig `json:"reranker,omitempty"` // Threshold for the approximate nearest neighbor search. Defaults to 0.0. ScoreThreshold float64 `json:"score_threshold,omitempty"` @@ -688,6 +721,26 @@ func (s QueryVectorIndexResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type RerankerConfig struct { + Model string `json:"model,omitempty"` + + Parameters *RerankerConfigRerankerParameters `json:"parameters,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *RerankerConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s RerankerConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type RerankerConfigRerankerParameters struct { + ColumnsToRerank []string `json:"columns_to_rerank,omitempty"` +} + // Data returned in the query result. type ResultData struct { // Data rows returned in the query. @@ -795,6 +848,14 @@ func (s UpdateEndpointCustomTagsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateVectorIndexUsagePolicyRequest struct { + // Name of the vector search index + IndexName string `json:"-" url:"-"` +} + +type UpdateVectorIndexUsagePolicyResponse struct { +} + type UpsertDataResult struct { // List of primary keys for rows that failed to process. FailedPrimaryKeys []string `json:"failed_primary_keys,omitempty"` diff --git a/service/workspace/model.go b/service/workspace/model.go index e5f15db8d..a5d64cfea 100755 --- a/service/workspace/model.go +++ b/service/workspace/model.go @@ -335,6 +335,43 @@ func (f *ExportFormat) Type() string { return "ExportFormat" } +type ExportOutputs string + +const ExportOutputsAll ExportOutputs = `ALL` + +const ExportOutputsNone ExportOutputs = `NONE` + +// String representation for [fmt.Print] +func (f *ExportOutputs) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ExportOutputs) Set(v string) error { + switch v { + case `ALL`, `NONE`: + *f = ExportOutputs(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ALL", "NONE"`, v) + } +} + +// Values returns all possible values for ExportOutputs. +// +// There is no guarantee on the order of the values in the slice. +func (f *ExportOutputs) Values() []ExportOutputs { + return []ExportOutputs{ + ExportOutputsAll, + ExportOutputsNone, + } +} + +// Type always returns ExportOutputs to satisfy [pflag.Value] interface +func (f *ExportOutputs) Type() string { + return "ExportOutputs" +} + type ExportRequest struct { // This specifies the format of the exported file. By default, this is // `SOURCE`. @@ -351,6 +388,12 @@ type ExportRequest struct { // on the objects type. Directory exports will include notebooks and // workspace files. Format ExportFormat `json:"-" url:"format,omitempty"` + // This specifies which cell outputs should be included in the export (if + // the export format allows it). If not specified, the behavior is + // determined by the format. For JUPYTER format, the default is to include + // all outputs. This is a public endpoint, but only ALL or NONE is + // documented publically, DATABRICKS is internal only + Outputs ExportOutputs `json:"-" url:"outputs,omitempty"` // The absolute path of the object or directory. Exporting a directory is // only supported for the `DBC`, `SOURCE`, and `AUTO` format. Path string `json:"-" url:"path"` diff --git a/workspace_client.go b/workspace_client.go index 728698a03..850853e73 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -18,6 +18,7 @@ import ( "github.com/databricks/databricks-sdk-go/service/database" "github.com/databricks/databricks-sdk-go/service/files" "github.com/databricks/databricks-sdk-go/service/iam" + "github.com/databricks/databricks-sdk-go/service/iamv2" "github.com/databricks/databricks-sdk-go/service/jobs" "github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/ml" @@ -26,8 +27,10 @@ import ( "github.com/databricks/databricks-sdk-go/service/qualitymonitorv2" "github.com/databricks/databricks-sdk-go/service/serving" "github.com/databricks/databricks-sdk-go/service/settings" + "github.com/databricks/databricks-sdk-go/service/settingsv2" "github.com/databricks/databricks-sdk-go/service/sharing" "github.com/databricks/databricks-sdk-go/service/sql" + "github.com/databricks/databricks-sdk-go/service/tags" "github.com/databricks/databricks-sdk-go/service/vectorsearch" "github.com/databricks/databricks-sdk-go/service/workspace" ) @@ -78,6 +81,10 @@ type WorkspaceClient struct { // interact through single sign-on. Apps apps.AppsInterface + // Apps Settings manage the settings for the Apps service on a customer's + // Databricks instance. + AppsSettings apps.AppsSettingsInterface + // In Databricks Runtime 13.3 and above, you can add libraries and init // scripts to the `allowlist` in UC so that users can leverage these // artifacts on compute configured with shared access mode. @@ -259,6 +266,10 @@ type WorkspaceClient struct { // SQL. Database database.DatabaseInterface + // Database Projects provide access to a database via REST API or direct + // SQL. + DatabaseProject database.DatabaseProjectInterface + // DBFS API makes it simple to interact with various data sources without // having to include a users credentials every time to read a file. Dbfs files.DbfsInterface @@ -283,6 +294,13 @@ type WorkspaceClient struct { // [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html DbsqlPermissions sql.DbsqlPermissionsInterface + // Tags are attributes that include keys and optional values that you can + // use to organize and categorize entities in Unity Catalog. Entity tagging + // is currently supported on catalogs, schemas, tables (including views), + // columns, volumes. With these APIs, users can create, update, delete, and + // list tag assignments across Unity Catalog entities + EntityTagAssignments catalog.EntityTagAssignmentsInterface + // Experiments are the primary unit of organization in MLflow; all MLflow // runs belong to an experiment. Each experiment lets you visualize, search, // and compare runs, as well as download run artifacts or metadata for @@ -328,6 +346,9 @@ type WorkspaceClient struct { // metadata objects. ExternalMetadata catalog.ExternalMetadataInterface + // [description] + FeatureEngineering ml.FeatureEngineeringInterface + // A feature store is a centralized repository that enables data scientists // to find and share features. Using a feature store also ensures that the // code used to compute feature values is the same during model training and @@ -422,7 +443,7 @@ type WorkspaceClient struct { // policies in Unity Catalog to groups, instead of to users individually. // All Databricks workspace identities can be assigned as members of groups, // and members inherit permissions that are assigned to their group. - Groups iam.GroupsInterface + GroupsV2 iam.GroupsV2Interface // Instance Pools API are used to create, edit, delete and list instance // pools by using ready-to-use cloud instances which reduces a cluster start @@ -742,6 +763,9 @@ type WorkspaceClient struct { // [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html QueriesLegacy sql.QueriesLegacyInterface + // Query execution APIs for AI / BI Dashboards + QueryExecution dashboards.QueryExecutionInterface + // A service responsible for storing and retrieving the list of queries run // against SQL endpoints and serverless compute. QueryHistory sql.QueryHistoryInterface @@ -880,6 +904,15 @@ type WorkspaceClient struct { // [Unity Catalog documentation]: https://docs.databricks.com/en/data-governance/unity-catalog/index.html#resource-quotas ResourceQuotas catalog.ResourceQuotasInterface + // Request for Access enables customers to request access to and manage + // access request destinations for Unity Catalog securables. + // + // These APIs provide a standardized way to update, get, and request to + // access request destinations. Fine-grained authorization ensures that only + // users with appropriate permissions can manage access request + // destinations. + Rfa catalog.RfaInterface + // A schema (also called a database) is the second layer of Unity // Catalog’s three-level namespace. A schema organizes tables, views and // functions. To access (or list) a table or view in a schema, users must @@ -925,7 +958,7 @@ type WorkspaceClient struct { // interactive users do not need any write, delete, or modify privileges in // production. This eliminates the risk of a user overwriting production // data by accident. - ServicePrincipals iam.ServicePrincipalsInterface + ServicePrincipalsV2 iam.ServicePrincipalsV2Interface // The Serving Endpoints API allows you to create, update, and delete model // serving endpoints. @@ -1119,6 +1152,16 @@ type WorkspaceClient struct { // is a particular kind of table (rather than a managed or external table). Tables catalog.TablesInterface + // Manage tag assignments on workspace-scoped objects. + TagAssignments tags.TagAssignmentsInterface + + // The Tag Policy API allows you to manage policies for governed tags in + // Databricks. Permissions for tag policies can be managed using the + // [Account Access Control Proxy API]. + // + // [Account Access Control Proxy API]: https://docs.databricks.com/api/workspace/accountaccesscontrolproxy + TagPolicies tags.TagPoliciesInterface + // Temporary Path Credentials refer to short-lived, downscoped credentials // used to access external cloud storage locations registered in Databricks. // These credentials are employed to provide secure and time-limited access @@ -1190,7 +1233,7 @@ type WorkspaceClient struct { // user in your identity provider and that user’s account will also be // removed from Databricks workspace. This ensures a consistent offboarding // process and prevents unauthorized users from accessing sensitive data. - Users iam.UsersInterface + UsersV2 iam.UsersV2Interface // **Endpoint**: Represents the compute resources to host vector search // indexes. @@ -1257,6 +1300,51 @@ type WorkspaceClient struct { // This API allows updating known workspace settings for advanced users. WorkspaceConf settings.WorkspaceConfInterface + + // These APIs are used to manage identities and the workspace access of + // these identities in . + WorkspaceIamV2 iamv2.WorkspaceIamV2Interface + + // APIs to manage workspace level settings + WorkspaceSettingsV2 settingsv2.WorkspaceSettingsV2Interface + + // Groups simplify identity management, making it easier to assign access to + // Databricks workspace, data, and other securable objects. + // + // It is best practice to assign access to workspaces and access-control + // policies in Unity Catalog to groups, instead of to users individually. + // All Databricks workspace identities can be assigned as members of groups, + // and members inherit permissions that are assigned to their group. + // + // Deprecated: Use the GroupsV2 API instead. + Groups iam.GroupsInterface + + // Identities for use with jobs, automated tools, and systems such as + // scripts, apps, and CI/CD platforms. Databricks recommends creating + // service principals to run production jobs or modify production data. If + // all processes that act on production data run with service principals, + // interactive users do not need any write, delete, or modify privileges in + // production. This eliminates the risk of a user overwriting production + // data by accident. + // + // Deprecated: Use the ServicePrincipalsV2 API instead. + ServicePrincipals iam.ServicePrincipalsInterface + + // User identities recognized by Databricks and represented by email + // addresses. + // + // Databricks recommends using SCIM provisioning to sync users and groups + // automatically from your identity provider to your Databricks workspace. + // SCIM streamlines onboarding a new employee or team by using your identity + // provider to create users and groups in Databricks workspace and give them + // the proper level of access. When a user leaves your organization or no + // longer needs access to Databricks workspace, admins can terminate the + // user in your identity provider and that user’s account will also be + // removed from Databricks workspace. This ensures a consistent offboarding + // process and prevents unauthorized users from accessing sensitive data. + // + // Deprecated: Use the UsersV2 API instead. + Users iam.UsersInterface } var ErrNotWorkspaceClient = errors.New("invalid Databricks Workspace configuration") @@ -1300,6 +1388,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { AlertsLegacy: sql.NewAlertsLegacy(databricksClient), AlertsV2: sql.NewAlertsV2(databricksClient), Apps: apps.NewApps(databricksClient), + AppsSettings: apps.NewAppsSettings(databricksClient), ArtifactAllowlists: catalog.NewArtifactAllowlists(databricksClient), Catalogs: catalog.NewCatalogs(databricksClient), CleanRoomAssetRevisions: cleanrooms.NewCleanRoomAssetRevisions(databricksClient), @@ -1323,12 +1412,15 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { Dashboards: sql.NewDashboards(databricksClient), DataSources: sql.NewDataSources(databricksClient), Database: database.NewDatabase(databricksClient), + DatabaseProject: database.NewDatabaseProject(databricksClient), Dbfs: files.NewDbfs(databricksClient), DbsqlPermissions: sql.NewDbsqlPermissions(databricksClient), + EntityTagAssignments: catalog.NewEntityTagAssignments(databricksClient), Experiments: ml.NewExperiments(databricksClient), ExternalLineage: catalog.NewExternalLineage(databricksClient), ExternalLocations: catalog.NewExternalLocations(databricksClient), ExternalMetadata: catalog.NewExternalMetadata(databricksClient), + FeatureEngineering: ml.NewFeatureEngineering(databricksClient), FeatureStore: ml.NewFeatureStore(databricksClient), Files: files.NewFiles(databricksClient), Forecasting: ml.NewForecasting(databricksClient), @@ -1337,7 +1429,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { GitCredentials: workspace.NewGitCredentials(databricksClient), GlobalInitScripts: compute.NewGlobalInitScripts(databricksClient), Grants: catalog.NewGrants(databricksClient), - Groups: iam.NewGroups(databricksClient), + GroupsV2: iam.NewGroupsV2(databricksClient), InstancePools: compute.NewInstancePools(databricksClient), InstanceProfiles: compute.NewInstanceProfiles(databricksClient), IpAccessLists: settings.NewIpAccessLists(databricksClient), @@ -1370,6 +1462,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { QualityMonitors: catalog.NewQualityMonitors(databricksClient), Queries: sql.NewQueries(databricksClient), QueriesLegacy: sql.NewQueriesLegacy(databricksClient), + QueryExecution: dashboards.NewQueryExecution(databricksClient), QueryHistory: sql.NewQueryHistory(databricksClient), QueryVisualizations: sql.NewQueryVisualizations(databricksClient), QueryVisualizationsLegacy: sql.NewQueryVisualizationsLegacy(databricksClient), @@ -1380,10 +1473,11 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { RegisteredModels: catalog.NewRegisteredModels(databricksClient), Repos: workspace.NewRepos(databricksClient), ResourceQuotas: catalog.NewResourceQuotas(databricksClient), + Rfa: catalog.NewRfa(databricksClient), Schemas: catalog.NewSchemas(databricksClient), Secrets: workspace.NewSecrets(databricksClient), ServicePrincipalSecretsProxy: oauth2.NewServicePrincipalSecretsProxy(databricksClient), - ServicePrincipals: iam.NewServicePrincipals(databricksClient), + ServicePrincipalsV2: iam.NewServicePrincipalsV2(databricksClient), ServingEndpoints: servingEndpoints, ServingEndpointsDataPlane: serving.NewServingEndpointsDataPlane(databricksClient, servingEndpoints), Settings: settings.NewSettings(databricksClient), @@ -1393,11 +1487,13 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { SystemSchemas: catalog.NewSystemSchemas(databricksClient), TableConstraints: catalog.NewTableConstraints(databricksClient), Tables: catalog.NewTables(databricksClient), + TagAssignments: tags.NewTagAssignments(databricksClient), + TagPolicies: tags.NewTagPolicies(databricksClient), TemporaryPathCredentials: catalog.NewTemporaryPathCredentials(databricksClient), TemporaryTableCredentials: catalog.NewTemporaryTableCredentials(databricksClient), TokenManagement: settings.NewTokenManagement(databricksClient), Tokens: settings.NewTokens(databricksClient), - Users: iam.NewUsers(databricksClient), + UsersV2: iam.NewUsersV2(databricksClient), VectorSearchEndpoints: vectorsearch.NewVectorSearchEndpoints(databricksClient), VectorSearchIndexes: vectorsearch.NewVectorSearchIndexes(databricksClient), Volumes: catalog.NewVolumes(databricksClient), @@ -1405,5 +1501,10 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { Workspace: workspace.NewWorkspace(databricksClient), WorkspaceBindings: catalog.NewWorkspaceBindings(databricksClient), WorkspaceConf: settings.NewWorkspaceConf(databricksClient), + WorkspaceIamV2: iamv2.NewWorkspaceIamV2(databricksClient), + WorkspaceSettingsV2: settingsv2.NewWorkspaceSettingsV2(databricksClient), + Groups: iam.NewGroups(databricksClient), + ServicePrincipals: iam.NewServicePrincipals(databricksClient), + Users: iam.NewUsers(databricksClient), }, nil }