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

Regenerating SPI layer #1501

Merged
merged 1 commit into from
Jan 5, 2017
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
4 changes: 2 additions & 2 deletions google-cloud-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-common-protos</artifactId>
<version>0.1.3</version>
<version>0.1.5</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
Expand All @@ -133,7 +133,7 @@
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-iam-v1</artifactId>
<version>0.1.3</version>
<version>0.1.5</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
Expand Down
2 changes: 1 addition & 1 deletion google-cloud-errorreporting/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-error-reporting-v1beta1</artifactId>
<version>0.1.3</version>
<version>0.1.5</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import com.google.api.gax.grpc.ChannelAndExecutor;
import com.google.api.gax.grpc.UnaryCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup;
import com.google.devtools.clouderrorreporting.v1beta1.GetGroupRequest;
import com.google.devtools.clouderrorreporting.v1beta1.GroupName;
import com.google.devtools.clouderrorreporting.v1beta1.UpdateGroupRequest;
import com.google.protobuf.ExperimentalApi;
import io.grpc.ManagedChannel;
Expand All @@ -40,8 +40,8 @@
* <pre>
* <code>
* try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
* String formattedGroupName = ErrorGroupServiceClient.formatGroupName("[PROJECT]", "[GROUP]");
* ErrorGroup response = errorGroupServiceClient.getGroup(formattedGroupName);
* GroupName groupName = GroupName.create("[PROJECT]", "[GROUP]");
* ErrorGroup response = errorGroupServiceClient.getGroup(groupName);
* }
* </code>
* </pre>
Expand Down Expand Up @@ -97,26 +97,6 @@ public class ErrorGroupServiceClient implements AutoCloseable {
private final UnaryCallable<GetGroupRequest, ErrorGroup> getGroupCallable;
private final UnaryCallable<UpdateGroupRequest, ErrorGroup> updateGroupCallable;

private static final PathTemplate GROUP_PATH_TEMPLATE =
PathTemplate.createWithoutUrlEncoding("projects/{project}/groups/{group}");

/** Formats a string containing the fully-qualified path to represent a group resource. */
public static final String formatGroupName(String project, String group) {
return GROUP_PATH_TEMPLATE.instantiate(
"project", project,
"group", group);
}

/** Parses the project from the given fully-qualified path which represents a group resource. */
public static final String parseProjectFromGroupName(String groupName) {
return GROUP_PATH_TEMPLATE.parse(groupName).get("project");
}

/** Parses the group from the given fully-qualified path which represents a group resource. */
public static final String parseGroupFromGroupName(String groupName) {
return GROUP_PATH_TEMPLATE.parse(groupName).get("group");
}

/** Constructs an instance of ErrorGroupServiceClient with default settings. */
public static final ErrorGroupServiceClient create() throws IOException {
return create(ErrorGroupServiceSettings.defaultBuilder().build());
Expand Down Expand Up @@ -179,8 +159,8 @@ public final ErrorGroupServiceSettings getSettings() {
*
* <pre><code>
* try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
* String formattedGroupName = ErrorGroupServiceClient.formatGroupName("[PROJECT]", "[GROUP]");
* ErrorGroup response = errorGroupServiceClient.getGroup(formattedGroupName);
* GroupName groupName = GroupName.create("[PROJECT]", "[GROUP]");
* ErrorGroup response = errorGroupServiceClient.getGroup(groupName);
* }
* </code></pre>
*
Expand All @@ -192,9 +172,10 @@ public final ErrorGroupServiceSettings getSettings() {
* <p>Example: &lt;code&gt;projects/my-project-123/groups/my-group&lt;/code&gt;
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ErrorGroup getGroup(String groupName) {
GROUP_PATH_TEMPLATE.validate(groupName, "getGroup");
GetGroupRequest request = GetGroupRequest.newBuilder().setGroupName(groupName).build();
public final ErrorGroup getGroup(GroupName groupName) {

GetGroupRequest request =
GetGroupRequest.newBuilder().setGroupNameWithGroupName(groupName).build();
return getGroup(request);
}

Expand All @@ -206,9 +187,9 @@ public final ErrorGroup getGroup(String groupName) {
*
* <pre><code>
* try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
* String formattedGroupName = ErrorGroupServiceClient.formatGroupName("[PROJECT]", "[GROUP]");
* GroupName groupName = GroupName.create("[PROJECT]", "[GROUP]");
* GetGroupRequest request = GetGroupRequest.newBuilder()
* .setGroupName(formattedGroupName)
* .setGroupNameWithGroupName(groupName)
* .build();
* ErrorGroup response = errorGroupServiceClient.getGroup(request);
* }
Expand All @@ -229,9 +210,9 @@ private final ErrorGroup getGroup(GetGroupRequest request) {
*
* <pre><code>
* try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
* String formattedGroupName = ErrorGroupServiceClient.formatGroupName("[PROJECT]", "[GROUP]");
* GroupName groupName = GroupName.create("[PROJECT]", "[GROUP]");
* GetGroupRequest request = GetGroupRequest.newBuilder()
* .setGroupName(formattedGroupName)
* .setGroupNameWithGroupName(groupName)
* .build();
* ListenableFuture&lt;ErrorGroup&gt; future = errorGroupServiceClient.getGroupCallable().futureCall(request);
* // Do something
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

import com.google.api.gax.grpc.ChannelAndExecutor;
import com.google.api.gax.grpc.UnaryCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest;
import com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse;
import com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest;
import com.google.devtools.clouderrorreporting.v1beta1.ListEventsResponse;
import com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest;
import com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsResponse;
import com.google.devtools.clouderrorreporting.v1beta1.ProjectName;
import com.google.devtools.clouderrorreporting.v1beta1.QueryTimeRange;
import com.google.protobuf.ExperimentalApi;
import io.grpc.ManagedChannel;
Expand All @@ -48,8 +48,8 @@
* <pre>
* <code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* DeleteEventsResponse response = errorStatsServiceClient.deleteEvents(formattedProjectName);
* ProjectName projectName = ProjectName.create("[PROJECT]");
* DeleteEventsResponse response = errorStatsServiceClient.deleteEvents(projectName);
* }
* </code>
* </pre>
Expand Down Expand Up @@ -109,19 +109,6 @@ public class ErrorStatsServiceClient implements AutoCloseable {
private final UnaryCallable<ListEventsRequest, ListEventsPagedResponse> listEventsPagedCallable;
private final UnaryCallable<DeleteEventsRequest, DeleteEventsResponse> deleteEventsCallable;

private static final PathTemplate PROJECT_PATH_TEMPLATE =
PathTemplate.createWithoutUrlEncoding("projects/{project}");

/** Formats a string containing the fully-qualified path to represent a project resource. */
public static final String formatProjectName(String project) {
return PROJECT_PATH_TEMPLATE.instantiate("project", project);
}

/** Parses the project from the given fully-qualified path which represents a project resource. */
public static final String parseProjectFromProjectName(String projectName) {
return PROJECT_PATH_TEMPLATE.parse(projectName).get("project");
}

/** Constructs an instance of ErrorStatsServiceClient with default settings. */
public static final ErrorStatsServiceClient create() throws IOException {
return create(ErrorStatsServiceSettings.defaultBuilder().build());
Expand Down Expand Up @@ -192,9 +179,9 @@ public final ErrorStatsServiceSettings getSettings() {
*
* <pre><code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* ProjectName projectName = ProjectName.create("[PROJECT]");
* QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
* for (ErrorGroupStats element : errorStatsServiceClient.listGroupStats(formattedProjectName, timeRange).iterateAllElements()) {
* for (ErrorGroupStats element : errorStatsServiceClient.listGroupStats(projectName, timeRange).iterateAllElements()) {
* // doThingsWith(element);
* }
* }
Expand All @@ -205,18 +192,19 @@ public final ErrorStatsServiceSettings getSettings() {
* href="https://support.google.com/cloud/answer/6158840"&gt;Google Cloud Platform project
* ID&lt;/a&gt;.
* <p>Example: &lt;code&gt;projects/my-project-123&lt;/code&gt;.
* @param timeRange [Required] List data for the given time range. Only
* &lt;code&gt;ErrorGroupStats&lt;/code&gt; with a non-zero count in the given time range are
* returned, unless the request contains an explicit group_id list. If a group_id list is
* given, also &lt;code&gt;ErrorGroupStats&lt;/code&gt; with zero occurrences are returned.
* @param timeRange [Optional] List data for the given time range. If not set a default time range
* is used. The field time_range_begin in the response will specify the beginning of this time
* range. Only &lt;code&gt;ErrorGroupStats&lt;/code&gt; with a non-zero count in the given
* time range are returned, unless the request contains an explicit group_id list. If a
* group_id list is given, also &lt;code&gt;ErrorGroupStats&lt;/code&gt; with zero occurrences
* are returned.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ListGroupStatsPagedResponse listGroupStats(
String projectName, QueryTimeRange timeRange) {
PROJECT_PATH_TEMPLATE.validate(projectName, "listGroupStats");
ProjectName projectName, QueryTimeRange timeRange) {
ListGroupStatsRequest request =
ListGroupStatsRequest.newBuilder()
.setProjectName(projectName)
.setProjectNameWithProjectName(projectName)
.setTimeRange(timeRange)
.build();
return listGroupStats(request);
Expand All @@ -230,10 +218,10 @@ public final ListGroupStatsPagedResponse listGroupStats(
*
* <pre><code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* ProjectName projectName = ProjectName.create("[PROJECT]");
* QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
* ListGroupStatsRequest request = ListGroupStatsRequest.newBuilder()
* .setProjectName(formattedProjectName)
* .setProjectNameWithProjectName(projectName)
* .setTimeRange(timeRange)
* .build();
* for (ErrorGroupStats element : errorStatsServiceClient.listGroupStats(request).iterateAllElements()) {
Expand All @@ -257,10 +245,10 @@ public final ListGroupStatsPagedResponse listGroupStats(ListGroupStatsRequest re
*
* <pre><code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* ProjectName projectName = ProjectName.create("[PROJECT]");
* QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
* ListGroupStatsRequest request = ListGroupStatsRequest.newBuilder()
* .setProjectName(formattedProjectName)
* .setProjectNameWithProjectName(projectName)
* .setTimeRange(timeRange)
* .build();
* ListenableFuture&lt;ListGroupStatsPagedResponse&gt; future = errorStatsServiceClient.listGroupStatsPagedCallable().futureCall(request);
Expand All @@ -284,10 +272,10 @@ public final ListGroupStatsPagedResponse listGroupStats(ListGroupStatsRequest re
*
* <pre><code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* ProjectName projectName = ProjectName.create("[PROJECT]");
* QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
* ListGroupStatsRequest request = ListGroupStatsRequest.newBuilder()
* .setProjectName(formattedProjectName)
* .setProjectNameWithProjectName(projectName)
* .setTimeRange(timeRange)
* .build();
* while (true) {
Expand Down Expand Up @@ -318,9 +306,9 @@ public final ListGroupStatsPagedResponse listGroupStats(ListGroupStatsRequest re
*
* <pre><code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* ProjectName projectName = ProjectName.create("[PROJECT]");
* String groupId = "";
* for (ErrorEvent element : errorStatsServiceClient.listEvents(formattedProjectName, groupId).iterateAllElements()) {
* for (ErrorEvent element : errorStatsServiceClient.listEvents(projectName, groupId).iterateAllElements()) {
* // doThingsWith(element);
* }
* }
Expand All @@ -332,10 +320,12 @@ public final ListGroupStatsPagedResponse listGroupStats(ListGroupStatsRequest re
* @param groupId [Required] The group for which events shall be returned.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ListEventsPagedResponse listEvents(String projectName, String groupId) {
PROJECT_PATH_TEMPLATE.validate(projectName, "listEvents");
public final ListEventsPagedResponse listEvents(ProjectName projectName, String groupId) {
ListEventsRequest request =
ListEventsRequest.newBuilder().setProjectName(projectName).setGroupId(groupId).build();
ListEventsRequest.newBuilder()
.setProjectNameWithProjectName(projectName)
.setGroupId(groupId)
.build();
return listEvents(request);
}

Expand All @@ -347,10 +337,10 @@ public final ListEventsPagedResponse listEvents(String projectName, String group
*
* <pre><code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* ProjectName projectName = ProjectName.create("[PROJECT]");
* String groupId = "";
* ListEventsRequest request = ListEventsRequest.newBuilder()
* .setProjectName(formattedProjectName)
* .setProjectNameWithProjectName(projectName)
* .setGroupId(groupId)
* .build();
* for (ErrorEvent element : errorStatsServiceClient.listEvents(request).iterateAllElements()) {
Expand All @@ -374,10 +364,10 @@ public final ListEventsPagedResponse listEvents(ListEventsRequest request) {
*
* <pre><code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* ProjectName projectName = ProjectName.create("[PROJECT]");
* String groupId = "";
* ListEventsRequest request = ListEventsRequest.newBuilder()
* .setProjectName(formattedProjectName)
* .setProjectNameWithProjectName(projectName)
* .setGroupId(groupId)
* .build();
* ListenableFuture&lt;ListEventsPagedResponse&gt; future = errorStatsServiceClient.listEventsPagedCallable().futureCall(request);
Expand All @@ -400,10 +390,10 @@ public final UnaryCallable<ListEventsRequest, ListEventsPagedResponse> listEvent
*
* <pre><code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* ProjectName projectName = ProjectName.create("[PROJECT]");
* String groupId = "";
* ListEventsRequest request = ListEventsRequest.newBuilder()
* .setProjectName(formattedProjectName)
* .setProjectNameWithProjectName(projectName)
* .setGroupId(groupId)
* .build();
* while (true) {
Expand Down Expand Up @@ -433,8 +423,8 @@ public final UnaryCallable<ListEventsRequest, ListEventsResponse> listEventsCall
*
* <pre><code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* DeleteEventsResponse response = errorStatsServiceClient.deleteEvents(formattedProjectName);
* ProjectName projectName = ProjectName.create("[PROJECT]");
* DeleteEventsResponse response = errorStatsServiceClient.deleteEvents(projectName);
* }
* </code></pre>
*
Expand All @@ -443,10 +433,10 @@ public final UnaryCallable<ListEventsRequest, ListEventsResponse> listEventsCall
* ID](https://support.google.com/cloud/answer/6158840). Example: `projects/my-project-123`.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final DeleteEventsResponse deleteEvents(String projectName) {
PROJECT_PATH_TEMPLATE.validate(projectName, "deleteEvents");
public final DeleteEventsResponse deleteEvents(ProjectName projectName) {

DeleteEventsRequest request =
DeleteEventsRequest.newBuilder().setProjectName(projectName).build();
DeleteEventsRequest.newBuilder().setProjectNameWithProjectName(projectName).build();
return deleteEvents(request);
}

Expand All @@ -458,9 +448,9 @@ public final DeleteEventsResponse deleteEvents(String projectName) {
*
* <pre><code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* ProjectName projectName = ProjectName.create("[PROJECT]");
* DeleteEventsRequest request = DeleteEventsRequest.newBuilder()
* .setProjectName(formattedProjectName)
* .setProjectNameWithProjectName(projectName)
* .build();
* DeleteEventsResponse response = errorStatsServiceClient.deleteEvents(request);
* }
Expand All @@ -481,9 +471,9 @@ private final DeleteEventsResponse deleteEvents(DeleteEventsRequest request) {
*
* <pre><code>
* try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
* String formattedProjectName = ErrorStatsServiceClient.formatProjectName("[PROJECT]");
* ProjectName projectName = ProjectName.create("[PROJECT]");
* DeleteEventsRequest request = DeleteEventsRequest.newBuilder()
* .setProjectName(formattedProjectName)
* .setProjectNameWithProjectName(projectName)
* .build();
* ListenableFuture&lt;DeleteEventsResponse&gt; future = errorStatsServiceClient.deleteEventsCallable().futureCall(request);
* // Do something
Expand Down
Loading