Skip to content

Commit

Permalink
feat: GA Gax HttpJson (#1264)
Browse files Browse the repository at this point in the history
* feat: Remove @BetaApi for certain httpjson classes

* chore: Fix formatting issues

* chore: Fix formatting issues

* chore: Remove a few more @BetaApi annotations

* chore: Fix format issues

* chore: Revert BetaApi annotation for extraHeaders in gax

* chore: Update BetaApi annotations for subclasses

* chore: Update release please version

* chore: Update all dependencies to new gax-httpjson version

* chore: Update x-version-update tag to be gax-version
  • Loading branch information
lqiu96 authored Jun 20, 2023
1 parent 9ff8595 commit 9f15fea
Show file tree
Hide file tree
Showing 30 changed files with 7 additions and 65 deletions.
2 changes: 1 addition & 1 deletion coverage-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
<version>0.114.1-SNAPSHOT</version> <!-- {x-version-update:gax-httpjson:current} -->
<version>2.29.1-SNAPSHOT</version> <!-- {x-version-update:gax:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
Expand Down
2 changes: 1 addition & 1 deletion gax-java/dependencies.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version.gax_grpc=2.29.1-SNAPSHOT
version.gax_bom=2.29.1-SNAPSHOT
# {x-version-update-end}
# {x-version-update-start:gax-httpjson:current}
version.gax_httpjson=0.114.1-SNAPSHOT
version.gax_httpjson=2.29.1-SNAPSHOT
# {x-version-update-end}

# Versions for dependencies which actual artifacts differ between Bazel and Gradle.
Expand Down
6 changes: 3 additions & 3 deletions gax-java/gax-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
<version>0.114.1-SNAPSHOT</version><!-- {x-version-update:gax-httpjson:current} -->
<version>2.29.1-SNAPSHOT</version><!-- {x-version-update:gax:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
<version>0.114.1-SNAPSHOT</version><!-- {x-version-update:gax-httpjson:current} -->
<version>2.29.1-SNAPSHOT</version><!-- {x-version-update:gax:current} -->
<type>test-jar</type>
<classifier>testlib</classifier>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
<version>0.114.1-SNAPSHOT</version><!-- {x-version-update:gax-httpjson:current} -->
<version>2.29.1-SNAPSHOT</version><!-- {x-version-update:gax:current} -->
<classifier>testlib</classifier>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion gax-java/gax-httpjson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>gax-httpjson</artifactId>
<version>0.114.1-SNAPSHOT</version> <!-- {x-version-update:gax-httpjson:current} -->
<version>2.29.1-SNAPSHOT</version> <!-- {x-version-update:gax:current} -->
<packaging>jar</packaging>
<name>GAX (Google Api eXtensions) for Java (HTTP JSON)</name>
<description>Google Api eXtensions for Java (HTTP JSON)</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import com.google.auto.value.AutoValue;
import javax.annotation.Nullable;

@BetaApi
@AutoValue
/* Method descriptor for messages to be transmitted over HTTP. */
public abstract class ApiMethodDescriptor<RequestT, ResponseT> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import javax.annotation.Nullable;

/**
* A {@link HttpJsonClientCall} which forwards all of its methods to another {@link
* HttpJsonClientCall}.
*/
@BetaApi
public abstract class ForwardingHttpJsonClientCall<RequestT, ResponseT>
extends HttpJsonClientCall<RequestT, ResponseT> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@

package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;

/**
* A {@link HttpJsonClientCall.Listener} which forwards all of its methods to another {@link
* HttpJsonClientCall.Listener}.
*/
@BetaApi
public abstract class ForwardingHttpJsonClientCallListener<ResponseT>
extends HttpJsonClientCall.Listener<ResponseT> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
* copies of the object, but with one field changed. The immutability and thread safety of the
* arguments solely depends on the arguments themselves.
*/
@BetaApi("Reference ApiCallContext instead - this class is likely to experience breaking changes")
public final class HttpJsonCallContext implements ApiCallContext {
private final HttpJsonChannel channel;
private final HttpJsonCallOptions callOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import com.google.auth.Credentials;
import com.google.auto.value.AutoValue;
import com.google.protobuf.TypeRegistry;
Expand All @@ -38,7 +37,6 @@
import org.threeten.bp.Instant;

/** Options for an http-json call, including deadline and credentials. */
@BetaApi
@AutoValue
public abstract class HttpJsonCallOptions {
public static final HttpJsonCallOptions DEFAULT = newBuilder().build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;

/** HttpJsonChannel contains the functionality to issue http-json calls. */
@BetaApi
public interface HttpJsonChannel {
<RequestT, ResponseT> HttpJsonClientCall<RequestT, ResponseT> newCall(
ApiMethodDescriptor<RequestT, ResponseT> methodDescriptor, HttpJsonCallOptions callOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import javax.annotation.Nullable;

// This class mimics the structure and behavior of the corresponding ClientCall from gRPC package as
Expand Down Expand Up @@ -58,7 +57,6 @@
* @param <RequestT> type of message sent to the server
* @param <ResponseT> type of message received one or more times from the server
*/
@BetaApi
public abstract class HttpJsonClientCall<RequestT, ResponseT> {
/**
* Callbacks for receiving metadata, response messages and completion status from the server.
Expand All @@ -67,7 +65,6 @@ public abstract class HttpJsonClientCall<RequestT, ResponseT> {
* not required to be thread-safe, but they must not be thread-hostile. The caller is free to call
* an instance from multiple threads, but only one call simultaneously.
*/
@BetaApi
public abstract static class Listener<T> {
/**
* The response headers have been received. Headers always precede messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,13 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;

/**
* Interface for intercepting outgoing calls before they are dispatched by a {@link
* HttpJsonChannel}.
*
* <p>The interceptor may be called for multiple {@link HttpJsonClientCall calls} by one or more
* threads without completing the previous ones first. The implementations must be thread-safe.
*/
@BetaApi
public interface HttpJsonClientInterceptor {
/**
* Intercept {@link HttpJsonClientCall} creation by the {@code next} {@link HttpJsonChannel}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
package com.google.api.gax.httpjson;

import com.google.api.client.http.HttpHeaders;
import com.google.api.core.BetaApi;

/** Interface for functionality to enhance headers for an http-json call. */
@BetaApi
public interface HttpJsonHeaderEnhancer {
void enhance(HttpHeaders headers);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
package com.google.api.gax.httpjson;

import com.google.api.client.http.HttpHeaders;
import com.google.api.core.BetaApi;

/** Utility class that creates instances of {@link HttpJsonHeaderEnhancer}. */
@BetaApi
public class HttpJsonHeaderEnhancers {

private HttpJsonHeaderEnhancers() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import java.util.List;

/** Provider of custom REST ClientInterceptors. */
@BetaApi(
"The surface for adding custom interceptors is not stable yet and may change in the future.")
public interface HttpJsonInterceptorProvider {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import com.google.api.core.InternalExtensionOnly;
import com.google.auto.value.AutoValue;
import java.util.Collections;
Expand All @@ -39,7 +38,6 @@
import javax.annotation.Nullable;

@AutoValue
@BetaApi
@InternalExtensionOnly
public abstract class HttpJsonMetadata {
public abstract Map<String, Object> getHeaders();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
import com.google.api.gax.longrunning.OperationSnapshot;
import com.google.api.gax.rpc.StatusCode;
Expand All @@ -41,7 +40,6 @@
*
* <p>Public for technical reasons. For internal use only.
*/
@BetaApi
@InternalApi
public class HttpJsonOperationSnapshot implements OperationSnapshot {
private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
import com.google.api.gax.longrunning.OperationSnapshot;
import com.google.api.gax.rpc.ApiCallContext;
Expand All @@ -46,7 +45,6 @@
*
* <p>Public for technical reasons. For internal use only.
*/
@BetaApi
@InternalApi
public class HttpJsonOperationSnapshotCallable<RequestT, OperationT>
extends UnaryCallable<RequestT, OperationSnapshot> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import com.google.api.core.InternalExtensionOnly;
import com.google.api.gax.rpc.StatusCode;
import java.util.Objects;

/** A failure code specific to an HTTP call. */
@BetaApi
@InternalExtensionOnly
public class HttpJsonStatusCode implements StatusCode {
private final int httpStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import com.google.api.pathtemplate.PathTemplate;
import java.util.Collections;
import java.util.List;
Expand All @@ -52,7 +51,6 @@ public interface HttpRequestFormatter<MessageFormatT> {
PathTemplate getPathTemplate();

/** Additional (alternative) path templates for endpoint URL path. */
@BetaApi
default List<PathTemplate> getAdditionalPathTemplates() {
return Collections.emptyList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.core.BetaApi;
import com.google.api.core.InternalExtensionOnly;
import com.google.api.gax.core.ExecutorProvider;
import com.google.api.gax.rpc.FixedHeaderProvider;
Expand Down Expand Up @@ -59,7 +58,6 @@
* <p>The client lib header and generator header values are used to form a value that goes into the
* http header of requests to the service.
*/
@BetaApi
@InternalExtensionOnly
public final class InstantiatingHttpJsonChannelProvider implements TransportChannelProvider {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.common.annotations.VisibleForTesting;
Expand All @@ -45,7 +44,6 @@
import javax.annotation.Nullable;

/** Implementation of HttpJsonChannel which can issue http-json calls. */
@BetaApi
public class ManagedHttpJsonChannel implements HttpJsonChannel, BackgroundResource {

private final Executor executor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import com.google.common.annotations.VisibleForTesting;
import java.util.concurrent.TimeUnit;

@BetaApi
class ManagedHttpJsonInterceptorChannel extends ManagedHttpJsonChannel {

private final ManagedHttpJsonChannel channel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
import com.google.api.pathtemplate.PathTemplate;
import com.google.protobuf.Message;
Expand Down Expand Up @@ -121,7 +120,6 @@ public String getPath(RequestT apiMessage) {
return path;
}

@BetaApi
@Override
public List<PathTemplate> getAdditionalPathTemplates() {
return additionalPathTemplates;
Expand Down Expand Up @@ -161,7 +159,6 @@ public Builder<RequestT> setPath(
return this;
}

@BetaApi
public Builder<RequestT> setAdditionalPaths(String... rawAdditionalPaths) {
this.rawAdditionalPaths = Arrays.asList(rawAdditionalPaths);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;
import com.google.common.collect.ImmutableList;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
Expand All @@ -50,7 +49,6 @@
* URL path parameters, and query parameters. It deserializes JSON responses into response protobuf
* message.
*/
@BetaApi
public class ProtoRestSerializer<RequestT extends Message> {

private final TypeRegistry registry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,10 @@
*/
package com.google.api.gax.httpjson;

import com.google.api.core.BetaApi;

/**
* An exception thrown when a protobuf message cannot be serialized/deserialized for REST
* interactions.
*/
@BetaApi
public class RestSerializationException extends RuntimeException {

private static final long serialVersionUID = -6485633460933364916L;
Expand Down
Loading

0 comments on commit 9f15fea

Please sign in to comment.