All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.databricks.sdk.service.workspace.WorkspaceImpl Maven / Gradle / Ivy

There is a newer version: 0.35.0
Show newest version
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package com.databricks.sdk.service.workspace;

import com.databricks.sdk.core.ApiClient;
import com.databricks.sdk.support.Generated;
import java.util.HashMap;
import java.util.Map;

/** Package-local implementation of Workspace */
@Generated
class WorkspaceImpl implements WorkspaceService {
  private final ApiClient apiClient;

  public WorkspaceImpl(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  @Override
  public void delete(Delete request) {
    String path = "/api/2.0/workspace/delete";
    Map headers = new HashMap<>();
    headers.put("Accept", "application/json");
    headers.put("Content-Type", "application/json");
    apiClient.POST(path, request, DeleteResponse.class, headers);
  }

  @Override
  public ExportResponse export(ExportRequest request) {
    String path = "/api/2.0/workspace/export";
    Map headers = new HashMap<>();
    headers.put("Accept", "application/json");
    return apiClient.GET(path, request, ExportResponse.class, headers);
  }

  @Override
  public GetWorkspaceObjectPermissionLevelsResponse getPermissionLevels(
      GetWorkspaceObjectPermissionLevelsRequest request) {
    String path =
        String.format(
            "/api/2.0/permissions/%s/%s/permissionLevels",
            request.getWorkspaceObjectType(), request.getWorkspaceObjectId());
    Map headers = new HashMap<>();
    headers.put("Accept", "application/json");
    return apiClient.GET(path, request, GetWorkspaceObjectPermissionLevelsResponse.class, headers);
  }

  @Override
  public WorkspaceObjectPermissions getPermissions(GetWorkspaceObjectPermissionsRequest request) {
    String path =
        String.format(
            "/api/2.0/permissions/%s/%s",
            request.getWorkspaceObjectType(), request.getWorkspaceObjectId());
    Map headers = new HashMap<>();
    headers.put("Accept", "application/json");
    return apiClient.GET(path, request, WorkspaceObjectPermissions.class, headers);
  }

  @Override
  public ObjectInfo getStatus(GetStatusRequest request) {
    String path = "/api/2.0/workspace/get-status";
    Map headers = new HashMap<>();
    headers.put("Accept", "application/json");
    return apiClient.GET(path, request, ObjectInfo.class, headers);
  }

  @Override
  public void importContent(Import request) {
    String path = "/api/2.0/workspace/import";
    Map headers = new HashMap<>();
    headers.put("Accept", "application/json");
    headers.put("Content-Type", "application/json");
    apiClient.POST(path, request, ImportResponse.class, headers);
  }

  @Override
  public ListResponse list(ListWorkspaceRequest request) {
    String path = "/api/2.0/workspace/list";
    Map headers = new HashMap<>();
    headers.put("Accept", "application/json");
    return apiClient.GET(path, request, ListResponse.class, headers);
  }

  @Override
  public void mkdirs(Mkdirs request) {
    String path = "/api/2.0/workspace/mkdirs";
    Map headers = new HashMap<>();
    headers.put("Accept", "application/json");
    headers.put("Content-Type", "application/json");
    apiClient.POST(path, request, MkdirsResponse.class, headers);
  }

  @Override
  public WorkspaceObjectPermissions setPermissions(WorkspaceObjectPermissionsRequest request) {
    String path =
        String.format(
            "/api/2.0/permissions/%s/%s",
            request.getWorkspaceObjectType(), request.getWorkspaceObjectId());
    Map headers = new HashMap<>();
    headers.put("Accept", "application/json");
    headers.put("Content-Type", "application/json");
    return apiClient.PUT(path, request, WorkspaceObjectPermissions.class, headers);
  }

  @Override
  public WorkspaceObjectPermissions updatePermissions(WorkspaceObjectPermissionsRequest request) {
    String path =
        String.format(
            "/api/2.0/permissions/%s/%s",
            request.getWorkspaceObjectType(), request.getWorkspaceObjectId());
    Map headers = new HashMap<>();
    headers.put("Accept", "application/json");
    headers.put("Content-Type", "application/json");
    return apiClient.PATCH(path, request, WorkspaceObjectPermissions.class, headers);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy