Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
668 changes: 334 additions & 334 deletions package-lock.json

Large diffs are not rendered by default.

50 changes: 47 additions & 3 deletions packages/clusters/src/v2/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
} from './utils';
import pkgJson from '../../package.json' with {type: 'json'};
import type {
CancelPendingClusterEnforcementRequest,
CancelPendingClusterEnforcementResponse,
ChangeClusterOwnerRequest,
ChangeClusterOwnerResponse,
ClusterCompliance,
Expand Down Expand Up @@ -65,6 +67,7 @@ import type {
} from './model';
import {
ClusterState_ClusterState,
marshalCancelPendingClusterEnforcementRequestSchema,
marshalChangeClusterOwnerRequestSchema,
marshalCreateClusterRequestSchema,
marshalDeleteClusterRequestSchema,
Expand All @@ -78,6 +81,7 @@ import {
marshalStartClusterRequestSchema,
marshalUnpinClusterRequestSchema,
marshalUpdateClusterRequestSchema,
unmarshalCancelPendingClusterEnforcementResponseSchema,
unmarshalChangeClusterOwnerResponseSchema,
unmarshalClusterInfoSchema,
unmarshalCreateClusterResponseSchema,
Expand Down Expand Up @@ -904,15 +908,55 @@ export class ClustersClient {
return new UpdateClusterWaiter(this, req.clusterId);
}

/**
* Cancels a pending enforcement on a cluster. After canceling the pending enforcement,
* the cluster will no longer update on the next termination or restart.
* Pending enforcements cannot be canceled when a cluster is in `TERMINATING` state.
* Only workspace admins can cancel pending enforcements.
*/
async cancelPendingClusterEnforcement(
req: CancelPendingClusterEnforcementRequest,
options?: CallOptions
): Promise<CancelPendingClusterEnforcementResponse> {
const {host, workspaceId, httpClient} = await this.resolveConfig();
const url = `${host}/api/2.0/policies/clusters:cancelPendingClusterEnforcement`;
const body = marshalRequest(
req,
marshalCancelPendingClusterEnforcementRequestSchema
);
let resp: CancelPendingClusterEnforcementResponse | undefined;
const call = async (callSignal?: AbortSignal): Promise<void> => {
const headers = new Headers({'Content-Type': 'application/json'});
if (workspaceId !== undefined) {
headers.set('X-Databricks-Workspace-Id', workspaceId);
}
headers.set('User-Agent', this.userAgent);
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
const respBody = await executeHttpCall({
request: httpReq,
httpClient,
logger: this.logger,
});
resp = parseResponse(
respBody,
unmarshalCancelPendingClusterEnforcementResponseSchema
);
};
await executeCall(call, options);
if (resp === undefined) {
throw new Error('operation completed without a result.');
}
return resp;
}

/**
* Updates a cluster to be compliant with the current version of its policy.
* A cluster can be updated if it is in a `RUNNING` or `TERMINATED` state.
*
* If a cluster is updated while in a `RUNNING` state, it will be restarted so that the new attributes can take effect.
*
* If a cluster is updated while in a `TERMINATED` state, it will remain `TERMINATED`.
* The next time the cluster is started, the new attributes will take effect.
*
* For clusters in other states, the behavior depends on the `enforce_mode` used.
*
* Clusters created by the Databricks Jobs, SDP, or Models services cannot be enforced by this API.
* Instead, use the "Enforce job policy compliance" API to enforce policy compliance on jobs.
*/
Expand Down
7 changes: 7 additions & 0 deletions packages/clusters/src/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export {
TerminationType,
ClusterEventType_ClusterEventType,
ClusterState_ClusterState,
EnforcePolicyComplianceForClusterRequest_EnforceMode,
EnforcePolicyComplianceForClusterResponse_EnforceResult,
InitScriptExecutionDetails_InitScriptExecutionStatus,
PendingEnforcement_EnforcementStatus,
ResizeCause_ResizeCause,
} from './model';

Expand All @@ -40,6 +43,8 @@ export type {
AutoScale,
AwsAttributes,
AzureAttributes,
CancelPendingClusterEnforcementRequest,
CancelPendingClusterEnforcementResponse,
ChangeClusterOwnerRequest,
ChangeClusterOwnerResponse,
CloneCluster,
Expand All @@ -65,6 +70,7 @@ export type {
EditClusterResponse,
EnforcePolicyComplianceForClusterRequest,
EnforcePolicyComplianceForClusterResponse,
EnforcePolicyComplianceForClusterResponse_ClusterSettings,
EnforcePolicyComplianceForClusterResponse_ClusterSettingsChange,
EventDetails,
GcpAttributes,
Expand Down Expand Up @@ -94,6 +100,7 @@ export type {
NodeInstanceType,
NodeType,
NodeTypeFlexibility,
PendingEnforcement,
PermanentDeleteClusterRequest,
PermanentDeleteClusterResponse,
PinClusterRequest,
Expand Down
Loading
Loading