Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

feat: migrate to microgenerator #159

Merged
merged 3 commits into from Dec 7, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

Large diffs are not rendered by default.

Expand Up @@ -5,14 +5,15 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.workflows.v1beta;

import static com.google.cloud.workflows.v1beta.WorkflowsClient.ListWorkflowsPagedResponse;
Expand All @@ -36,7 +37,7 @@
import java.util.List;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Settings class to configure an instance of {@link WorkflowsClient}.
*
Expand All @@ -53,23 +54,23 @@
*
* <p>For example, to set the total timeout of getWorkflow to 30 seconds:
*
* <pre>
* <code>
* WorkflowsSettings.Builder workflowsSettingsBuilder =
* WorkflowsSettings.newBuilder();
* <pre>{@code
* WorkflowsSettings.Builder workflowsSettingsBuilder = WorkflowsSettings.newBuilder();
* workflowsSettingsBuilder
* .getWorkflowSettings()
* .setRetrySettings(
* workflowsSettingsBuilder.getWorkflowSettings().getRetrySettings().toBuilder()
* workflowsSettingsBuilder
* .getWorkflowSettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* WorkflowsSettings workflowsSettings = workflowsSettingsBuilder.build();
* </code>
* </pre>
* }</pre>
*/
@Generated("by gapic-generator")
@BetaApi
@Generated("by gapic-generator-java")
public class WorkflowsSettings extends ClientSettings<WorkflowsSettings> {

/** Returns the object with the settings used for calls to listWorkflows. */
public PagedCallSettings<ListWorkflowsRequest, ListWorkflowsResponse, ListWorkflowsPagedResponse>
listWorkflowsSettings() {
Expand All @@ -87,8 +88,6 @@ public UnaryCallSettings<CreateWorkflowRequest, Operation> createWorkflowSetting
}

/** Returns the object with the settings used for calls to createWorkflow. */
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings<CreateWorkflowRequest, Workflow, OperationMetadata>
createWorkflowOperationSettings() {
return ((WorkflowsStubSettings) getStubSettings()).createWorkflowOperationSettings();
Expand All @@ -100,8 +99,6 @@ public UnaryCallSettings<DeleteWorkflowRequest, Operation> deleteWorkflowSetting
}

/** Returns the object with the settings used for calls to deleteWorkflow. */
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings<DeleteWorkflowRequest, Empty, OperationMetadata>
deleteWorkflowOperationSettings() {
return ((WorkflowsStubSettings) getStubSettings()).deleteWorkflowOperationSettings();
Expand All @@ -113,8 +110,6 @@ public UnaryCallSettings<UpdateWorkflowRequest, Operation> updateWorkflowSetting
}

/** Returns the object with the settings used for calls to updateWorkflow. */
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings<UpdateWorkflowRequest, Workflow, OperationMetadata>
updateWorkflowOperationSettings() {
return ((WorkflowsStubSettings) getStubSettings()).updateWorkflowOperationSettings();
Expand Down Expand Up @@ -179,18 +174,15 @@ protected WorkflowsSettings(Builder settingsBuilder) throws IOException {

/** Builder for WorkflowsSettings. */
public static class Builder extends ClientSettings.Builder<WorkflowsSettings, Builder> {

protected Builder() throws IOException {
this((ClientContext) null);
this(((ClientContext) null));
}

protected Builder(ClientContext clientContext) {
super(WorkflowsStubSettings.newBuilder(clientContext));
}

private static Builder createDefault() {
return new Builder(WorkflowsStubSettings.newBuilder());
}

protected Builder(WorkflowsSettings settings) {
super(settings.getStubSettings().toBuilder());
}
Expand All @@ -199,11 +191,15 @@ protected Builder(WorkflowsStubSettings.Builder stubSettings) {
super(stubSettings);
}

private static Builder createDefault() {
return new Builder(WorkflowsStubSettings.newBuilder());
}

public WorkflowsStubSettings.Builder getStubSettingsBuilder() {
return ((WorkflowsStubSettings.Builder) getStubSettings());
}

// NEXT_MAJOR_VER: remove 'throws Exception'
// NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
Expand Down Expand Up @@ -234,8 +230,6 @@ public UnaryCallSettings.Builder<CreateWorkflowRequest, Operation> createWorkflo
}

/** Returns the builder for the settings used for calls to createWorkflow. */
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings.Builder<CreateWorkflowRequest, Workflow, OperationMetadata>
createWorkflowOperationSettings() {
return getStubSettingsBuilder().createWorkflowOperationSettings();
Expand All @@ -247,8 +241,6 @@ public UnaryCallSettings.Builder<DeleteWorkflowRequest, Operation> deleteWorkflo
}

/** Returns the builder for the settings used for calls to deleteWorkflow. */
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings.Builder<DeleteWorkflowRequest, Empty, OperationMetadata>
deleteWorkflowOperationSettings() {
return getStubSettingsBuilder().deleteWorkflowOperationSettings();
Expand All @@ -260,8 +252,6 @@ public UnaryCallSettings.Builder<UpdateWorkflowRequest, Operation> updateWorkflo
}

/** Returns the builder for the settings used for calls to updateWorkflow. */
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings.Builder<UpdateWorkflowRequest, Workflow, OperationMetadata>
updateWorkflowOperationSettings() {
return getStubSettingsBuilder().updateWorkflowOperationSettings();
Expand Down
Expand Up @@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -15,27 +15,16 @@
*/

/**
* A client to Workflows API.
* The interfaces provided are listed below, along with usage samples.
*
* <p>The interfaces provided are listed below, along with usage samples.
*
* <p>=============== WorkflowsClient ===============
* <p>======================= WorkflowsClient =======================
*
* <p>Service Description: Workflows is used to deploy and execute workflow programs. Workflows
* makes sure the program executes reliably, despite hardware and networking interruptions.
*
* <p>Sample for WorkflowsClient:
*
* <pre>
* <code>
* try (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
* WorkflowName name = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
* Workflow response = workflowsClient.getWorkflow(name);
* }
* </code>
* </pre>
*/
@Generated("by gapic-generator")
@Generated("by gapic-generator-java")
package com.google.cloud.workflows.v1beta;

import javax.annotation.Generated;
Expand Up @@ -5,17 +5,17 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.workflows.v1beta.stub;

import com.google.api.core.BetaApi;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcCallableFactory;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
Expand All @@ -31,18 +31,19 @@
import com.google.api.gax.rpc.StreamingCallSettings;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.longrunning.Operation;
import com.google.longrunning.stub.OperationsStub;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* gRPC callable factory implementation for Workflows API.
* gRPC callable factory implementation for the Workflows service API.
*
* <p>This class is for advanced usage.
*/
@Generated("by gapic-generator")
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public class GrpcWorkflowsCallableFactory implements GrpcStubCallableFactory {

@Override
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCallable(
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
Expand All @@ -55,61 +56,58 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCalla
public <RequestT, ResponseT, PagedListResponseT>
UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> pagedCallSettings,
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createPagedCallable(
grpcCallSettings, pagedCallSettings, clientContext);
return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext);
}

@Override
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCallable(
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
BatchingCallSettings<RequestT, ResponseT> batchingCallSettings,
BatchingCallSettings<RequestT, ResponseT> callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createBatchingCallable(
grpcCallSettings, batchingCallSettings, clientContext);
grpcCallSettings, callSettings, clientContext);
}

@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
@Override
public <RequestT, ResponseT, MetadataT>
OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
GrpcCallSettings<RequestT, com.google.longrunning.Operation> grpcCallSettings,
OperationCallSettings<RequestT, ResponseT, MetadataT> operationCallSettings,
GrpcCallSettings<RequestT, Operation> grpcCallSettings,
OperationCallSettings<RequestT, ResponseT, MetadataT> callSettings,
ClientContext clientContext,
OperationsStub operationsStub) {
return GrpcCallableFactory.createOperationCallable(
grpcCallSettings, operationCallSettings, clientContext, operationsStub);
grpcCallSettings, callSettings, clientContext, operationsStub);
}

@Override
public <RequestT, ResponseT>
BidiStreamingCallable<RequestT, ResponseT> createBidiStreamingCallable(
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
StreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
StreamingCallSettings<RequestT, ResponseT> callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createBidiStreamingCallable(
grpcCallSettings, streamingCallSettings, clientContext);
grpcCallSettings, callSettings, clientContext);
}

@Override
public <RequestT, ResponseT>
ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable(
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
ServerStreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
ServerStreamingCallSettings<RequestT, ResponseT> callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createServerStreamingCallable(
grpcCallSettings, streamingCallSettings, clientContext);
grpcCallSettings, callSettings, clientContext);
}

@Override
public <RequestT, ResponseT>
ClientStreamingCallable<RequestT, ResponseT> createClientStreamingCallable(
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
StreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
StreamingCallSettings<RequestT, ResponseT> callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createClientStreamingCallable(
grpcCallSettings, streamingCallSettings, clientContext);
grpcCallSettings, callSettings, clientContext);
}
}