diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 097cd4891..bdd95ecce 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -25becc311a99e04a1cad9b7953dcb928ade9dade \ No newline at end of file +f2843dd06e095a39dda2d454a97ceaf6767a2bf3 \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 75d7e2eef..944da6a82 100644 --- a/.gitattributes +++ b/.gitattributes @@ -66,14 +66,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/iamv2/mock_account_iam_v2_interface.go linguist-generated=true experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go linguist-generated=true @@ -92,6 +98,7 @@ experimental/mocks/service/marketplace/mock_provider_personalization_requests_in experimental/mocks/service/marketplace/mock_provider_provider_analytics_dashboards_interface.go linguist-generated=true experimental/mocks/service/marketplace/mock_provider_providers_interface.go linguist-generated=true experimental/mocks/service/ml/mock_experiments_interface.go linguist-generated=true +experimental/mocks/service/ml/mock_feature_engineering_interface.go linguist-generated=true experimental/mocks/service/ml/mock_feature_store_interface.go linguist-generated=true experimental/mocks/service/ml/mock_forecasting_interface.go linguist-generated=true experimental/mocks/service/ml/mock_materialized_features_interface.go linguist-generated=true @@ -180,12 +187,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 diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 98279f663..c5742218a 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -19,84 +19,20 @@ * Added `CreateTime` and `UpdateTime` fields for [tags.TagPolicy](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/tags#TagPolicy). * Added `TableDeltaUniformIcebergForeignDeltasharing` enum value for [catalog.SecurableKind](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#SecurableKind). * Added `InternalCatalogPathOverlapException` enum value for [dashboards.MessageErrorType](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#MessageErrorType). -* [Breaking] Changed `CreationTime` field for [agentbricks.CustomLlm](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/agentbricks#CustomLlm) to type `string`. -* [Breaking] Changed `UpdateMask` field for [agentbricks.UpdateCustomLlmRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/agentbricks#UpdateCustomLlmRequest) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [apps.App](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#App) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [apps.AppDeployment](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#AppDeployment) to type `string`. -* [Breaking] Changed `Timestamp` field for [catalog.ContinuousUpdateStatus](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ContinuousUpdateStatus) to type `string`. -* [Breaking] Changed `EventTime` field for [catalog.ExternalLineageExternalMetadataInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ExternalLineageExternalMetadataInfo) to type `string`. -* [Breaking] Changed `EventTime` field for [catalog.ExternalLineageFileInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ExternalLineageFileInfo) to type `string`. -* [Breaking] Changed `EventTime` field for [catalog.ExternalLineageModelVersionInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ExternalLineageModelVersionInfo) to type `string`. -* [Breaking] Changed `EventTime` field for [catalog.ExternalLineageTableInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ExternalLineageTableInfo) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [catalog.ExternalMetadata](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ExternalMetadata) to type `string`. -* [Breaking] Changed `Timestamp` field for [catalog.FailedStatus](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#FailedStatus) to type `string`. -* [Breaking] Changed `Timestamp` field for [catalog.TriggeredUpdateStatus](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#TriggeredUpdateStatus) to type `string`. -* [Breaking] Changed `UpdateMask` field for [catalog.UpdateAccessRequestDestinationsRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#UpdateAccessRequestDestinationsRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [catalog.UpdateEntityTagAssignmentRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#UpdateEntityTagAssignmentRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [catalog.UpdateExternalLineageRelationshipRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#UpdateExternalLineageRelationshipRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [catalog.UpdateExternalMetadataRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#UpdateExternalMetadataRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [catalog.UpdatePolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#UpdatePolicyRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [compute.UpdateCluster](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/compute#UpdateCluster) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [dashboards.Dashboard](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#Dashboard) to type `string`. -* [Breaking] Changed `RevisionCreateTime` field for [dashboards.PublishedDashboard](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#PublishedDashboard) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [dashboards.Schedule](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#Schedule) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [dashboards.Subscription](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#Subscription) to type `string`. -* [Breaking] Changed `ExpirationTime` field for [database.DatabaseCredential](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/database#DatabaseCredential) to type `string`. -* [Breaking] Changed `CreationTime` field for [database.DatabaseInstance](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/database#DatabaseInstance) to type `string`. -* [Breaking] Changed `BranchTime` field for [database.DatabaseInstanceRef](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/database#DatabaseInstanceRef) to type `string`. -* [Breaking] Changed `DeltaCommitTimestamp` field for [database.DeltaTableSyncInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/database#DeltaTableSyncInfo) to type `string`. -* [Breaking] Changed `Timestamp` field for [database.SyncedTableContinuousUpdateStatus](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/database#SyncedTableContinuousUpdateStatus) to type `string`. -* [Breaking] Changed `Timestamp` field for [database.SyncedTableFailedStatus](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/database#SyncedTableFailedStatus) to type `string`. -* [Breaking] Changed `SyncEndTimestamp` and `SyncStartTimestamp` fields for [database.SyncedTablePosition](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/database#SyncedTablePosition) to type `string`. -* [Breaking] Changed `Timestamp` field for [database.SyncedTableTriggeredUpdateStatus](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/database#SyncedTableTriggeredUpdateStatus) to type `string`. -* [Breaking] Changed `UpdateMask` field for [database.UpdateDatabaseCatalogRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/database#UpdateDatabaseCatalogRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [database.UpdateDatabaseInstanceRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/database#UpdateDatabaseInstanceRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [database.UpdateSyncedDatabaseTableRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/database#UpdateSyncedDatabaseTableRequest) to type `string`. -* [Breaking] Changed `CreationTime` field for [ml.OnlineStore](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/ml#OnlineStore) to type `string`. -* [Breaking] Changed `UpdateMask` field for [ml.UpdateFeatureTagRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/ml#UpdateFeatureTagRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [ml.UpdateOnlineStoreRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/ml#UpdateOnlineStoreRequest) to type `string`. -* [Breaking] Changed `Lifetime` field for [oauth2.CreateServicePrincipalSecretRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#CreateServicePrincipalSecretRequest) to type `string`. -* [Breaking] Changed `ExpireTime` field for [oauth2.CreateServicePrincipalSecretResponse](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#CreateServicePrincipalSecretResponse) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [oauth2.FederationPolicy](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#FederationPolicy) to type `string`. -* [Breaking] Changed `ExpireTime` field for [oauth2.SecretInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#SecretInfo) to type `string`. -* [Breaking] Changed `UpdateMask` field for [oauth2.UpdateAccountFederationPolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#UpdateAccountFederationPolicyRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [oauth2.UpdateServicePrincipalFederationPolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#UpdateServicePrincipalFederationPolicyRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateAccountIpAccessEnableRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateAccountIpAccessEnableRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateAibiDashboardEmbeddingAccessPolicySettingRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateAutomaticClusterUpdateSettingRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateAutomaticClusterUpdateSettingRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateComplianceSecurityProfileSettingRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateComplianceSecurityProfileSettingRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateCspEnablementAccountSettingRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateCspEnablementAccountSettingRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateDashboardEmailSubscriptionsRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateDashboardEmailSubscriptionsRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateDefaultNamespaceSettingRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateDefaultNamespaceSettingRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateDefaultWarehouseIdRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateDefaultWarehouseIdRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateDisableLegacyAccessRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateDisableLegacyAccessRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateDisableLegacyDbfsRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateDisableLegacyDbfsRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateDisableLegacyFeaturesRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateDisableLegacyFeaturesRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateEnableExportNotebookRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateEnableExportNotebookRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateEnableNotebookTableClipboardRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateEnableNotebookTableClipboardRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateEnableResultsDownloadingRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateEnableResultsDownloadingRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateEnhancedSecurityMonitoringSettingRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateEnhancedSecurityMonitoringSettingRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateEsmEnablementAccountSettingRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateEsmEnablementAccountSettingRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateLlmProxyPartnerPoweredAccountRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateLlmProxyPartnerPoweredAccountRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateLlmProxyPartnerPoweredEnforceRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateLlmProxyPartnerPoweredEnforceRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateLlmProxyPartnerPoweredWorkspaceRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateLlmProxyPartnerPoweredWorkspaceRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [settings.UpdateNccPrivateEndpointRuleRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateNccPrivateEndpointRuleRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdatePersonalComputeSettingRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdatePersonalComputeSettingRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateRestrictWorkspaceAdminsSettingRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateRestrictWorkspaceAdminsSettingRequest) to type `string`. -* [Breaking] Changed `FieldMask` field for [settings.UpdateSqlResultsDownloadRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#UpdateSqlResultsDownloadRequest) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [sharing.FederationPolicy](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#FederationPolicy) to type `string`. -* [Breaking] Changed `UpdateMask` field for [sharing.UpdateFederationPolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#UpdateFederationPolicyRequest) to type `string`. -* [Breaking] Changed `CreateTime`, `TriggerTime` and `UpdateTime` fields for [sql.Alert](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#Alert) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [sql.AlertV2](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#AlertV2) to type `string`. -* [Breaking] Changed `LastEvaluatedAt` field for [sql.AlertV2Evaluation](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#AlertV2Evaluation) to type `string`. -* [Breaking] Changed `CreateTime`, `TriggerTime` and `UpdateTime` fields for [sql.ListAlertsResponseAlert](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#ListAlertsResponseAlert) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [sql.ListQueryObjectsResponseQuery](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#ListQueryObjectsResponseQuery) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [sql.Query](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#Query) to type `string`. -* [Breaking] Changed `UpdateMask` field for [sql.UpdateAlertRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#UpdateAlertRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [sql.UpdateAlertV2Request](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#UpdateAlertV2Request) to type `string`. -* [Breaking] Changed `UpdateMask` field for [sql.UpdateQueryRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#UpdateQueryRequest) to type `string`. -* [Breaking] Changed `UpdateMask` field for [sql.UpdateVisualizationRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#UpdateVisualizationRequest) to type `string`. -* [Breaking] Changed `CreateTime` and `UpdateTime` fields for [sql.Visualization](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#Visualization) to type `string`. -* [Breaking] Changed `UpdateMask` field for [tags.UpdateTagPolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/tags#UpdateTagPolicyRequest) to type `string`. -* [Breaking] Removed `DefaultDataSecurityMode` and `EffectiveDefaultDataSecurityMode` fields for [settingsv2.Setting](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settingsv2#Setting). \ No newline at end of file +* [Breaking] Removed `DefaultDataSecurityMode` and `EffectiveDefaultDataSecurityMode` fields for [settingsv2.Setting](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settingsv2#Setting). +* Added [a.AccountGroupsV2](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/iam#AccountGroupsV2API) account-level service, [a.AccountServicePrincipalsV2](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/iam#AccountServicePrincipalsV2API) account-level service, [a.AccountUsersV2](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/iam#AccountUsersV2API) account-level service, [w.GroupsV2](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/iam#GroupsV2API) workspace-level service, [w.ServicePrincipalsV2](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/iam#ServicePrincipalsV2API) workspace-level service and [w.UsersV2](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/iam#UsersV2API) workspace-level service. +* Added `NetsuiteJarPath` field for [pipelines.IngestionPipelineDefinition](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#IngestionPipelineDefinition). +* Added `WorkdayReportParameters` field for [pipelines.TableSpecificConfig](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#TableSpecificConfig). +* Added `InternalCatalogMissingUcPathException` enum value for [dashboards.MessageErrorType](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#MessageErrorType). +* Added `ListShares` method for [w.Shares](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#SharesAPI) workspace-level service. +* [Breaking] Removed `List` method for [w.Shares](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#SharesAPI) workspace-level service. +* Added `SuggestedQuestions` field for [dashboards.GenieAttachment](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#GenieAttachment). +* Added `WarehouseId` field for [dashboards.GenieSpace](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#GenieSpace). +* Added `Palantir` enum value for [catalog.ConnectionType](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ConnectionType). +* Added `TableMetricViewDeltasharing` and `TableForeignPalantir` enum values for [catalog.SecurableKind](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#SecurableKind). +* Added `NoActivatedK8sTestingTag` enum value for [compute.TerminationReasonCode](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/compute#TerminationReasonCode). +* Added `MetricView` enum value for [sharing.TableInternalAttributesSharedTableType](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#TableInternalAttributesSharedTableType). +* [Breaking] Removed `FollowupQuestions` field for [dashboards.GenieAttachment](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#GenieAttachment). +* [Breaking] Removed `Comment` field for [dashboards.GenieFeedback](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#GenieFeedback). +* [Breaking] Removed `Comment` field for [dashboards.GenieSendMessageFeedbackRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#GenieSendMessageFeedbackRequest). +* Added `ExternalUseSchema` enum value for [catalog.Privilege](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#Privilege). \ No newline at end of file diff --git a/account_client.go b/account_client.go index 4ba36f3fd..74c73798e 100755 --- a/account_client.go +++ b/account_client.go @@ -133,7 +133,7 @@ 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 . @@ -358,7 +358,7 @@ 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. @@ -396,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 @@ -425,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") @@ -463,7 +501,7 @@ 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), @@ -477,16 +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 b83a5a79f..8ba9b74db 100755 --- a/experimental/mocks/mock_account_client.go +++ b/experimental/mocks/mock_account_client.go @@ -40,7 +40,7 @@ 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), @@ -54,13 +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), @@ -214,10 +214,10 @@ 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 } @@ -326,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 } @@ -374,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 971e828ea..e446151f6 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -95,7 +95,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), @@ -142,7 +142,7 @@ func NewMockWorkspaceClient(t interface { 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), @@ -157,7 +157,7 @@ func NewMockWorkspaceClient(t interface { 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), @@ -727,10 +727,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 } @@ -1103,10 +1103,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 } @@ -1223,10 +1223,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 } diff --git a/experimental/mocks/mocks_test.go b/experimental/mocks/mocks_test.go index 538e73f41..08e810820 100644 --- a/experimental/mocks/mocks_test.go +++ b/experimental/mocks/mocks_test.go @@ -35,12 +35,12 @@ func TestMockWorkspaceClient(t *testing.T) { func TestAccountWorkspaceClient(t *testing.T) { ctx := context.Background() w := NewMockAccountClient(t) - mockUsers := w.GetMockAccountUsersAPI() + mockUsers := w.GetMockAccountUsersV2API() mockUsers.EXPECT().ListAll( ctx, mock.AnythingOfType("iam.ListAccountUsersRequest"), ).Return( - []iam.User{ + []iam.AccountUser{ {DisplayName: "test-user-1"}, {DisplayName: "test-user-2"}, }, nil) @@ -57,6 +57,6 @@ func listClusters(ctx context.Context, w *databricks.WorkspaceClient) ([]compute return w.Clusters.ListAll(ctx, compute.ListClustersRequest{}) } -func listAccountUsers(ctx context.Context, a *databricks.AccountClient) ([]iam.User, error) { - return a.Users.ListAll(ctx, iam.ListAccountUsersRequest{}) +func listAccountUsers(ctx context.Context, a *databricks.AccountClient) ([]iam.AccountUser, error) { + return a.UsersV2.ListAll(ctx, iam.ListAccountUsersRequest{}) } 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..dd7f765e6 --- /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.AccountUser] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[iam.AccountUser] + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountUsersRequest) listing.Iterator[iam.AccountUser]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[iam.AccountUser]) + } + } + + 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.AccountUser]) *MockAccountUsersV2Interface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountUsersV2Interface_List_Call) RunAndReturn(run func(context.Context, iam.ListAccountUsersRequest) listing.Iterator[iam.AccountUser]) *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.AccountUser, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []iam.AccountUser + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountUsersRequest) ([]iam.AccountUser, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.ListAccountUsersRequest) []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.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.AccountUser, _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.AccountUser, 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/sharing/mock_shares_interface.go b/experimental/mocks/service/sharing/mock_shares_interface.go index f66a01665..5102cee33 100644 --- a/experimental/mocks/service/sharing/mock_shares_interface.go +++ b/experimental/mocks/service/sharing/mock_shares_interface.go @@ -403,6 +403,114 @@ func (_c *MockSharesInterface_ListAll_Call) RunAndReturn(run func(context.Contex return _c } +// ListShares provides a mock function with given fields: ctx, request +func (_m *MockSharesInterface) ListShares(ctx context.Context, request sharing.SharesListRequest) listing.Iterator[sharing.ShareInfo] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListShares") + } + + var r0 listing.Iterator[sharing.ShareInfo] + if rf, ok := ret.Get(0).(func(context.Context, sharing.SharesListRequest) listing.Iterator[sharing.ShareInfo]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[sharing.ShareInfo]) + } + } + + return r0 +} + +// MockSharesInterface_ListShares_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListShares' +type MockSharesInterface_ListShares_Call struct { + *mock.Call +} + +// ListShares is a helper method to define mock.On call +// - ctx context.Context +// - request sharing.SharesListRequest +func (_e *MockSharesInterface_Expecter) ListShares(ctx interface{}, request interface{}) *MockSharesInterface_ListShares_Call { + return &MockSharesInterface_ListShares_Call{Call: _e.mock.On("ListShares", ctx, request)} +} + +func (_c *MockSharesInterface_ListShares_Call) Run(run func(ctx context.Context, request sharing.SharesListRequest)) *MockSharesInterface_ListShares_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(sharing.SharesListRequest)) + }) + return _c +} + +func (_c *MockSharesInterface_ListShares_Call) Return(_a0 listing.Iterator[sharing.ShareInfo]) *MockSharesInterface_ListShares_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockSharesInterface_ListShares_Call) RunAndReturn(run func(context.Context, sharing.SharesListRequest) listing.Iterator[sharing.ShareInfo]) *MockSharesInterface_ListShares_Call { + _c.Call.Return(run) + return _c +} + +// ListSharesAll provides a mock function with given fields: ctx, request +func (_m *MockSharesInterface) ListSharesAll(ctx context.Context, request sharing.SharesListRequest) ([]sharing.ShareInfo, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListSharesAll") + } + + var r0 []sharing.ShareInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, sharing.SharesListRequest) ([]sharing.ShareInfo, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, sharing.SharesListRequest) []sharing.ShareInfo); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]sharing.ShareInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, sharing.SharesListRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockSharesInterface_ListSharesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSharesAll' +type MockSharesInterface_ListSharesAll_Call struct { + *mock.Call +} + +// ListSharesAll is a helper method to define mock.On call +// - ctx context.Context +// - request sharing.SharesListRequest +func (_e *MockSharesInterface_Expecter) ListSharesAll(ctx interface{}, request interface{}) *MockSharesInterface_ListSharesAll_Call { + return &MockSharesInterface_ListSharesAll_Call{Call: _e.mock.On("ListSharesAll", ctx, request)} +} + +func (_c *MockSharesInterface_ListSharesAll_Call) Run(run func(ctx context.Context, request sharing.SharesListRequest)) *MockSharesInterface_ListSharesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(sharing.SharesListRequest)) + }) + return _c +} + +func (_c *MockSharesInterface_ListSharesAll_Call) Return(_a0 []sharing.ShareInfo, _a1 error) *MockSharesInterface_ListSharesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockSharesInterface_ListSharesAll_Call) RunAndReturn(run func(context.Context, sharing.SharesListRequest) ([]sharing.ShareInfo, error)) *MockSharesInterface_ListSharesAll_Call { + _c.Call.Return(run) + return _c +} + // SharePermissions provides a mock function with given fields: ctx, request func (_m *MockSharesInterface) SharePermissions(ctx context.Context, request sharing.SharePermissionsRequest) (*sharing.GetSharePermissionsResponse, 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..7be55d4ba 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,24 +43,36 @@ 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") { queryParams["repeated_complex_query_param"] = request.RepeatedComplexQueryParam } + if request.RepeatedQueryParam != nil || slices.Contains(request.ForceSendFields, "RepeatedQueryParam") { queryParams["repeated_query_param"] = request.RepeatedQueryParam } 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/apps/impl.go b/service/apps/impl.go index 86e0183cc..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 } 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/impl.go b/service/catalog/impl.go index 70853eef1..c62c2c01b 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -666,6 +666,7 @@ func (a *entityTagAssignmentsImpl) Update(ctx context.Context, request UpdateEnt 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 } @@ -748,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 } @@ -941,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 } @@ -1453,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 } @@ -1777,6 +1781,7 @@ func (a *rfaImpl) UpdateAccessRequestDestinations(ctx context.Context, request U var accessRequestDestinations AccessRequestDestinations path := "/api/3.0/rfa/destinations" queryParams := make(map[string]any) + if request.UpdateMask != "" { queryParams["update_mask"] = request.UpdateMask } diff --git a/service/catalog/model.go b/service/catalog/model.go index e440a7bf6..f4190d724 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -850,7 +850,7 @@ func (s ConnectionInfo) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Next Id: 37 +// Next Id: 38 type ConnectionType string const ConnectionTypeBigquery ConnectionType = `BIGQUERY` @@ -869,6 +869,8 @@ const ConnectionTypeMysql ConnectionType = `MYSQL` const ConnectionTypeOracle ConnectionType = `ORACLE` +const ConnectionTypePalantir ConnectionType = `PALANTIR` + const ConnectionTypePostgresql ConnectionType = `POSTGRESQL` const ConnectionTypePowerBi ConnectionType = `POWER_BI` @@ -901,11 +903,11 @@ func (f *ConnectionType) String() string { // Set raw string value and validate it against allowed values func (f *ConnectionType) Set(v string) error { switch v { - case `BIGQUERY`, `DATABRICKS`, `GA4_RAW_DATA`, `GLUE`, `HIVE_METASTORE`, `HTTP`, `MYSQL`, `ORACLE`, `POSTGRESQL`, `POWER_BI`, `REDSHIFT`, `SALESFORCE`, `SALESFORCE_DATA_CLOUD`, `SERVICENOW`, `SNOWFLAKE`, `SQLDW`, `SQLSERVER`, `TERADATA`, `UNKNOWN_CONNECTION_TYPE`, `WORKDAY_RAAS`: + case `BIGQUERY`, `DATABRICKS`, `GA4_RAW_DATA`, `GLUE`, `HIVE_METASTORE`, `HTTP`, `MYSQL`, `ORACLE`, `PALANTIR`, `POSTGRESQL`, `POWER_BI`, `REDSHIFT`, `SALESFORCE`, `SALESFORCE_DATA_CLOUD`, `SERVICENOW`, `SNOWFLAKE`, `SQLDW`, `SQLSERVER`, `TERADATA`, `UNKNOWN_CONNECTION_TYPE`, `WORKDAY_RAAS`: *f = ConnectionType(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "BIGQUERY", "DATABRICKS", "GA4_RAW_DATA", "GLUE", "HIVE_METASTORE", "HTTP", "MYSQL", "ORACLE", "POSTGRESQL", "POWER_BI", "REDSHIFT", "SALESFORCE", "SALESFORCE_DATA_CLOUD", "SERVICENOW", "SNOWFLAKE", "SQLDW", "SQLSERVER", "TERADATA", "UNKNOWN_CONNECTION_TYPE", "WORKDAY_RAAS"`, v) + return fmt.Errorf(`value "%s" is not one of "BIGQUERY", "DATABRICKS", "GA4_RAW_DATA", "GLUE", "HIVE_METASTORE", "HTTP", "MYSQL", "ORACLE", "PALANTIR", "POSTGRESQL", "POWER_BI", "REDSHIFT", "SALESFORCE", "SALESFORCE_DATA_CLOUD", "SERVICENOW", "SNOWFLAKE", "SQLDW", "SQLSERVER", "TERADATA", "UNKNOWN_CONNECTION_TYPE", "WORKDAY_RAAS"`, v) } } @@ -922,6 +924,7 @@ func (f *ConnectionType) Values() []ConnectionType { ConnectionTypeHttp, ConnectionTypeMysql, ConnectionTypeOracle, + ConnectionTypePalantir, ConnectionTypePostgresql, ConnectionTypePowerBi, ConnectionTypeRedshift, @@ -2406,8 +2409,6 @@ func (s EffectivePredictiveOptimizationFlag) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// The type of the object from which the flag was inherited. If there was no -// inheritance, this field is left blank. type EffectivePredictiveOptimizationFlagInheritedFromType string const EffectivePredictiveOptimizationFlagInheritedFromTypeCatalog EffectivePredictiveOptimizationFlagInheritedFromType = `CATALOG` @@ -6288,6 +6289,8 @@ const PrivilegeExecute Privilege = `EXECUTE` const PrivilegeExecuteCleanRoomTask Privilege = `EXECUTE_CLEAN_ROOM_TASK` +const PrivilegeExternalUseSchema Privilege = `EXTERNAL_USE_SCHEMA` + const PrivilegeManage Privilege = `MANAGE` const PrivilegeManageAllowlist Privilege = `MANAGE_ALLOWLIST` @@ -6338,11 +6341,11 @@ func (f *Privilege) String() string { // Set raw string value and validate it against allowed values func (f *Privilege) Set(v string) error { switch v { - case `ACCESS`, `ALL_PRIVILEGES`, `APPLY_TAG`, `BROWSE`, `CREATE`, `CREATE_CATALOG`, `CREATE_CLEAN_ROOM`, `CREATE_CONNECTION`, `CREATE_EXTERNAL_LOCATION`, `CREATE_EXTERNAL_TABLE`, `CREATE_EXTERNAL_VOLUME`, `CREATE_FOREIGN_CATALOG`, `CREATE_FOREIGN_SECURABLE`, `CREATE_FUNCTION`, `CREATE_MANAGED_STORAGE`, `CREATE_MATERIALIZED_VIEW`, `CREATE_MODEL`, `CREATE_PROVIDER`, `CREATE_RECIPIENT`, `CREATE_SCHEMA`, `CREATE_SERVICE_CREDENTIAL`, `CREATE_SHARE`, `CREATE_STORAGE_CREDENTIAL`, `CREATE_TABLE`, `CREATE_VIEW`, `CREATE_VOLUME`, `EXECUTE`, `EXECUTE_CLEAN_ROOM_TASK`, `MANAGE`, `MANAGE_ALLOWLIST`, `MODIFY`, `MODIFY_CLEAN_ROOM`, `READ_FILES`, `READ_PRIVATE_FILES`, `READ_VOLUME`, `REFRESH`, `SELECT`, `SET_SHARE_PERMISSION`, `USAGE`, `USE_CATALOG`, `USE_CONNECTION`, `USE_MARKETPLACE_ASSETS`, `USE_PROVIDER`, `USE_RECIPIENT`, `USE_SCHEMA`, `USE_SHARE`, `WRITE_FILES`, `WRITE_PRIVATE_FILES`, `WRITE_VOLUME`: + case `ACCESS`, `ALL_PRIVILEGES`, `APPLY_TAG`, `BROWSE`, `CREATE`, `CREATE_CATALOG`, `CREATE_CLEAN_ROOM`, `CREATE_CONNECTION`, `CREATE_EXTERNAL_LOCATION`, `CREATE_EXTERNAL_TABLE`, `CREATE_EXTERNAL_VOLUME`, `CREATE_FOREIGN_CATALOG`, `CREATE_FOREIGN_SECURABLE`, `CREATE_FUNCTION`, `CREATE_MANAGED_STORAGE`, `CREATE_MATERIALIZED_VIEW`, `CREATE_MODEL`, `CREATE_PROVIDER`, `CREATE_RECIPIENT`, `CREATE_SCHEMA`, `CREATE_SERVICE_CREDENTIAL`, `CREATE_SHARE`, `CREATE_STORAGE_CREDENTIAL`, `CREATE_TABLE`, `CREATE_VIEW`, `CREATE_VOLUME`, `EXECUTE`, `EXECUTE_CLEAN_ROOM_TASK`, `EXTERNAL_USE_SCHEMA`, `MANAGE`, `MANAGE_ALLOWLIST`, `MODIFY`, `MODIFY_CLEAN_ROOM`, `READ_FILES`, `READ_PRIVATE_FILES`, `READ_VOLUME`, `REFRESH`, `SELECT`, `SET_SHARE_PERMISSION`, `USAGE`, `USE_CATALOG`, `USE_CONNECTION`, `USE_MARKETPLACE_ASSETS`, `USE_PROVIDER`, `USE_RECIPIENT`, `USE_SCHEMA`, `USE_SHARE`, `WRITE_FILES`, `WRITE_PRIVATE_FILES`, `WRITE_VOLUME`: *f = Privilege(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "ACCESS", "ALL_PRIVILEGES", "APPLY_TAG", "BROWSE", "CREATE", "CREATE_CATALOG", "CREATE_CLEAN_ROOM", "CREATE_CONNECTION", "CREATE_EXTERNAL_LOCATION", "CREATE_EXTERNAL_TABLE", "CREATE_EXTERNAL_VOLUME", "CREATE_FOREIGN_CATALOG", "CREATE_FOREIGN_SECURABLE", "CREATE_FUNCTION", "CREATE_MANAGED_STORAGE", "CREATE_MATERIALIZED_VIEW", "CREATE_MODEL", "CREATE_PROVIDER", "CREATE_RECIPIENT", "CREATE_SCHEMA", "CREATE_SERVICE_CREDENTIAL", "CREATE_SHARE", "CREATE_STORAGE_CREDENTIAL", "CREATE_TABLE", "CREATE_VIEW", "CREATE_VOLUME", "EXECUTE", "EXECUTE_CLEAN_ROOM_TASK", "MANAGE", "MANAGE_ALLOWLIST", "MODIFY", "MODIFY_CLEAN_ROOM", "READ_FILES", "READ_PRIVATE_FILES", "READ_VOLUME", "REFRESH", "SELECT", "SET_SHARE_PERMISSION", "USAGE", "USE_CATALOG", "USE_CONNECTION", "USE_MARKETPLACE_ASSETS", "USE_PROVIDER", "USE_RECIPIENT", "USE_SCHEMA", "USE_SHARE", "WRITE_FILES", "WRITE_PRIVATE_FILES", "WRITE_VOLUME"`, v) + return fmt.Errorf(`value "%s" is not one of "ACCESS", "ALL_PRIVILEGES", "APPLY_TAG", "BROWSE", "CREATE", "CREATE_CATALOG", "CREATE_CLEAN_ROOM", "CREATE_CONNECTION", "CREATE_EXTERNAL_LOCATION", "CREATE_EXTERNAL_TABLE", "CREATE_EXTERNAL_VOLUME", "CREATE_FOREIGN_CATALOG", "CREATE_FOREIGN_SECURABLE", "CREATE_FUNCTION", "CREATE_MANAGED_STORAGE", "CREATE_MATERIALIZED_VIEW", "CREATE_MODEL", "CREATE_PROVIDER", "CREATE_RECIPIENT", "CREATE_SCHEMA", "CREATE_SERVICE_CREDENTIAL", "CREATE_SHARE", "CREATE_STORAGE_CREDENTIAL", "CREATE_TABLE", "CREATE_VIEW", "CREATE_VOLUME", "EXECUTE", "EXECUTE_CLEAN_ROOM_TASK", "EXTERNAL_USE_SCHEMA", "MANAGE", "MANAGE_ALLOWLIST", "MODIFY", "MODIFY_CLEAN_ROOM", "READ_FILES", "READ_PRIVATE_FILES", "READ_VOLUME", "REFRESH", "SELECT", "SET_SHARE_PERMISSION", "USAGE", "USE_CATALOG", "USE_CONNECTION", "USE_MARKETPLACE_ASSETS", "USE_PROVIDER", "USE_RECIPIENT", "USE_SCHEMA", "USE_SHARE", "WRITE_FILES", "WRITE_PRIVATE_FILES", "WRITE_VOLUME"`, v) } } @@ -6379,6 +6382,7 @@ func (f *Privilege) Values() []Privilege { PrivilegeCreateVolume, PrivilegeExecute, PrivilegeExecuteCleanRoomTask, + PrivilegeExternalUseSchema, PrivilegeManage, PrivilegeManageAllowlist, PrivilegeModify, @@ -6748,6 +6752,7 @@ func (s Securable) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Latest kind: CONNECTION_PALANTIR_OAUTH_M2M = 263; Next id:264 type SecurableKind string const SecurableKindTableDbStorage SecurableKind = `TABLE_DB_STORAGE` @@ -6818,6 +6823,8 @@ const SecurableKindTableForeignNetsuite SecurableKind = `TABLE_FOREIGN_NETSUITE` const SecurableKindTableForeignOracle SecurableKind = `TABLE_FOREIGN_ORACLE` +const SecurableKindTableForeignPalantir SecurableKind = `TABLE_FOREIGN_PALANTIR` + const SecurableKindTableForeignPostgresql SecurableKind = `TABLE_FOREIGN_POSTGRESQL` const SecurableKindTableForeignRedshift SecurableKind = `TABLE_FOREIGN_REDSHIFT` @@ -6852,6 +6859,8 @@ const SecurableKindTableMaterializedViewDeltasharing SecurableKind = `TABLE_MATE const SecurableKindTableMetricView SecurableKind = `TABLE_METRIC_VIEW` +const SecurableKindTableMetricViewDeltasharing SecurableKind = `TABLE_METRIC_VIEW_DELTASHARING` + const SecurableKindTableOnlineVectorIndexDirect SecurableKind = `TABLE_ONLINE_VECTOR_INDEX_DIRECT` const SecurableKindTableOnlineVectorIndexReplica SecurableKind = `TABLE_ONLINE_VECTOR_INDEX_REPLICA` @@ -6880,11 +6889,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_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`: + 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_PALANTIR`, `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_METRIC_VIEW_DELTASHARING`, `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_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) + 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_PALANTIR", "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_METRIC_VIEW_DELTASHARING", "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) } } @@ -6927,6 +6936,7 @@ func (f *SecurableKind) Values() []SecurableKind { SecurableKindTableForeignMysql, SecurableKindTableForeignNetsuite, SecurableKindTableForeignOracle, + SecurableKindTableForeignPalantir, SecurableKindTableForeignPostgresql, SecurableKindTableForeignRedshift, SecurableKindTableForeignSalesforce, @@ -6944,6 +6954,7 @@ func (f *SecurableKind) Values() []SecurableKind { SecurableKindTableMaterializedView, SecurableKindTableMaterializedViewDeltasharing, SecurableKindTableMetricView, + SecurableKindTableMetricViewDeltasharing, SecurableKindTableOnlineVectorIndexDirect, SecurableKindTableOnlineVectorIndexReplica, SecurableKindTableOnlineView, diff --git a/service/compute/model.go b/service/compute/model.go index 98ed4d81d..adeaf402f 100755 --- a/service/compute/model.go +++ b/service/compute/model.go @@ -5670,6 +5670,8 @@ const TerminationReasonCodeNfsMountFailure TerminationReasonCode = `NFS_MOUNT_FA const TerminationReasonCodeNoActivatedK8s TerminationReasonCode = `NO_ACTIVATED_K8S` +const TerminationReasonCodeNoActivatedK8sTestingTag TerminationReasonCode = `NO_ACTIVATED_K8S_TESTING_TAG` + const TerminationReasonCodeNoMatchedK8s TerminationReasonCode = `NO_MATCHED_K8S` const TerminationReasonCodeNoMatchedK8sTestingTag TerminationReasonCode = `NO_MATCHED_K8S_TESTING_TAG` @@ -5768,11 +5770,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_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`: + 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_ACTIVATED_K8S_TESTING_TAG`, `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_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) + 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_ACTIVATED_K8S_TESTING_TAG", "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) } } @@ -5912,6 +5914,7 @@ func (f *TerminationReasonCode) Values() []TerminationReasonCode { TerminationReasonCodeNetworkConfigurationFailure, TerminationReasonCodeNfsMountFailure, TerminationReasonCodeNoActivatedK8s, + TerminationReasonCodeNoActivatedK8sTestingTag, TerminationReasonCodeNoMatchedK8s, TerminationReasonCodeNoMatchedK8sTestingTag, TerminationReasonCodeNpipTunnelSetupFailure, diff --git a/service/dashboards/model.go b/service/dashboards/model.go index 68d7299d2..5236c1fa9 100755 --- a/service/dashboards/model.go +++ b/service/dashboards/model.go @@ -210,10 +210,10 @@ func (s DeleteSubscriptionRequest) MarshalJSON() ([]byte, error) { 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"` + // Follow-up questions suggested by Genie + SuggestedQuestions *GenieSuggestedQuestionsAttachment `json:"suggested_questions,omitempty"` // Text Attachment if Genie responds with text Text *TextAttachment `json:"text,omitempty"` @@ -310,20 +310,8 @@ type GenieExecuteMessageQueryRequest struct { // 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 @@ -367,12 +355,6 @@ 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 GenieGetConversationMessageRequest struct { // The ID associated with the target conversation. ConversationId string `json:"-" url:"-"` @@ -625,8 +607,6 @@ func (s GenieResultMetadata) MarshalJSON() ([]byte, error) { } 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. @@ -635,16 +615,6 @@ type GenieSendMessageFeedbackRequest struct { 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 { @@ -654,6 +624,8 @@ type GenieSpace struct { SpaceId string `json:"space_id"` // Title of the Genie Space Title string `json:"title"` + // Warehouse associated with the Genie Space + WarehouseId string `json:"warehouse_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -684,6 +656,12 @@ type GenieStartConversationResponse struct { MessageId string `json:"message_id"` } +// Follow-up questions suggested by Genie +type GenieSuggestedQuestionsAttachment struct { + // The suggested follow-up questions + Questions []string `json:"questions,omitempty"` +} + type GenieTrashSpaceRequest struct { // The ID associated with the Genie space to be sent to the trash. SpaceId string `json:"-" url:"-"` @@ -976,6 +954,8 @@ 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` @@ -1050,11 +1030,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`, `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`: + 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", "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) + 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) } } @@ -1085,6 +1065,7 @@ func (f *MessageErrorType) Values() []MessageErrorType { MessageErrorTypeGenericChatCompletionServiceException, MessageErrorTypeGenericSqlExecApiCallException, MessageErrorTypeIllegalParameterDefinitionException, + MessageErrorTypeInternalCatalogMissingUcPathException, MessageErrorTypeInternalCatalogPathOverlapException, MessageErrorTypeInvalidCertifiedAnswerFunctionException, MessageErrorTypeInvalidCertifiedAnswerIdentifierException, diff --git a/service/database/impl.go b/service/database/impl.go index 9ea0e56f6..612a2b34e 100755 --- a/service/database/impl.go +++ b/service/database/impl.go @@ -364,6 +364,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 +379,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 } @@ -392,6 +394,7 @@ func (a *databaseImpl) UpdateSyncedDatabaseTable(ctx context.Context, request Up 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 } diff --git a/service/database/model.go b/service/database/model.go index ab042bd9a..05c908f16 100755 --- a/service/database/model.go +++ b/service/database/model.go @@ -84,33 +84,20 @@ type DatabaseInstance struct { // Deprecated. The sku of the instance; this field will always match the // value of capacity. EffectiveCapacity string `json:"effective_capacity,omitempty"` - // xref AIP-129. `enable_pg_native_login` is owned by the client, while - // `effective_enable_pg_native_login` is owned by the server. - // `enable_pg_native_login` will only be set in Create/Update response - // messages if and only if the user provides the field via the request. - // `effective_enable_pg_native_login` on the other hand will always bet set - // in all response messages (Create/Update/Get/List). + // Whether the instance has PG native password login enabled. EffectiveEnablePgNativeLogin bool `json:"effective_enable_pg_native_login,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). + // Whether secondaries serving read-only traffic are enabled. Defaults to + // false. EffectiveEnableReadableSecondaries bool `json:"effective_enable_readable_secondaries,omitempty"` // 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"` // Whether the instance is stopped. EffectiveStopped bool `json:"effective_stopped,omitempty"` - // Whether the instance has PG native password login enabled. Defaults to + // 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 @@ -172,14 +159,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. // 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 820e2ce6d..e389310da 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,66 +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) + Get(ctx context.Context, request GetAccountGroupRequest) (*AccountGroup, 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`. // // This method is generated by Databricks SDK Code Generator. - List(ctx context.Context, request ListAccountGroupsRequest) listing.Iterator[Group] + List(ctx context.Context, request ListAccountGroupsRequest) listing.Iterator[AccountGroup] // 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) - - // 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) + 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, }, } @@ -170,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, }, } @@ -312,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[AccountUser] // 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) ([]AccountUser, 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, }, } @@ -459,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 { @@ -551,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. @@ -579,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, }, } @@ -619,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 { @@ -796,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. @@ -825,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, }, } @@ -867,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. // @@ -976,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 @@ -1004,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, }, } @@ -1030,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 a593516c0..1cf2aa32b 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,33 +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. As of // 08/22/2025, this endpoint will not return members. Instead, members should be // retrieved by iterating through `Get group details`. -func (a *accountGroupsImpl) List(ctx context.Context, request ListAccountGroupsRequest) listing.Iterator[Group] { +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 } @@ -161,34 +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. As of // 08/22/2025, this endpoint will not return members. Instead, members should be // retrieved by iterating through `Get group details`. -func (a *accountGroupsImpl) ListAll(ctx context.Context, request ListAccountGroupsRequest) ([]Group, error) { +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) @@ -197,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) @@ -230,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 } @@ -266,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) @@ -333,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[AccountUser] { 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) (*ListAccountUsersResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) } - getItems := func(resp *ListUsersResponse) []User { + getItems := func(resp *ListAccountUsersResponse) []AccountUser { return resp.Resources } - getNextReq := func(resp *ListUsersResponse) *ListAccountUsersRequest { + getNextReq := func(resp *ListAccountUsersResponse) *ListAccountUsersRequest { if len(getItems(resp)) == 0 { return nil } @@ -369,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) ([]AccountUser, error) { iterator := a.List(ctx, request) - return listing.ToSliceN[User, int64](ctx, iterator, request.Count) + return listing.ToSliceN[AccountUser, 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) (*ListAccountUsersResponse, error) { + var listAccountUsersResponse ListAccountUsersResponse 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, &listAccountUsersResponse) + return &listAccountUsersResponse, 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 @@ -427,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) @@ -443,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) @@ -451,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) @@ -462,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 { @@ -487,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) @@ -512,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 @@ -593,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) @@ -609,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) @@ -617,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) @@ -628,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 { @@ -653,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) @@ -678,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) @@ -712,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) @@ -720,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) @@ -730,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 { @@ -776,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) @@ -801,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) @@ -821,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 051cc5550..5754a981c 100755 --- a/service/iam/interface.go +++ b/service/iam/interface.go @@ -71,28 +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. 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) (*ListGroupsResponse, error) + 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, @@ -103,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. @@ -141,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) (*ListAccountUsersResponse, 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 @@ -184,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 @@ -200,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: @@ -276,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 @@ -294,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. @@ -315,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. @@ -329,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 @@ -348,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 7c51c2a33..83b7d2a9e 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:"-"` @@ -233,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, @@ -488,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"` @@ -513,11 +818,33 @@ type ListAccountServicePrincipalsRequest struct { ForceSendFields []string `json:"-" url:"-"` } -func (s *ListAccountServicePrincipalsRequest) UnmarshalJSON(b []byte) error { +func (s *ListAccountServicePrincipalsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +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 ListAccountServicePrincipalsRequest) MarshalJSON() ([]byte, error) { +func (s ListAccountServicePrincipalsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } @@ -555,6 +882,28 @@ func (s ListAccountUsersRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListAccountUsersResponse struct { + // Total results returned in the response. + ItemsPerPage int64 `json:"itemsPerPage,omitempty"` + // User objects returned in the response. + Resources []AccountUser `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 *ListAccountUsersResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListAccountUsersResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListGroupsRequest struct { // Comma-separated list of attributes to return in response. Attributes string `json:"-" url:"attributes,omitempty"` @@ -875,16 +1224,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"` @@ -1039,6 +1378,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 @@ -1114,6 +1493,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"` @@ -1499,6 +1898,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. @@ -1518,6 +2031,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/jobs/model.go b/service/jobs/model.go index fb06b5ca7..a627fa7ab 100755 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -1182,9 +1182,7 @@ func (s EnforcePolicyComplianceResponse) MarshalJSON() ([]byte, error) { type ExportRunOutput struct { // The exported content in HTML format (one for every view item). To extract // the HTML notebook from the JSON response, download and run this [Python - // script]. - // - // [Python script]: https://docs.databricks.com/en/_static/examples/extract.py + // script](/_static/examples/extract.py). Views []ViewItem `json:"views,omitempty"` } @@ -4192,7 +4190,7 @@ type RunTask struct { // The task runs a [clean rooms] notebook when the // `clean_rooms_notebook_task` field is present. // - // [clean rooms]: https://docs.databricks.com/en/clean-rooms/index.html + // [clean rooms]: https://docs.databricks.com/clean-rooms/index.html CleanRoomsNotebookTask *CleanRoomsNotebookTask `json:"clean_rooms_notebook_task,omitempty"` // The time in milliseconds it took to terminate the cluster and clean up // any associated artifacts. The duration of a task run is the sum of the @@ -4328,24 +4326,9 @@ type RunTask struct { // The task runs a Python file when the `spark_python_task` field is // present. SparkPythonTask *SparkPythonTask `json:"spark_python_task,omitempty"` - // (Legacy) The task runs the spark-submit script when the - // `spark_submit_task` field is present. This task can run only on new - // clusters and is not compatible with serverless compute. - // - // In the `new_cluster` specification, `libraries` and `spark_conf` are not - // supported. Instead, use `--jars` and `--py-files` to add Java and Python - // libraries and `--conf` to set the Spark configurations. - // - // `master`, `deploy-mode`, and `executor-cores` are automatically - // configured by Databricks; you _cannot_ specify them in parameters. - // - // By default, the Spark submit job uses all available memory (excluding - // reserved memory for Databricks services). You can set `--driver-memory`, - // and `--executor-memory` to a smaller value to leave some room for - // off-heap usage. - // - // The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 - // paths. + // (Legacy) The task runs the spark-submit script when the spark_submit_task + // field is present. Databricks recommends using the spark_jar_task instead; + // see [Spark Submit task for jobs](/jobs/spark-submit). SparkSubmitTask *SparkSubmitTask `json:"spark_submit_task,omitempty"` // The task runs a SQL query or file, or it refreshes a SQL alert or a // legacy SQL dashboard when the `sql_task` field is present. @@ -4397,9 +4380,8 @@ const RunTypeJobRun RunType = `JOB_RUN` // Submit run. A run created with :method:jobs/submit. const RunTypeSubmitRun RunType = `SUBMIT_RUN` -// Workflow run. A run created with [dbutils.notebook.run]. -// -// [dbutils.notebook.run]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-workflow +// Workflow run. A run created with +// [dbutils.notebook.run](/dev-tools/databricks-utils.html#dbutils-workflow). const RunTypeWorkflowRun RunType = `WORKFLOW_RUN` // String representation for [fmt.Print] @@ -5007,7 +4989,7 @@ type SubmitTask struct { // The task runs a [clean rooms] notebook when the // `clean_rooms_notebook_task` field is present. // - // [clean rooms]: https://docs.databricks.com/en/clean-rooms/index.html + // [clean rooms]: https://docs.databricks.com/clean-rooms/index.html CleanRoomsNotebookTask *CleanRoomsNotebookTask `json:"clean_rooms_notebook_task,omitempty"` // The task evaluates a condition that can be used to control the execution // of other tasks when the `condition_task` field is present. The condition @@ -5084,24 +5066,9 @@ type SubmitTask struct { // The task runs a Python file when the `spark_python_task` field is // present. SparkPythonTask *SparkPythonTask `json:"spark_python_task,omitempty"` - // (Legacy) The task runs the spark-submit script when the - // `spark_submit_task` field is present. This task can run only on new - // clusters and is not compatible with serverless compute. - // - // In the `new_cluster` specification, `libraries` and `spark_conf` are not - // supported. Instead, use `--jars` and `--py-files` to add Java and Python - // libraries and `--conf` to set the Spark configurations. - // - // `master`, `deploy-mode`, and `executor-cores` are automatically - // configured by Databricks; you _cannot_ specify them in parameters. - // - // By default, the Spark submit job uses all available memory (excluding - // reserved memory for Databricks services). You can set `--driver-memory`, - // and `--executor-memory` to a smaller value to leave some room for - // off-heap usage. - // - // The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 - // paths. + // (Legacy) The task runs the spark-submit script when the spark_submit_task + // field is present. Databricks recommends using the spark_jar_task instead; + // see [Spark Submit task for jobs](/jobs/spark-submit). SparkSubmitTask *SparkSubmitTask `json:"spark_submit_task,omitempty"` // The task runs a SQL query or file, or it refreshes a SQL alert or a // legacy SQL dashboard when the `sql_task` field is present. @@ -5235,7 +5202,7 @@ type Task struct { // The task runs a [clean rooms] notebook when the // `clean_rooms_notebook_task` field is present. // - // [clean rooms]: https://docs.databricks.com/en/clean-rooms/index.html + // [clean rooms]: https://docs.databricks.com/clean-rooms/index.html CleanRoomsNotebookTask *CleanRoomsNotebookTask `json:"clean_rooms_notebook_task,omitempty"` // The task evaluates a condition that can be used to control the execution // of other tasks when the `condition_task` field is present. The condition @@ -5338,24 +5305,9 @@ type Task struct { // The task runs a Python file when the `spark_python_task` field is // present. SparkPythonTask *SparkPythonTask `json:"spark_python_task,omitempty"` - // (Legacy) The task runs the spark-submit script when the - // `spark_submit_task` field is present. This task can run only on new - // clusters and is not compatible with serverless compute. - // - // In the `new_cluster` specification, `libraries` and `spark_conf` are not - // supported. Instead, use `--jars` and `--py-files` to add Java and Python - // libraries and `--conf` to set the Spark configurations. - // - // `master`, `deploy-mode`, and `executor-cores` are automatically - // configured by Databricks; you _cannot_ specify them in parameters. - // - // By default, the Spark submit job uses all available memory (excluding - // reserved memory for Databricks services). You can set `--driver-memory`, - // and `--executor-memory` to a smaller value to leave some room for - // off-heap usage. - // - // The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 - // paths. + // (Legacy) The task runs the spark-submit script when the spark_submit_task + // field is present. Databricks recommends using the spark_jar_task instead; + // see [Spark Submit task for jobs](/jobs/spark-submit). SparkSubmitTask *SparkSubmitTask `json:"spark_submit_task,omitempty"` // The task runs a SQL query or file, or it refreshes a SQL alert or a // legacy SQL dashboard when the `sql_task` field is present. diff --git a/service/ml/impl.go b/service/ml/impl.go index eb1061b84..78690920b 100755 --- a/service/ml/impl.go +++ b/service/ml/impl.go @@ -667,6 +667,7 @@ func (a *featureEngineeringImpl) UpdateFeature(ctx context.Context, request Upda 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 } @@ -768,6 +769,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 } @@ -894,6 +896,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/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/pipelines/model.go b/service/pipelines/model.go index 3734bca16..18ff8f415 100755 --- a/service/pipelines/model.go +++ b/service/pipelines/model.go @@ -596,6 +596,10 @@ type IngestionPipelineDefinition struct { // 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"` @@ -659,6 +663,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` @@ -2013,6 +2065,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:"-"` } diff --git a/service/pkg.go b/service/pkg.go index 6376bcff0..9ade34ce4 100644 --- a/service/pkg.go +++ b/service/pkg.go @@ -144,9 +144,9 @@ // // - [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 . // @@ -276,9 +276,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. // @@ -320,9 +320,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. // @@ -457,8 +457,8 @@ 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 @@ -523,8 +523,8 @@ var ( _ *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 @@ -545,8 +545,8 @@ var ( _ *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 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/sharing/api.go b/service/sharing/api.go index 776274493..9779603fa 100755 --- a/service/sharing/api.go +++ b/service/sharing/api.go @@ -476,6 +476,7 @@ func (a *RecipientsAPI) SharePermissionsByName(ctx context.Context, name string) } type SharesInterface interface { + sharesAPIUtilities // Creates a new share for data objects. Data objects can be added after // creation with **update**. The caller must be a metastore admin or have the @@ -503,14 +504,14 @@ type SharesInterface interface { // specific ordering of the elements in the array. // // This method is generated by Databricks SDK Code Generator. - List(ctx context.Context, request ListSharesRequest) listing.Iterator[ShareInfo] + ListShares(ctx context.Context, request SharesListRequest) listing.Iterator[ShareInfo] // Gets an array of data object shares from the metastore. The caller must be a // metastore admin or the owner of the share. There is no guarantee of a // specific ordering of the elements in the array. // // This method is generated by Databricks SDK Code Generator. - ListAll(ctx context.Context, request ListSharesRequest) ([]ShareInfo, error) + ListSharesAll(ctx context.Context, request SharesListRequest) ([]ShareInfo, error) // Gets the permissions for a data share from the metastore. The caller must be // a metastore admin or the owner of the share. diff --git a/service/sharing/ext_api.go b/service/sharing/ext_api.go new file mode 100644 index 000000000..6d59c2b73 --- /dev/null +++ b/service/sharing/ext_api.go @@ -0,0 +1,76 @@ +package sharing + +import ( + "context" + "net/http" + + "github.com/databricks/databricks-sdk-go/listing" + "github.com/databricks/databricks-sdk-go/useragent" +) + +type sharesAPIUtilities interface { + // Gets an array of data object shares from the metastore. The caller must be a + // metastore admin or the owner of the share. There is no guarantee of a + // specific ordering of the elements in the array. + // + // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. + List(ctx context.Context, request ListSharesRequest) listing.Iterator[ShareInfo] + + // Gets an array of data object shares from the metastore. The caller must be a + // metastore admin or the owner of the share. There is no guarantee of a + // specific ordering of the elements in the array. + // + // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. + ListAll(ctx context.Context, request ListSharesRequest) ([]ShareInfo, error) +} + +// Gets an array of data object shares from the metastore. The caller must be a +// metastore admin or the owner of the share. There is no guarantee of a +// specific ordering of the elements in the array. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +func (a *SharesAPI) List(ctx context.Context, request ListSharesRequest) listing.Iterator[ShareInfo] { + + request.ForceSendFields = append(request.ForceSendFields, "MaxResults") + + getNextPage := func(ctx context.Context, req ListSharesRequest) (*ListSharesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListSharesResponse) []ShareInfo { + return resp.Shares + } + getNextReq := func(resp *ListSharesResponse) *ListSharesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// Gets an array of data object shares from the metastore. The caller must be a +// metastore admin or the owner of the share. There is no guarantee of a +// specific ordering of the elements in the array. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +func (a *SharesAPI) ListAll(ctx context.Context, request ListSharesRequest) ([]ShareInfo, error) { + iterator := a.List(ctx, request) + return listing.ToSlice[ShareInfo](ctx, iterator) +} + +func (a *SharesAPI) internalList(ctx context.Context, request ListSharesRequest) (*ListSharesResponse, error) { + var listSharesResponse ListSharesResponse + path := "/api/2.1/unity-catalog/shares" + 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, &listSharesResponse) + return &listSharesResponse, err +} diff --git a/service/sharing/impl.go b/service/sharing/impl.go index 203666228..28043fe21 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 } @@ -434,18 +435,18 @@ func (a *sharesImpl) Get(ctx context.Context, request GetShareRequest) (*ShareIn // Gets an array of data object shares from the metastore. The caller must be a // metastore admin or the owner of the share. There is no guarantee of a // specific ordering of the elements in the array. -func (a *sharesImpl) List(ctx context.Context, request ListSharesRequest) listing.Iterator[ShareInfo] { +func (a *sharesImpl) ListShares(ctx context.Context, request SharesListRequest) listing.Iterator[ShareInfo] { request.ForceSendFields = append(request.ForceSendFields, "MaxResults") - getNextPage := func(ctx context.Context, req ListSharesRequest) (*ListSharesResponse, error) { + getNextPage := func(ctx context.Context, req SharesListRequest) (*ListSharesResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") - return a.internalList(ctx, req) + return a.internalListShares(ctx, req) } getItems := func(resp *ListSharesResponse) []ShareInfo { return resp.Shares } - getNextReq := func(resp *ListSharesResponse) *ListSharesRequest { + getNextReq := func(resp *ListSharesResponse) *SharesListRequest { if resp.NextPageToken == "" { return nil } @@ -463,12 +464,12 @@ func (a *sharesImpl) List(ctx context.Context, request ListSharesRequest) listin // Gets an array of data object shares from the metastore. The caller must be a // metastore admin or the owner of the share. There is no guarantee of a // specific ordering of the elements in the array. -func (a *sharesImpl) ListAll(ctx context.Context, request ListSharesRequest) ([]ShareInfo, error) { - iterator := a.List(ctx, request) +func (a *sharesImpl) ListSharesAll(ctx context.Context, request SharesListRequest) ([]ShareInfo, error) { + iterator := a.ListShares(ctx, request) return listing.ToSlice[ShareInfo](ctx, iterator) } -func (a *sharesImpl) internalList(ctx context.Context, request ListSharesRequest) (*ListSharesResponse, error) { +func (a *sharesImpl) internalListShares(ctx context.Context, request SharesListRequest) (*ListSharesResponse, error) { var listSharesResponse ListSharesResponse path := "/api/2.1/unity-catalog/shares" queryParams := make(map[string]any) diff --git a/service/sharing/interface.go b/service/sharing/interface.go index 23815fe0f..630b5d321 100755 --- a/service/sharing/interface.go +++ b/service/sharing/interface.go @@ -231,7 +231,7 @@ type SharesService interface { // Gets an array of data object shares from the metastore. The caller must // be a metastore admin or the owner of the share. There is no guarantee of // a specific ordering of the elements in the array. - List(ctx context.Context, request ListSharesRequest) (*ListSharesResponse, error) + ListShares(ctx context.Context, request SharesListRequest) (*ListSharesResponse, error) // Gets the permissions for a data share from the metastore. The caller must // be a metastore admin or the owner of the share. diff --git a/service/sharing/model.go b/service/sharing/model.go index 2e1ac8de9..9d3b9d1f9 100755 --- a/service/sharing/model.go +++ b/service/sharing/model.go @@ -1752,6 +1752,31 @@ func (f *SharedSecurableKind) Type() string { return "SharedSecurableKind" } +type SharesListRequest struct { + // Maximum number of shares to return. - when set to 0, the page length is + // set to a server configured value (recommended); - when set to a value + // greater than 0, the page length is the minimum of this value and a server + // configured value; - when set to a value less than 0, an invalid parameter + // error is returned; - If not set, all valid shares are returned (not + // recommended). - Note: The number of returned shares might be less than + // the specified max_results size, even zero. The only definitive indication + // that no further shares can be fetched is when the next_page_token is + // unset from the response. + MaxResults int `json:"-" url:"max_results,omitempty"` + // Opaque pagination token to go to next page based on previous query. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *SharesListRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s SharesListRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type Table struct { // The comment of the table. Comment string `json:"comment,omitempty"` @@ -1833,6 +1858,8 @@ const TableInternalAttributesSharedTableTypeForeignTable TableInternalAttributes const TableInternalAttributesSharedTableTypeMaterializedView TableInternalAttributesSharedTableType = `MATERIALIZED_VIEW` +const TableInternalAttributesSharedTableTypeMetricView TableInternalAttributesSharedTableType = `METRIC_VIEW` + const TableInternalAttributesSharedTableTypeStreamingTable TableInternalAttributesSharedTableType = `STREAMING_TABLE` const TableInternalAttributesSharedTableTypeView TableInternalAttributesSharedTableType = `VIEW` @@ -1845,11 +1872,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_ICEBERG_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`, `METRIC_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_ICEBERG_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", "METRIC_VIEW", "STREAMING_TABLE", "VIEW"`, v) } } @@ -1864,6 +1891,7 @@ func (f *TableInternalAttributesSharedTableType) Values() []TableInternalAttribu TableInternalAttributesSharedTableTypeForeignIcebergTable, TableInternalAttributesSharedTableTypeForeignTable, TableInternalAttributesSharedTableTypeMaterializedView, + TableInternalAttributesSharedTableTypeMetricView, TableInternalAttributesSharedTableTypeStreamingTable, TableInternalAttributesSharedTableTypeView, } diff --git a/service/sql/impl.go b/service/sql/impl.go index 4bba7f326..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 } diff --git a/service/tags/impl.go b/service/tags/impl.go index 5601e4973..bd69be12a 100755 --- a/service/tags/impl.go +++ b/service/tags/impl.go @@ -92,6 +92,7 @@ func (a *tagPoliciesImpl) UpdateTagPolicy(ctx context.Context, request UpdateTag 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 } diff --git a/workspace_client.go b/workspace_client.go index f36e01a8f..28f83464b 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -439,7 +439,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 @@ -951,7 +951,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. @@ -1223,7 +1223,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. @@ -1297,6 +1297,44 @@ type WorkspaceClient struct { // 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") @@ -1380,7 +1418,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), @@ -1427,7 +1465,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { 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), @@ -1442,7 +1480,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { 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), @@ -1452,5 +1490,8 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { 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 }