public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.longrunning.GetOperationRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.longrunning.GetOperationRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; }
/** * <pre> * The name of the operation resource. * </pre> * * <code>string name = 1;</code> */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); name_ = value; onChanged(); return this; } public final Builder setUnknownFields(
/** * Waits for an operation like cluster resizing to complete. * @param operationName The fully qualified name of the operation * @param maxSeconds The maximum amount of seconds to wait for the operation to complete. * @throws InterruptedException if a user interrupts the process, usually with a ^C. */ public void waitForOperation(String operationName, int maxSeconds) throws InterruptedException { long endTimeMillis = TimeUnit.SECONDS.toMillis(maxSeconds) + System.currentTimeMillis(); GetOperationRequest request = GetOperationRequest.newBuilder().setName(operationName).build(); do { Thread.sleep(500); Operation response = client.getOperation(request); if (response.getDone()) { switch (response.getResultCase()) { case RESPONSE: return; case ERROR: throw new RuntimeException("Cluster could not be resized: " + response.getError()); case RESULT_NOT_SET: throw new IllegalStateException( "System returned invalid response for Operation check: " + response); } } } while (System.currentTimeMillis() < endTimeMillis); throw new IllegalStateException( String.format("Waited %d seconds and cluster was not resized yet.", maxSeconds)); }
/** * Gets the latest state of a long-running operation. Clients can use this method to poll the * operation result at intervals as recommended by the API service. * * <p>Sample code: * * <pre><code> * try (OperationsClient operationsClient = OperationsClient.create()) { * String name = ""; * Operation response = operationsClient.getOperation(name); * } * </code></pre> * * @param name The name of the operation resource. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Operation getOperation(String name) { GetOperationRequest request = GetOperationRequest.newBuilder().setName(name).build(); return getOperation(request); }
/** * Gets the latest state of a long-running operation. Clients can use this method to poll the * operation result at intervals as recommended by the API service. * * <p>Sample code: * * <pre><code> * try (OperationsClient operationsClient = OperationsClient.create()) { * String name = ""; * Operation response = operationsClient.getOperation(name); * } * </code></pre> * * @param name The name of the operation resource. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Operation getOperation(String name) { GetOperationRequest request = GetOperationRequest.newBuilder().setName(name).build(); return getOperation(request); }
public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.longrunning.GetOperationRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.longrunning.GetOperationRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; }
/** * <pre> * The name of the operation resource. * </pre> * * <code>string name = 1;</code> */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } name_ = value; onChanged(); return this; } /**
/** * <pre> * The name of the operation resource. * </pre> * * <code>string name = 1;</code> */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); name_ = value; onChanged(); return this; } public final Builder setUnknownFields(
/** * <pre> * The name of the operation resource. * </pre> * * <code>string name = 1;</code> */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } name_ = value; onChanged(); return this; } /**
private Builder() { maybeForceBuilderInitialization(); }
/** * <pre> * The name of the operation resource. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
public static Builder newBuilder(com.google.longrunning.GetOperationRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() {
public static Builder newBuilder(com.google.longrunning.GetOperationRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() {
/** * <pre> * The name of the operation resource. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
private Builder() { maybeForceBuilderInitialization(); }
public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.longrunning.GetOperationRequest) { return mergeFrom((com.google.longrunning.GetOperationRequest)other); } else { super.mergeFrom(other); return this; } }