Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @DeveloperApi annotation #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.databricks.sdk.client.http.Response;
import com.databricks.sdk.client.utils.RealTimer;
import com.databricks.sdk.client.utils.Timer;
import com.databricks.sdk.support.DeveloperApi;
import com.databricks.sdk.support.QueryParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
Expand All @@ -23,6 +24,7 @@
* Simplified REST API client with retries, JSON POJO SerDe through Jackson and exception POJO
* guessing
*/
@DeveloperApi
public class ApiClient {
private static final Logger LOG = LoggerFactory.getLogger(ApiClient.class);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.databricks.sdk.client;

import com.databricks.sdk.support.DeveloperApi;

import java.util.HashMap;
import java.util.Map;

Expand All @@ -10,6 +12,7 @@
* resources vary depending on the cloud environment: public, germany, govcloud, or china. Depending
* on the operation, tokens scoped to a specific endpoint are needed.
*/
@DeveloperApi
public class AzureEnvironment {
private String name;
private String serviceManagementEndpoint;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.databricks.sdk.client;

import com.databricks.sdk.support.DeveloperApi;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.TreeNode;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import java.util.*;

@DeveloperApi
class BodyLogger {
private final Set<String> redactKeys =
new HashSet<String>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.databricks.sdk.client.oauth.RefreshableTokenSource;
import com.databricks.sdk.client.oauth.Token;
import com.databricks.sdk.client.utils.OSUtils;
import com.databricks.sdk.support.DeveloperApi;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
Expand All @@ -16,7 +17,8 @@
import java.util.function.Supplier;
import org.apache.commons.io.IOUtils;

public class CliTokenSource extends RefreshableTokenSource implements OSUtils {
@DeveloperApi
class CliTokenSource extends RefreshableTokenSource implements OSUtils {
private List<String> cmd;
private String tokenTypeField;
private String accessTokenField;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.databricks.sdk.client;

import com.databricks.sdk.support.DeveloperApi;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@DeveloperApi
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ConfigAttribute {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.databricks.sdk.client;

import com.databricks.sdk.support.DeveloperApi;

import java.lang.reflect.Field;
import java.util.Map;
import java.util.Objects;

@DeveloperApi
class ConfigAttributeAccessor {
private ConfigAttribute configAttribute;
private Field field;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.databricks.sdk.client;

import com.databricks.sdk.support.DeveloperApi;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
Expand All @@ -12,6 +13,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@DeveloperApi
public class ConfigLoader {
private static final Logger LOG = LoggerFactory.getLogger(ConfigLoader.class);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.databricks.sdk.client;

import com.databricks.sdk.support.DeveloperApi;

@DeveloperApi
public interface CredentialsProvider {
String authType();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.databricks.sdk.client;

import com.databricks.sdk.support.DeveloperApi;

import java.util.Map;

@DeveloperApi
public interface HeaderFactory {
/**
* Part of the Unified Client Authentication framework.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.databricks.sdk.client;

import com.databricks.sdk.support.DeveloperApi;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
Expand All @@ -13,6 +14,7 @@
* Simplistic and short-lived HTTP server intended to handle one or two requests before shutting
* down. Not intended to serve traffic to the Internet.
*/
@DeveloperApi
class SimpleHttpServer implements Runnable {

private final ServerSocket server;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.databricks.sdk.client.error;

import com.databricks.sdk.support.DeveloperApi;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
Expand All @@ -9,6 +10,7 @@
* href="https://github.com/databricks/databricks-sdk-go/blob/main/apierr/errors.go#L31">the
* APIErrorBody struct from the Go SDK</a>.
*/
@DeveloperApi
public class ApiErrorBody {
private String errorCode;
private String message;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.databricks.sdk.client.error;

import com.databricks.sdk.client.http.Response;
import com.databricks.sdk.support.DeveloperApi;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/** Helper methods for inspecting the response and errors thrown during API requests. */
@DeveloperApi
public class ApiErrors {
private static final ObjectMapper MAPPER = new ObjectMapper();
private static final Pattern HTML_ERROR_REGEX = Pattern.compile("<pre>(.*)</pre>");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.databricks.sdk.client.error;

import com.databricks.sdk.client.DatabricksException;
import com.databricks.sdk.support.DeveloperApi;
import java.net.ConnectException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
Expand All @@ -17,6 +18,7 @@
* should be parsed and returned to the user. If error is not null, the request has failed in an
* unrecoverable way and this exception should be thrown, potentially wrapped in another exception.
*/
@DeveloperApi
public class CheckForRetryResult {
private final Logger LOG = LoggerFactory.getLogger(getClass().getName());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.databricks.sdk.client.http;

import com.databricks.sdk.support.DeveloperApi;
import java.util.Map;

@DeveloperApi
public class FormRequest extends Request {
public FormRequest(String url, Map<String, String> form) {
this(POST, url, form);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.databricks.sdk.client.http;

import com.databricks.sdk.support.DeveloperApi;
import java.io.IOException;

@DeveloperApi
public interface HttpClient {
Response execute(Request in) throws IOException;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.databricks.sdk.client.http;

import com.databricks.sdk.client.DatabricksException;
import com.databricks.sdk.support.DeveloperApi;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;

@DeveloperApi
public class Request {
public static final String GET = "GET";
public static final String DELETE = "DELETE";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.databricks.sdk.client.http;

import com.databricks.sdk.support.DeveloperApi;
import java.util.Collections;
import java.util.List;
import java.util.Map;

@DeveloperApi
public class Response {
private Request request;
private int statusCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.databricks.sdk.client.http.FormRequest;
import com.databricks.sdk.client.http.HttpClient;
import com.databricks.sdk.client.http.Response;
import com.databricks.sdk.support.DeveloperApi;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.time.LocalDateTime;
Expand All @@ -18,6 +19,7 @@
* <p>Calls to getToken() will first check if the token is still valid (currently defined by having
* at least 10 seconds until expiry). If not, refresh() is called first to refresh the token.
*/
@DeveloperApi
public abstract class RefreshableTokenSource implements TokenSource {
protected Token token;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.databricks.sdk.client.oauth;

import com.databricks.sdk.support.DeveloperApi;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Objects;

@DeveloperApi
public class Token {
@JsonProperty private String accessToken;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.databricks.sdk.client.oauth;

import com.databricks.sdk.support.DeveloperApi;

/** A resource which can produce an OAuth token. */
@DeveloperApi
public interface TokenSource {
Token getToken();
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
import com.databricks.sdk.client.oauth.ClientCredentials;
import com.databricks.sdk.client.oauth.RefreshableTokenSource;
import com.databricks.sdk.client.oauth.Token;
import com.databricks.sdk.support.DeveloperApi;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@DeveloperApi
public interface AzureUtils {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.databricks.sdk.client.utils;

import com.databricks.sdk.support.DeveloperApi;
import java.util.Arrays;
import java.util.List;

/**
* OSUtils is an interface that provides utility methods for determining the current operating
* system and returning executable command based on the operating system.
*/
@DeveloperApi
public interface OSUtils {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.databricks.sdk.client.utils;

import com.databricks.sdk.support.DeveloperApi;

@DeveloperApi
public class RealTimer implements Timer {
@Override
public void wait(int milliseconds) throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.databricks.sdk.client.utils;

import com.databricks.sdk.support.DeveloperApi;

@DeveloperApi
public interface Timer {
void wait(int milliseconds) throws InterruptedException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.databricks.sdk.mixin;

import com.databricks.sdk.support.DeveloperApi;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

@DeveloperApi
public class SemVer implements Comparable<SemVer> {
public final int major;
public final int minor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @param <IT> item of iteration
* @param <ID> identifier
*/
@DeveloperApi
class Dedupe<IT, ID> implements Iterator<IT> {
private final Iterator<IT> inner;
private final Function<IT, ID> idGetter;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.databricks.sdk.support;

import java.lang.annotation.*;

/**
* Lower-level and unstable API intended for Databricks developers.
*
* <p>Elements annotated with `@DeveloperApi` might change or be removed in minor versions of this
* SDK.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({
ElementType.TYPE,
ElementType.FIELD,
ElementType.METHOD,
ElementType.PARAMETER,
ElementType.CONSTRUCTOR,
ElementType.LOCAL_VARIABLE,
ElementType.PACKAGE
})
public @interface DeveloperApi {}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* <p>This annotation is used to exclude the class or method from code coverage.
*/
@Documented
@DeveloperApi
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR})
public @interface Generated {}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* @param <RS> response type
* @param <T> item type
*/
@DeveloperApi
public class Paginator<RQ, RS, T> implements Iterable<T> {
private final Function<RQ, RS> requestFn;
private final Function<RS, Collection<T>> itemsFn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@DeveloperApi
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface QueryParam {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.StringJoiner;

@DeveloperApi
public class ToStringer {
private final StringJoiner joiner;

Expand Down
Loading