* try (AddressClient addressClient = AddressClient.create()) {
* ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
- * Operation response = addressClient.deleteAddress(address);
+ * Address response = addressClient.getAddress(address);
* }
*
*
@@ -103,6 +106,7 @@
public class AddressClient implements BackgroundResource {
private final AddressSettings settings;
private final AddressStub stub;
+ private final RegionOperationClient operationsClient;
/** Constructs an instance of AddressClient with default settings. */
public static final AddressClient create() throws IOException {
@@ -133,12 +137,14 @@ public static final AddressClient create(AddressStub stub) {
protected AddressClient(AddressSettings settings) throws IOException {
this.settings = settings;
this.stub = ((AddressStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient = RegionOperationClient.create(this.stub.getOperationsStub());
}
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected AddressClient(AddressStub stub) {
this.settings = null;
this.stub = stub;
+ this.operationsClient = RegionOperationClient.create(this.stub.getOperationsStub());
}
public final AddressSettings getSettings() {
@@ -150,6 +156,16 @@ public AddressStub getStub() {
return stub;
}
+ /**
+ * Returns the RegionOperationClient that can be used to query the status of a long-running
+ * operation returned by another API method call.
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final RegionOperationClient getOperationsClient() {
+ return operationsClient;
+ }
+
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Retrieves an aggregated list of addresses.
@@ -298,21 +314,23 @@ public final AggregatedListAddressesPagedResponse aggregatedListAddresses(
*
* try (AddressClient addressClient = AddressClient.create()) {
* ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
- * Operation response = addressClient.deleteAddress(address);
+ * addressClient.deleteAddressAsync(address).get();
* }
*
*
* @param address Name of the address resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteAddress(ProjectRegionAddressName address) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (AddressClient addressClient = AddressClient.create()) {
* ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
- * Operation response = addressClient.deleteAddress(address.toString());
+ * addressClient.deleteAddressAsync(address.toString()).get();
* }
*
*
* @param address Name of the address resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteAddress(String address) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (AddressClient addressClient = AddressClient.create()) {
+ * ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
+ * DeleteAddressHttpRequest request = DeleteAddressHttpRequest.newBuilder()
+ * .setAddress(address.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = addressClient.deleteAddressOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (AddressClient addressClient = AddressClient.create()) {
+ * ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+ * Address addressResource = Address.newBuilder().build();
+ * InsertAddressHttpRequest request = InsertAddressHttpRequest.newBuilder()
+ * .setRegion(region.toString())
+ * .setAddressResource(addressResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = addressClient.insertAddressOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of deleteAddress to 30 seconds: + * example, to set the total timeout of getAddress to 30 seconds: * *
*@@ -103,6 +106,7 @@ public class AutoscalerClient implements BackgroundResource { private final AutoscalerSettings settings; private final AutoscalerStub stub; + private final ZoneOperationClient operationsClient; /** Constructs an instance of AutoscalerClient with default settings. */ public static final AutoscalerClient create() throws IOException { @@ -133,12 +137,14 @@ public static final AutoscalerClient create(AutoscalerStub stub) { protected AutoscalerClient(AutoscalerSettings settings) throws IOException { this.settings = settings; this.stub = ((AutoscalerStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = ZoneOperationClient.create(this.stub.getOperationsStub()); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected AutoscalerClient(AutoscalerStub stub) { this.settings = null; this.stub = stub; + this.operationsClient = ZoneOperationClient.create(this.stub.getOperationsStub()); } public final AutoscalerSettings getSettings() { @@ -150,6 +156,16 @@ public AutoscalerStub getStub() { return stub; } + /** + * Returns the ZoneOperationClient that can be used to query the status of a long-running + * operation returned by another API method call. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final ZoneOperationClient getOperationsClient() { + return operationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Retrieves an aggregated list of autoscalers. @@ -299,21 +315,23 @@ public final AggregatedListAutoscalersPagedResponse aggregatedListAutoscalers( ** AddressSettings.Builder addressSettingsBuilder = * AddressSettings.newBuilder(); - * addressSettingsBuilder.deleteAddressSettings().getRetrySettings().toBuilder() + * addressSettingsBuilder.getAddressSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * AddressSettings addressSettings = addressSettingsBuilder.build(); *@@ -78,6 +80,14 @@ public UnaryCallSettingsdeleteAddressSetti return ((AddressStubSettings) getStubSettings()).deleteAddressSettings(); } + /** Returns the object with the settings used for calls to deleteAddress. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + deleteAddressOperationSettings() { + return ((AddressStubSettings) getStubSettings()).deleteAddressOperationSettings(); + } + /** Returns the object with the settings used for calls to getAddress. */ public UnaryCallSettings getAddressSettings() { return ((AddressStubSettings) getStubSettings()).getAddressSettings(); @@ -88,6 +98,14 @@ public UnaryCallSettings insertAddressSetti return ((AddressStubSettings) getStubSettings()).insertAddressSettings(); } + /** Returns the object with the settings used for calls to insertAddress. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + insertAddressOperationSettings() { + return ((AddressStubSettings) getStubSettings()).insertAddressOperationSettings(); + } + /** Returns the object with the settings used for calls to listAddresses. */ public PagedCallSettings listAddressesSettings() { @@ -209,6 +227,14 @@ public UnaryCallSettings.Builder deleteAddr return getStubSettingsBuilder().deleteAddressSettings(); } + /** Returns the builder for the settings used for calls to deleteAddress. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteAddressOperationSettings() { + return getStubSettingsBuilder().deleteAddressOperationSettings(); + } + /** Returns the builder for the settings used for calls to getAddress. */ public UnaryCallSettings.Builder getAddressSettings() { return getStubSettingsBuilder().getAddressSettings(); @@ -219,6 +245,14 @@ public UnaryCallSettings.Builder insertAddr return getStubSettingsBuilder().insertAddressSettings(); } + /** Returns the builder for the settings used for calls to insertAddress. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + insertAddressOperationSettings() { + return getStubSettingsBuilder().insertAddressOperationSettings(); + } + /** Returns the builder for the settings used for calls to listAddresses. */ public PagedCallSettings.Builder< ListAddressesHttpRequest, AddressList, ListAddressesPagedResponse> diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerClient.java index e1a36fe8bb5e..b7145323b3c8 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerClient.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerClient.java @@ -20,9 +20,12 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.EmptyMessage; +import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.AutoscalerStub; @@ -43,7 +46,7 @@ * * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) { * ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]"); - * Operation response = autoscalerClient.deleteAutoscaler(autoscaler); + * Autoscaler response = autoscalerClient.getAutoscaler(autoscaler); * } **
* try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
* ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
- * Operation response = autoscalerClient.deleteAutoscaler(autoscaler);
+ * autoscalerClient.deleteAutoscalerAsync(autoscaler).get();
* }
*
*
* @param autoscaler Name of the autoscaler to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteAutoscaler(ProjectZoneAutoscalerName autoscaler) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
* ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
- * Operation response = autoscalerClient.deleteAutoscaler(autoscaler.toString());
+ * autoscalerClient.deleteAutoscalerAsync(autoscaler.toString()).get();
* }
*
*
* @param autoscaler Name of the autoscaler to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteAutoscaler(String autoscaler) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+ * ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
+ * DeleteAutoscalerHttpRequest request = DeleteAutoscalerHttpRequest.newBuilder()
+ * .setAutoscaler(autoscaler.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = autoscalerClient.deleteAutoscalerOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+ * ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+ * Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+ * InsertAutoscalerHttpRequest request = InsertAutoscalerHttpRequest.newBuilder()
+ * .setZone(zone.toString())
+ * .setAutoscalerResource(autoscalerResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = autoscalerClient.insertAutoscalerOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+ * String autoscaler = "";
+ * ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+ * Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * PatchAutoscalerHttpRequest request = PatchAutoscalerHttpRequest.newBuilder()
+ * .setAutoscaler(autoscaler)
+ * .setZone(zone.toString())
+ * .setAutoscalerResource(autoscalerResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = autoscalerClient.patchAutoscalerOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+ * String autoscaler = "";
+ * ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+ * Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * UpdateAutoscalerHttpRequest request = UpdateAutoscalerHttpRequest.newBuilder()
+ * .setAutoscaler(autoscaler)
+ * .setZone(zone.toString())
+ * .setAutoscalerResource(autoscalerResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = autoscalerClient.updateAutoscalerOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of deleteAutoscaler to 30 seconds: + * example, to set the total timeout of getAutoscaler to 30 seconds: * *
*@@ -104,6 +106,7 @@ public class BackendBucketClient implements BackgroundResource { private final BackendBucketSettings settings; private final BackendBucketStub stub; + private final GlobalOperationClient operationsClient; /** Constructs an instance of BackendBucketClient with default settings. */ public static final BackendBucketClient create() throws IOException { @@ -136,12 +139,14 @@ public static final BackendBucketClient create(BackendBucketStub stub) { protected BackendBucketClient(BackendBucketSettings settings) throws IOException { this.settings = settings; this.stub = ((BackendBucketStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected BackendBucketClient(BackendBucketStub stub) { this.settings = null; this.stub = stub; + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } public final BackendBucketSettings getSettings() { @@ -153,6 +158,16 @@ public BackendBucketStub getStub() { return stub; } + /** + * Returns the GlobalOperationClient that can be used to query the status of a long-running + * operation returned by another API method call. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final GlobalOperationClient getOperationsClient() { + return operationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Adds a key for validating requests with signed URLs for this backend bucket. @@ -163,7 +178,7 @@ public BackendBucketStub getStub() { * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) { * ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]"); * SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build(); - * Operation response = backendBucketClient.addSignedUrlKeyBackendBucket(backendBucket, signedUrlKeyResource); + * backendBucketClient.addSignedUrlKeyBackendBucketAsync(backendBucket, signedUrlKeyResource).get(); * } * * @@ -173,8 +188,9 @@ public BackendBucketStub getStub() { * URLs * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi - public final Operation addSignedUrlKeyBackendBucket( + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture* AutoscalerSettings.Builder autoscalerSettingsBuilder = * AutoscalerSettings.newBuilder(); - * autoscalerSettingsBuilder.deleteAutoscalerSettings().getRetrySettings().toBuilder() + * autoscalerSettingsBuilder.getAutoscalerSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * AutoscalerSettings autoscalerSettings = autoscalerSettingsBuilder.build(); *@@ -78,6 +80,14 @@ public UnaryCallSettingsdeleteAutoscale return ((AutoscalerStubSettings) getStubSettings()).deleteAutoscalerSettings(); } + /** Returns the object with the settings used for calls to deleteAutoscaler. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + deleteAutoscalerOperationSettings() { + return ((AutoscalerStubSettings) getStubSettings()).deleteAutoscalerOperationSettings(); + } + /** Returns the object with the settings used for calls to getAutoscaler. */ public UnaryCallSettings getAutoscalerSettings() { return ((AutoscalerStubSettings) getStubSettings()).getAutoscalerSettings(); @@ -88,6 +98,14 @@ public UnaryCallSettings insertAutoscale return ((AutoscalerStubSettings) getStubSettings()).insertAutoscalerSettings(); } + /** Returns the object with the settings used for calls to insertAutoscaler. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + insertAutoscalerOperationSettings() { + return ((AutoscalerStubSettings) getStubSettings()).insertAutoscalerOperationSettings(); + } + /** Returns the object with the settings used for calls to listAutoscalers. */ public PagedCallSettings listAutoscalersSettings() { @@ -99,11 +117,27 @@ public UnaryCallSettings patchAutoscalerS return ((AutoscalerStubSettings) getStubSettings()).patchAutoscalerSettings(); } + /** Returns the object with the settings used for calls to patchAutoscaler. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + patchAutoscalerOperationSettings() { + return ((AutoscalerStubSettings) getStubSettings()).patchAutoscalerOperationSettings(); + } + /** Returns the object with the settings used for calls to updateAutoscaler. */ public UnaryCallSettings updateAutoscalerSettings() { return ((AutoscalerStubSettings) getStubSettings()).updateAutoscalerSettings(); } + /** Returns the object with the settings used for calls to updateAutoscaler. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + updateAutoscalerOperationSettings() { + return ((AutoscalerStubSettings) getStubSettings()).updateAutoscalerOperationSettings(); + } + public static final AutoscalerSettings create(AutoscalerStubSettings stub) throws IOException { return new AutoscalerSettings.Builder(stub.toBuilder()).build(); } @@ -220,6 +254,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().deleteAutoscalerSettings(); } + /** Returns the builder for the settings used for calls to deleteAutoscaler. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteAutoscalerOperationSettings() { + return getStubSettingsBuilder().deleteAutoscalerOperationSettings(); + } + /** Returns the builder for the settings used for calls to getAutoscaler. */ public UnaryCallSettings.Builder getAutoscalerSettings() { return getStubSettingsBuilder().getAutoscalerSettings(); @@ -231,6 +273,14 @@ public UnaryCallSettings.Builder getAutosc return getStubSettingsBuilder().insertAutoscalerSettings(); } + /** Returns the builder for the settings used for calls to insertAutoscaler. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + insertAutoscalerOperationSettings() { + return getStubSettingsBuilder().insertAutoscalerOperationSettings(); + } + /** Returns the builder for the settings used for calls to listAutoscalers. */ public PagedCallSettings.Builder< ListAutoscalersHttpRequest, AutoscalerList, ListAutoscalersPagedResponse> @@ -244,12 +294,28 @@ public UnaryCallSettings.Builder getAutosc return getStubSettingsBuilder().patchAutoscalerSettings(); } + /** Returns the builder for the settings used for calls to patchAutoscaler. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + patchAutoscalerOperationSettings() { + return getStubSettingsBuilder().patchAutoscalerOperationSettings(); + } + /** Returns the builder for the settings used for calls to updateAutoscaler. */ public UnaryCallSettings.Builder updateAutoscalerSettings() { return getStubSettingsBuilder().updateAutoscalerSettings(); } + /** Returns the builder for the settings used for calls to updateAutoscaler. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updateAutoscalerOperationSettings() { + return getStubSettingsBuilder().updateAutoscalerOperationSettings(); + } + @Override public AutoscalerSettings build() throws IOException { return new AutoscalerSettings(this); diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketClient.java index 108449139b62..06b8a3c63179 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketClient.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketClient.java @@ -20,9 +20,12 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.EmptyMessage; +import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.BackendBucketStub; @@ -43,8 +46,7 @@ * * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) { * ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]"); - * SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build(); - * Operation response = backendBucketClient.addSignedUrlKeyBackendBucket(backendBucket, signedUrlKeyResource); + * BackendBucket response = backendBucketClient.getBackendBucket(backendBucket); * } **
Sample code: + * + *
+ * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+ * ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+ * SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
+ * AddSignedUrlKeyBackendBucketHttpRequest request = AddSignedUrlKeyBackendBucketHttpRequest.newBuilder()
+ * .setBackendBucket(backendBucket.toString())
+ * .setSignedUrlKeyResource(signedUrlKeyResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendBucketClient.addSignedUrlKeyBackendBucketOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable
* try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
* ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
- * Operation response = backendBucketClient.deleteBackendBucket(backendBucket);
+ * backendBucketClient.deleteBackendBucketAsync(backendBucket).get();
* }
*
*
* @param backendBucket Name of the BackendBucket resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteBackendBucket(ProjectGlobalBackendBucketName backendBucket) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
* ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
- * Operation response = backendBucketClient.deleteBackendBucket(backendBucket.toString());
+ * backendBucketClient.deleteBackendBucketAsync(backendBucket.toString()).get();
* }
*
*
* @param backendBucket Name of the BackendBucket resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteBackendBucket(String backendBucket) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+ * ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+ * DeleteBackendBucketHttpRequest request = DeleteBackendBucketHttpRequest.newBuilder()
+ * .setBackendBucket(backendBucket.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendBucketClient.deleteBackendBucketOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+ * ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+ * String keyName = "";
+ * DeleteSignedUrlKeyBackendBucketHttpRequest request = DeleteSignedUrlKeyBackendBucketHttpRequest.newBuilder()
+ * .setBackendBucket(backendBucket.toString())
+ * .setKeyName(keyName)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendBucketClient.deleteSignedUrlKeyBackendBucketOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable<
+ DeleteSignedUrlKeyBackendBucketHttpRequest, EmptyMessage, Operation>
+ deleteSignedUrlKeyBackendBucketOperationCallable() {
+ return stub.deleteSignedUrlKeyBackendBucketOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
@@ -472,7 +577,7 @@ public final Operation deleteSignedUrlKeyBackendBucket(
* .build();
* ApiFuture<Operation> future = backendBucketClient.deleteSignedUrlKeyBackendBucketCallable().futureCall(request);
* // Do something
- * Operation response = future.get();
+ * future.get();
* }
*
*/
@@ -595,7 +700,7 @@ public final BackendBucket getBackendBucket(GetBackendBucketHttpRequest request)
* try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
* ProjectName project = ProjectName.of("[PROJECT]");
* BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
- * Operation response = backendBucketClient.insertBackendBucket(project, backendBucketResource);
+ * backendBucketClient.insertBackendBucketAsync(project, backendBucketResource).get();
* }
*
*
@@ -604,8 +709,9 @@ public final BackendBucket getBackendBucket(GetBackendBucketHttpRequest request)
* bucket.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation insertBackendBucket(
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+ * ProjectName project = ProjectName.of("[PROJECT]");
+ * BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+ * InsertBackendBucketHttpRequest request = InsertBackendBucketHttpRequest.newBuilder()
+ * .setProject(project.toString())
+ * .setBackendBucketResource(backendBucketResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendBucketClient.insertBackendBucketOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+ * ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+ * BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * PatchBackendBucketHttpRequest request = PatchBackendBucketHttpRequest.newBuilder()
+ * .setBackendBucket(backendBucket.toString())
+ * .setBackendBucketResource(backendBucketResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendBucketClient.patchBackendBucketOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+ * ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+ * BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * UpdateBackendBucketHttpRequest request = UpdateBackendBucketHttpRequest.newBuilder()
+ * .setBackendBucket(backendBucket.toString())
+ * .setBackendBucketResource(backendBucketResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendBucketClient.updateBackendBucketOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of addSignedUrlKeyBackendBucket to 30 seconds: + * example, to set the total timeout of getBackendBucket to 30 seconds: * *
*@@ -104,6 +106,7 @@ public class BackendServiceClient implements BackgroundResource { private final BackendServiceSettings settings; private final BackendServiceStub stub; + private final GlobalOperationClient operationsClient; /** Constructs an instance of BackendServiceClient with default settings. */ public static final BackendServiceClient create() throws IOException { @@ -136,12 +139,14 @@ public static final BackendServiceClient create(BackendServiceStub stub) { protected BackendServiceClient(BackendServiceSettings settings) throws IOException { this.settings = settings; this.stub = ((BackendServiceStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected BackendServiceClient(BackendServiceStub stub) { this.settings = null; this.stub = stub; + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } public final BackendServiceSettings getSettings() { @@ -153,6 +158,16 @@ public BackendServiceStub getStub() { return stub; } + /** + * Returns the GlobalOperationClient that can be used to query the status of a long-running + * operation returned by another API method call. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final GlobalOperationClient getOperationsClient() { + return operationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Adds a key for validating requests with signed URLs for this backend service. @@ -163,7 +178,7 @@ public BackendServiceStub getStub() { * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) { * ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); * SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build(); - * Operation response = backendServiceClient.addSignedUrlKeyBackendService(backendService, signedUrlKeyResource); + * backendServiceClient.addSignedUrlKeyBackendServiceAsync(backendService, signedUrlKeyResource).get(); * } * * @@ -173,8 +188,9 @@ public BackendServiceStub getStub() { * URLs * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi - public final Operation addSignedUrlKeyBackendService( + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture* BackendBucketSettings.Builder backendBucketSettingsBuilder = * BackendBucketSettings.newBuilder(); - * backendBucketSettingsBuilder.addSignedUrlKeyBackendBucketSettings().getRetrySettings().toBuilder() + * backendBucketSettingsBuilder.getBackendBucketSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * BackendBucketSettings backendBucketSettings = backendBucketSettingsBuilder.build(); *@@ -69,12 +71,29 @@ public class BackendBucketSettings extends ClientSettingsreturn ((BackendBucketStubSettings) getStubSettings()).addSignedUrlKeyBackendBucketSettings(); } + /** Returns the object with the settings used for calls to addSignedUrlKeyBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + addSignedUrlKeyBackendBucketOperationSettings() { + return ((BackendBucketStubSettings) getStubSettings()) + .addSignedUrlKeyBackendBucketOperationSettings(); + } + /** Returns the object with the settings used for calls to deleteBackendBucket. */ public UnaryCallSettings deleteBackendBucketSettings() { return ((BackendBucketStubSettings) getStubSettings()).deleteBackendBucketSettings(); } + /** Returns the object with the settings used for calls to deleteBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + deleteBackendBucketOperationSettings() { + return ((BackendBucketStubSettings) getStubSettings()).deleteBackendBucketOperationSettings(); + } + /** Returns the object with the settings used for calls to deleteSignedUrlKeyBackendBucket. */ public UnaryCallSettings deleteSignedUrlKeyBackendBucketSettings() { @@ -82,6 +101,15 @@ public class BackendBucketSettings extends ClientSettings .deleteSignedUrlKeyBackendBucketSettings(); } + /** Returns the object with the settings used for calls to deleteSignedUrlKeyBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + deleteSignedUrlKeyBackendBucketOperationSettings() { + return ((BackendBucketStubSettings) getStubSettings()) + .deleteSignedUrlKeyBackendBucketOperationSettings(); + } + /** Returns the object with the settings used for calls to getBackendBucket. */ public UnaryCallSettings getBackendBucketSettings() { return ((BackendBucketStubSettings) getStubSettings()).getBackendBucketSettings(); @@ -93,6 +121,14 @@ public UnaryCallSettings getBackendB return ((BackendBucketStubSettings) getStubSettings()).insertBackendBucketSettings(); } + /** Returns the object with the settings used for calls to insertBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + insertBackendBucketOperationSettings() { + return ((BackendBucketStubSettings) getStubSettings()).insertBackendBucketOperationSettings(); + } + /** Returns the object with the settings used for calls to listBackendBuckets. */ public PagedCallSettings< ListBackendBucketsHttpRequest, BackendBucketList, ListBackendBucketsPagedResponse> @@ -105,12 +141,28 @@ public UnaryCallSettings patchBackendB return ((BackendBucketStubSettings) getStubSettings()).patchBackendBucketSettings(); } + /** Returns the object with the settings used for calls to patchBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + patchBackendBucketOperationSettings() { + return ((BackendBucketStubSettings) getStubSettings()).patchBackendBucketOperationSettings(); + } + /** Returns the object with the settings used for calls to updateBackendBucket. */ public UnaryCallSettings updateBackendBucketSettings() { return ((BackendBucketStubSettings) getStubSettings()).updateBackendBucketSettings(); } + /** Returns the object with the settings used for calls to updateBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + updateBackendBucketOperationSettings() { + return ((BackendBucketStubSettings) getStubSettings()).updateBackendBucketOperationSettings(); + } + public static final BackendBucketSettings create(BackendBucketStubSettings stub) throws IOException { return new BackendBucketSettings.Builder(stub.toBuilder()).build(); @@ -219,18 +271,44 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().addSignedUrlKeyBackendBucketSettings(); } + /** Returns the builder for the settings used for calls to addSignedUrlKeyBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + AddSignedUrlKeyBackendBucketHttpRequest, EmptyMessage, Operation> + addSignedUrlKeyBackendBucketOperationSettings() { + return getStubSettingsBuilder().addSignedUrlKeyBackendBucketOperationSettings(); + } + /** Returns the builder for the settings used for calls to deleteBackendBucket. */ public UnaryCallSettings.Builder deleteBackendBucketSettings() { return getStubSettingsBuilder().deleteBackendBucketSettings(); } + /** Returns the builder for the settings used for calls to deleteBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteBackendBucketOperationSettings() { + return getStubSettingsBuilder().deleteBackendBucketOperationSettings(); + } + /** Returns the builder for the settings used for calls to deleteSignedUrlKeyBackendBucket. */ public UnaryCallSettings.Builder deleteSignedUrlKeyBackendBucketSettings() { return getStubSettingsBuilder().deleteSignedUrlKeyBackendBucketSettings(); } + /** Returns the builder for the settings used for calls to deleteSignedUrlKeyBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + DeleteSignedUrlKeyBackendBucketHttpRequest, EmptyMessage, Operation> + deleteSignedUrlKeyBackendBucketOperationSettings() { + return getStubSettingsBuilder().deleteSignedUrlKeyBackendBucketOperationSettings(); + } + /** Returns the builder for the settings used for calls to getBackendBucket. */ public UnaryCallSettings.Builder getBackendBucketSettings() { @@ -243,6 +321,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().insertBackendBucketSettings(); } + /** Returns the builder for the settings used for calls to insertBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + insertBackendBucketOperationSettings() { + return getStubSettingsBuilder().insertBackendBucketOperationSettings(); + } + /** Returns the builder for the settings used for calls to listBackendBuckets. */ public PagedCallSettings.Builder< ListBackendBucketsHttpRequest, BackendBucketList, ListBackendBucketsPagedResponse> @@ -256,12 +342,28 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().patchBackendBucketSettings(); } + /** Returns the builder for the settings used for calls to patchBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + patchBackendBucketOperationSettings() { + return getStubSettingsBuilder().patchBackendBucketOperationSettings(); + } + /** Returns the builder for the settings used for calls to updateBackendBucket. */ public UnaryCallSettings.Builder updateBackendBucketSettings() { return getStubSettingsBuilder().updateBackendBucketSettings(); } + /** Returns the builder for the settings used for calls to updateBackendBucket. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updateBackendBucketOperationSettings() { + return getStubSettingsBuilder().updateBackendBucketOperationSettings(); + } + @Override public BackendBucketSettings build() throws IOException { return new BackendBucketSettings(this); diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceClient.java index 04290a2a09cd..8a3742c98662 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceClient.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceClient.java @@ -20,9 +20,12 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.EmptyMessage; +import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.BackendServiceStub; @@ -43,8 +46,7 @@ * * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) { * ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); - * SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build(); - * Operation response = backendServiceClient.addSignedUrlKeyBackendService(backendService, signedUrlKeyResource); + * BackendService response = backendServiceClient.getBackendService(backendService); * } **
Sample code: + * + *
+ * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+ * ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+ * SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
+ * AddSignedUrlKeyBackendServiceHttpRequest request = AddSignedUrlKeyBackendServiceHttpRequest.newBuilder()
+ * .setBackendService(backendService.toString())
+ * .setSignedUrlKeyResource(signedUrlKeyResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendServiceClient.addSignedUrlKeyBackendServiceOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable
* try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
* ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
- * Operation response = backendServiceClient.deleteBackendService(backendService);
+ * backendServiceClient.deleteBackendServiceAsync(backendService).get();
* }
*
*
* @param backendService Name of the BackendService resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteBackendService(ProjectGlobalBackendServiceName backendService) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
* ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
- * Operation response = backendServiceClient.deleteBackendService(backendService.toString());
+ * backendServiceClient.deleteBackendServiceAsync(backendService.toString()).get();
* }
*
*
* @param backendService Name of the BackendService resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteBackendService(String backendService) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+ * ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+ * DeleteBackendServiceHttpRequest request = DeleteBackendServiceHttpRequest.newBuilder()
+ * .setBackendService(backendService.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendServiceClient.deleteBackendServiceOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+ * ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+ * String keyName = "";
+ * DeleteSignedUrlKeyBackendServiceHttpRequest request = DeleteSignedUrlKeyBackendServiceHttpRequest.newBuilder()
+ * .setBackendService(backendService.toString())
+ * .setKeyName(keyName)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendServiceClient.deleteSignedUrlKeyBackendServiceOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable<
+ DeleteSignedUrlKeyBackendServiceHttpRequest, EmptyMessage, Operation>
+ deleteSignedUrlKeyBackendServiceOperationCallable() {
+ return stub.deleteSignedUrlKeyBackendServiceOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
@@ -618,7 +723,7 @@ public final Operation deleteSignedUrlKeyBackendService(
* .build();
* ApiFuture<Operation> future = backendServiceClient.deleteSignedUrlKeyBackendServiceCallable().futureCall(request);
* // Do something
- * Operation response = future.get();
+ * future.get();
* }
*
*/
@@ -854,7 +959,7 @@ public final BackendServiceGroupHealth getHealthBackendService(
* try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
* ProjectName project = ProjectName.of("[PROJECT]");
* BackendService backendServiceResource = BackendService.newBuilder().build();
- * Operation response = backendServiceClient.insertBackendService(project, backendServiceResource);
+ * backendServiceClient.insertBackendServiceAsync(project, backendServiceResource).get();
* }
*
*
@@ -864,8 +969,9 @@ public final BackendServiceGroupHealth getHealthBackendService(
* (== resource_for beta.backendService ==)
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation insertBackendService(
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+ * ProjectName project = ProjectName.of("[PROJECT]");
+ * BackendService backendServiceResource = BackendService.newBuilder().build();
+ * InsertBackendServiceHttpRequest request = InsertBackendServiceHttpRequest.newBuilder()
+ * .setProject(project.toString())
+ * .setBackendServiceResource(backendServiceResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendServiceClient.insertBackendServiceOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+ * ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+ * BackendService backendServiceResource = BackendService.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * PatchBackendServiceHttpRequest request = PatchBackendServiceHttpRequest.newBuilder()
+ * .setBackendService(backendService.toString())
+ * .setBackendServiceResource(backendServiceResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendServiceClient.patchBackendServiceOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+ * ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+ * SecurityPolicyReference securityPolicyReferenceResource = SecurityPolicyReference.newBuilder().build();
+ * SetSecurityPolicyBackendServiceHttpRequest request = SetSecurityPolicyBackendServiceHttpRequest.newBuilder()
+ * .setBackendService(backendService.toString())
+ * .setSecurityPolicyReferenceResource(securityPolicyReferenceResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendServiceClient.setSecurityPolicyBackendServiceOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable<
+ SetSecurityPolicyBackendServiceHttpRequest, EmptyMessage, Operation>
+ setSecurityPolicyBackendServiceOperationCallable() {
+ return stub.setSecurityPolicyBackendServiceOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
@@ -1356,7 +1558,7 @@ public final Operation setSecurityPolicyBackendService(
* .build();
* ApiFuture<Operation> future = backendServiceClient.setSecurityPolicyBackendServiceCallable().futureCall(request);
* // Do something
- * Operation response = future.get();
+ * future.get();
* }
*
*/
@@ -1379,7 +1581,7 @@ public final Operation setSecurityPolicyBackendService(
* ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
* BackendService backendServiceResource = BackendService.newBuilder().build();
* List<String> fieldMask = new ArrayList<>();
- * Operation response = backendServiceClient.updateBackendService(backendService, backendServiceResource, fieldMask);
+ * backendServiceClient.updateBackendServiceAsync(backendService, backendServiceResource, fieldMask).get();
* }
*
*
@@ -1393,8 +1595,9 @@ public final Operation setSecurityPolicyBackendService(
* not have a fieldmask, then only non-empty fields will be serialized.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation updateBackendService(
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+ * ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+ * BackendService backendServiceResource = BackendService.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * UpdateBackendServiceHttpRequest request = UpdateBackendServiceHttpRequest.newBuilder()
+ * .setBackendService(backendService.toString())
+ * .setBackendServiceResource(backendServiceResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = backendServiceClient.updateBackendServiceOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of addSignedUrlKeyBackendService to 30 seconds: + * example, to set the total timeout of getBackendService to 30 seconds: * *
*@@ -105,6 +106,7 @@ public class DiskClient implements BackgroundResource { private final DiskSettings settings; private final DiskStub stub; + private final ZoneOperationClient operationsClient; /** Constructs an instance of DiskClient with default settings. */ public static final DiskClient create() throws IOException { @@ -135,12 +137,14 @@ public static final DiskClient create(DiskStub stub) { protected DiskClient(DiskSettings settings) throws IOException { this.settings = settings; this.stub = ((DiskStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = ZoneOperationClient.create(this.stub.getOperationsStub()); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected DiskClient(DiskStub stub) { this.settings = null; this.stub = stub; + this.operationsClient = ZoneOperationClient.create(this.stub.getOperationsStub()); } public final DiskSettings getSettings() { @@ -152,6 +156,16 @@ public DiskStub getStub() { return stub; } + /** + * Returns the ZoneOperationClient that can be used to query the status of a long-running + * operation returned by another API method call. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final ZoneOperationClient getOperationsClient() { + return operationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Retrieves an aggregated list of persistent disks. @@ -301,7 +315,7 @@ public final AggregatedListDisksPagedResponse aggregatedListDisks( * ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]"); * Boolean guestFlush = false; * Snapshot snapshotResource = Snapshot.newBuilder().build(); - * Operation response = diskClient.createSnapshotDisk(disk, guestFlush, snapshotResource); + * diskClient.createSnapshotDiskAsync(disk, guestFlush, snapshotResource).get(); * } * * @@ -311,8 +325,9 @@ public final AggregatedListDisksPagedResponse aggregatedListDisks( * ==) (== resource_for v1.snapshots ==) * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi - public final Operation createSnapshotDisk( + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture* BackendServiceSettings.Builder backendServiceSettingsBuilder = * BackendServiceSettings.newBuilder(); - * backendServiceSettingsBuilder.addSignedUrlKeyBackendServiceSettings().getRetrySettings().toBuilder() + * backendServiceSettingsBuilder.getBackendServiceSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * BackendServiceSettings backendServiceSettings = backendServiceSettingsBuilder.build(); *@@ -70,6 +72,15 @@ public class BackendServiceSettings extends ClientSettings+ addSignedUrlKeyBackendServiceOperationSettings() { + return ((BackendServiceStubSettings) getStubSettings()) + .addSignedUrlKeyBackendServiceOperationSettings(); + } + /** Returns the object with the settings used for calls to aggregatedListBackendServices. */ public PagedCallSettings< AggregatedListBackendServicesHttpRequest, @@ -85,6 +96,14 @@ public class BackendServiceSettings extends ClientSettings + deleteBackendServiceOperationSettings() { + return ((BackendServiceStubSettings) getStubSettings()).deleteBackendServiceOperationSettings(); + } + /** Returns the object with the settings used for calls to deleteSignedUrlKeyBackendService. */ public UnaryCallSettings deleteSignedUrlKeyBackendServiceSettings() { @@ -92,6 +111,15 @@ public class BackendServiceSettings extends ClientSettings + deleteSignedUrlKeyBackendServiceOperationSettings() { + return ((BackendServiceStubSettings) getStubSettings()) + .deleteSignedUrlKeyBackendServiceOperationSettings(); + } + /** Returns the object with the settings used for calls to getBackendService. */ public UnaryCallSettings getBackendServiceSettings() { @@ -110,6 +138,14 @@ public class BackendServiceSettings extends ClientSettings + insertBackendServiceOperationSettings() { + return ((BackendServiceStubSettings) getStubSettings()).insertBackendServiceOperationSettings(); + } + /** Returns the object with the settings used for calls to listBackendServices. */ public PagedCallSettings< ListBackendServicesHttpRequest, BackendServiceList, ListBackendServicesPagedResponse> @@ -123,6 +159,14 @@ public class BackendServiceSettings extends ClientSettings + patchBackendServiceOperationSettings() { + return ((BackendServiceStubSettings) getStubSettings()).patchBackendServiceOperationSettings(); + } + /** Returns the object with the settings used for calls to setSecurityPolicyBackendService. */ public UnaryCallSettings setSecurityPolicyBackendServiceSettings() { @@ -130,12 +174,29 @@ public class BackendServiceSettings extends ClientSettings + setSecurityPolicyBackendServiceOperationSettings() { + return ((BackendServiceStubSettings) getStubSettings()) + .setSecurityPolicyBackendServiceOperationSettings(); + } + /** Returns the object with the settings used for calls to updateBackendService. */ public UnaryCallSettings updateBackendServiceSettings() { return ((BackendServiceStubSettings) getStubSettings()).updateBackendServiceSettings(); } + /** Returns the object with the settings used for calls to updateBackendService. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + updateBackendServiceOperationSettings() { + return ((BackendServiceStubSettings) getStubSettings()).updateBackendServiceOperationSettings(); + } + public static final BackendServiceSettings create(BackendServiceStubSettings stub) throws IOException { return new BackendServiceSettings.Builder(stub.toBuilder()).build(); @@ -244,6 +305,15 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().addSignedUrlKeyBackendServiceSettings(); } + /** Returns the builder for the settings used for calls to addSignedUrlKeyBackendService. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + AddSignedUrlKeyBackendServiceHttpRequest, EmptyMessage, Operation> + addSignedUrlKeyBackendServiceOperationSettings() { + return getStubSettingsBuilder().addSignedUrlKeyBackendServiceOperationSettings(); + } + /** Returns the builder for the settings used for calls to aggregatedListBackendServices. */ public PagedCallSettings.Builder< AggregatedListBackendServicesHttpRequest, @@ -259,12 +329,29 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().deleteBackendServiceSettings(); } + /** Returns the builder for the settings used for calls to deleteBackendService. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteBackendServiceOperationSettings() { + return getStubSettingsBuilder().deleteBackendServiceOperationSettings(); + } + /** Returns the builder for the settings used for calls to deleteSignedUrlKeyBackendService. */ public UnaryCallSettings.Builder deleteSignedUrlKeyBackendServiceSettings() { return getStubSettingsBuilder().deleteSignedUrlKeyBackendServiceSettings(); } + /** Returns the builder for the settings used for calls to deleteSignedUrlKeyBackendService. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + DeleteSignedUrlKeyBackendServiceHttpRequest, EmptyMessage, Operation> + deleteSignedUrlKeyBackendServiceOperationSettings() { + return getStubSettingsBuilder().deleteSignedUrlKeyBackendServiceOperationSettings(); + } + /** Returns the builder for the settings used for calls to getBackendService. */ public UnaryCallSettings.Builder getBackendServiceSettings() { @@ -283,6 +370,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().insertBackendServiceSettings(); } + /** Returns the builder for the settings used for calls to insertBackendService. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + insertBackendServiceOperationSettings() { + return getStubSettingsBuilder().insertBackendServiceOperationSettings(); + } + /** Returns the builder for the settings used for calls to listBackendServices. */ public PagedCallSettings.Builder< ListBackendServicesHttpRequest, BackendServiceList, ListBackendServicesPagedResponse> @@ -296,18 +391,43 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().patchBackendServiceSettings(); } + /** Returns the builder for the settings used for calls to patchBackendService. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + patchBackendServiceOperationSettings() { + return getStubSettingsBuilder().patchBackendServiceOperationSettings(); + } + /** Returns the builder for the settings used for calls to setSecurityPolicyBackendService. */ public UnaryCallSettings.Builder setSecurityPolicyBackendServiceSettings() { return getStubSettingsBuilder().setSecurityPolicyBackendServiceSettings(); } + /** Returns the builder for the settings used for calls to setSecurityPolicyBackendService. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + SetSecurityPolicyBackendServiceHttpRequest, EmptyMessage, Operation> + setSecurityPolicyBackendServiceOperationSettings() { + return getStubSettingsBuilder().setSecurityPolicyBackendServiceOperationSettings(); + } + /** Returns the builder for the settings used for calls to updateBackendService. */ public UnaryCallSettings.Builder updateBackendServiceSettings() { return getStubSettingsBuilder().updateBackendServiceSettings(); } + /** Returns the builder for the settings used for calls to updateBackendService. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updateBackendServiceOperationSettings() { + return getStubSettingsBuilder().updateBackendServiceOperationSettings(); + } + @Override public BackendServiceSettings build() throws IOException { return new BackendServiceSettings(this); diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java index acad92e6aea4..de966bdc2323 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java @@ -20,9 +20,12 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.EmptyMessage; +import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.DiskStub; @@ -43,9 +46,7 @@ * * try (DiskClient diskClient = DiskClient.create()) { * ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]"); - * Boolean guestFlush = false; - * Snapshot snapshotResource = Snapshot.newBuilder().build(); - * Operation response = diskClient.createSnapshotDisk(disk, guestFlush, snapshotResource); + * Disk response = diskClient.getDisk(disk); * } **
Sample code: + * + *
+ * try (DiskClient diskClient = DiskClient.create()) {
+ * ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+ * Boolean guestFlush = false;
+ * Snapshot snapshotResource = Snapshot.newBuilder().build();
+ * CreateSnapshotDiskHttpRequest request = CreateSnapshotDiskHttpRequest.newBuilder()
+ * .setDisk(disk.toString())
+ * .setGuestFlush(guestFlush)
+ * .setSnapshotResource(snapshotResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = diskClient.createSnapshotDiskOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable
* try (DiskClient diskClient = DiskClient.create()) {
* ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
- * Operation response = diskClient.deleteDisk(disk);
+ * diskClient.deleteDiskAsync(disk).get();
* }
*
*
* @param disk Name of the persistent disk to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteDisk(ProjectZoneDiskName disk) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (DiskClient diskClient = DiskClient.create()) {
* ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
- * Operation response = diskClient.deleteDisk(disk.toString());
+ * diskClient.deleteDiskAsync(disk.toString()).get();
* }
*
*
* @param disk Name of the persistent disk to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteDisk(String disk) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (DiskClient diskClient = DiskClient.create()) {
+ * ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+ * DeleteDiskHttpRequest request = DeleteDiskHttpRequest.newBuilder()
+ * .setDisk(disk.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = diskClient.deleteDiskOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (DiskClient diskClient = DiskClient.create()) {
+ * ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+ * Disk diskResource = Disk.newBuilder().build();
+ * InsertDiskHttpRequest request = InsertDiskHttpRequest.newBuilder()
+ * .setZone(zone.toString())
+ * .setDiskResource(diskResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = diskClient.insertDiskOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (DiskClient diskClient = DiskClient.create()) {
+ * ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+ * DisksResizeRequest disksResizeRequestResource = DisksResizeRequest.newBuilder().build();
+ * ResizeDiskHttpRequest request = ResizeDiskHttpRequest.newBuilder()
+ * .setDisk(disk.toString())
+ * .setDisksResizeRequestResource(disksResizeRequestResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = diskClient.resizeDiskOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (DiskClient diskClient = DiskClient.create()) {
+ * ProjectZoneDiskResourceName resource = ProjectZoneDiskResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
+ * ZoneSetLabelsRequest zoneSetLabelsRequestResource = ZoneSetLabelsRequest.newBuilder().build();
+ * SetLabelsDiskHttpRequest request = SetLabelsDiskHttpRequest.newBuilder()
+ * .setResource(resource.toString())
+ * .setZoneSetLabelsRequestResource(zoneSetLabelsRequestResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = diskClient.setLabelsDiskOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of createSnapshotDisk to 30 seconds: + * example, to set the total timeout of getDisk to 30 seconds: * *
*@@ -103,6 +106,7 @@ public class FirewallClient implements BackgroundResource { private final FirewallSettings settings; private final FirewallStub stub; + private final GlobalOperationClient operationsClient; /** Constructs an instance of FirewallClient with default settings. */ public static final FirewallClient create() throws IOException { @@ -133,12 +137,14 @@ public static final FirewallClient create(FirewallStub stub) { protected FirewallClient(FirewallSettings settings) throws IOException { this.settings = settings; this.stub = ((FirewallStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected FirewallClient(FirewallStub stub) { this.settings = null; this.stub = stub; + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } public final FirewallSettings getSettings() { @@ -150,6 +156,16 @@ public FirewallStub getStub() { return stub; } + /** + * Returns the GlobalOperationClient that can be used to query the status of a long-running + * operation returned by another API method call. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final GlobalOperationClient getOperationsClient() { + return operationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes the specified firewall. @@ -159,21 +175,23 @@ public FirewallStub getStub() { ** DiskSettings.Builder diskSettingsBuilder = * DiskSettings.newBuilder(); - * diskSettingsBuilder.createSnapshotDiskSettings().getRetrySettings().toBuilder() + * diskSettingsBuilder.getDiskSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * DiskSettings diskSettings = diskSettingsBuilder.build(); *@@ -76,11 +78,27 @@ public UnaryCallSettingscreateSnapsho return ((DiskStubSettings) getStubSettings()).createSnapshotDiskSettings(); } + /** Returns the object with the settings used for calls to createSnapshotDisk. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + createSnapshotDiskOperationSettings() { + return ((DiskStubSettings) getStubSettings()).createSnapshotDiskOperationSettings(); + } + /** Returns the object with the settings used for calls to deleteDisk. */ public UnaryCallSettings deleteDiskSettings() { return ((DiskStubSettings) getStubSettings()).deleteDiskSettings(); } + /** Returns the object with the settings used for calls to deleteDisk. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + deleteDiskOperationSettings() { + return ((DiskStubSettings) getStubSettings()).deleteDiskOperationSettings(); + } + /** Returns the object with the settings used for calls to getDisk. */ public UnaryCallSettings getDiskSettings() { return ((DiskStubSettings) getStubSettings()).getDiskSettings(); @@ -96,6 +114,14 @@ public UnaryCallSettings insertDiskSettings() return ((DiskStubSettings) getStubSettings()).insertDiskSettings(); } + /** Returns the object with the settings used for calls to insertDisk. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + insertDiskOperationSettings() { + return ((DiskStubSettings) getStubSettings()).insertDiskOperationSettings(); + } + /** Returns the object with the settings used for calls to listDisks. */ public PagedCallSettings listDisksSettings() { @@ -107,6 +133,14 @@ public UnaryCallSettings resizeDiskSettings() return ((DiskStubSettings) getStubSettings()).resizeDiskSettings(); } + /** Returns the object with the settings used for calls to resizeDisk. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + resizeDiskOperationSettings() { + return ((DiskStubSettings) getStubSettings()).resizeDiskOperationSettings(); + } + /** Returns the object with the settings used for calls to setIamPolicyDisk. */ public UnaryCallSettings setIamPolicyDiskSettings() { return ((DiskStubSettings) getStubSettings()).setIamPolicyDiskSettings(); @@ -117,6 +151,14 @@ public UnaryCallSettings setLabelsDiskSetti return ((DiskStubSettings) getStubSettings()).setLabelsDiskSettings(); } + /** Returns the object with the settings used for calls to setLabelsDisk. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + setLabelsDiskOperationSettings() { + return ((DiskStubSettings) getStubSettings()).setLabelsDiskOperationSettings(); + } + /** Returns the object with the settings used for calls to testIamPermissionsDisk. */ public UnaryCallSettings testIamPermissionsDiskSettings() { @@ -237,11 +279,27 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().createSnapshotDiskSettings(); } + /** Returns the builder for the settings used for calls to createSnapshotDisk. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + createSnapshotDiskOperationSettings() { + return getStubSettingsBuilder().createSnapshotDiskOperationSettings(); + } + /** Returns the builder for the settings used for calls to deleteDisk. */ public UnaryCallSettings.Builder deleteDiskSettings() { return getStubSettingsBuilder().deleteDiskSettings(); } + /** Returns the builder for the settings used for calls to deleteDisk. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteDiskOperationSettings() { + return getStubSettingsBuilder().deleteDiskOperationSettings(); + } + /** Returns the builder for the settings used for calls to getDisk. */ public UnaryCallSettings.Builder getDiskSettings() { return getStubSettingsBuilder().getDiskSettings(); @@ -258,6 +316,14 @@ public UnaryCallSettings.Builder insertDiskSet return getStubSettingsBuilder().insertDiskSettings(); } + /** Returns the builder for the settings used for calls to insertDisk. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + insertDiskOperationSettings() { + return getStubSettingsBuilder().insertDiskOperationSettings(); + } + /** Returns the builder for the settings used for calls to listDisks. */ public PagedCallSettings.Builder listDisksSettings() { @@ -269,6 +335,14 @@ public UnaryCallSettings.Builder resizeDiskSet return getStubSettingsBuilder().resizeDiskSettings(); } + /** Returns the builder for the settings used for calls to resizeDisk. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + resizeDiskOperationSettings() { + return getStubSettingsBuilder().resizeDiskOperationSettings(); + } + /** Returns the builder for the settings used for calls to setIamPolicyDisk. */ public UnaryCallSettings.Builder setIamPolicyDiskSettings() { @@ -280,6 +354,14 @@ public UnaryCallSettings.Builder setLabelsD return getStubSettingsBuilder().setLabelsDiskSettings(); } + /** Returns the builder for the settings used for calls to setLabelsDisk. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + setLabelsDiskOperationSettings() { + return getStubSettingsBuilder().setLabelsDiskOperationSettings(); + } + /** Returns the builder for the settings used for calls to testIamPermissionsDisk. */ public UnaryCallSettings.Builder testIamPermissionsDiskSettings() { diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java index 6bc1ca517763..f63c55a87760 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java @@ -20,9 +20,12 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.EmptyMessage; +import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.FirewallStub; @@ -43,7 +46,7 @@ * * try (FirewallClient firewallClient = FirewallClient.create()) { * ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]"); - * Operation response = firewallClient.deleteFirewall(firewall); + * Firewall response = firewallClient.getFirewall(firewall); * } **
* try (FirewallClient firewallClient = FirewallClient.create()) {
* ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
- * Operation response = firewallClient.deleteFirewall(firewall);
+ * firewallClient.deleteFirewallAsync(firewall).get();
* }
*
*
* @param firewall Name of the firewall rule to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteFirewall(ProjectGlobalFirewallName firewall) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (FirewallClient firewallClient = FirewallClient.create()) {
* ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
- * Operation response = firewallClient.deleteFirewall(firewall.toString());
+ * firewallClient.deleteFirewallAsync(firewall.toString()).get();
* }
*
*
* @param firewall Name of the firewall rule to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteFirewall(String firewall) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (FirewallClient firewallClient = FirewallClient.create()) {
+ * ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+ * DeleteFirewallHttpRequest request = DeleteFirewallHttpRequest.newBuilder()
+ * .setFirewall(firewall.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = firewallClient.deleteFirewallOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (FirewallClient firewallClient = FirewallClient.create()) {
+ * ProjectName project = ProjectName.of("[PROJECT]");
+ * Firewall firewallResource = Firewall.newBuilder().build();
+ * InsertFirewallHttpRequest request = InsertFirewallHttpRequest.newBuilder()
+ * .setProject(project.toString())
+ * .setFirewallResource(firewallResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = firewallClient.insertFirewallOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (FirewallClient firewallClient = FirewallClient.create()) {
+ * ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+ * Firewall firewallResource = Firewall.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * PatchFirewallHttpRequest request = PatchFirewallHttpRequest.newBuilder()
+ * .setFirewall(firewall.toString())
+ * .setFirewallResource(firewallResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = firewallClient.patchFirewallOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (FirewallClient firewallClient = FirewallClient.create()) {
+ * ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+ * Firewall firewallResource = Firewall.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * UpdateFirewallHttpRequest request = UpdateFirewallHttpRequest.newBuilder()
+ * .setFirewall(firewall.toString())
+ * .setFirewallResource(firewallResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = firewallClient.updateFirewallOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of deleteFirewall to 30 seconds: + * example, to set the total timeout of getFirewall to 30 seconds: * *
*@@ -103,6 +106,7 @@ public class ForwardingRuleClient implements BackgroundResource { private final ForwardingRuleSettings settings; private final ForwardingRuleStub stub; + private final RegionOperationClient operationsClient; /** Constructs an instance of ForwardingRuleClient with default settings. */ public static final ForwardingRuleClient create() throws IOException { @@ -135,12 +139,14 @@ public static final ForwardingRuleClient create(ForwardingRuleStub stub) { protected ForwardingRuleClient(ForwardingRuleSettings settings) throws IOException { this.settings = settings; this.stub = ((ForwardingRuleStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = RegionOperationClient.create(this.stub.getOperationsStub()); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected ForwardingRuleClient(ForwardingRuleStub stub) { this.settings = null; this.stub = stub; + this.operationsClient = RegionOperationClient.create(this.stub.getOperationsStub()); } public final ForwardingRuleSettings getSettings() { @@ -152,6 +158,16 @@ public ForwardingRuleStub getStub() { return stub; } + /** + * Returns the RegionOperationClient that can be used to query the status of a long-running + * operation returned by another API method call. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final RegionOperationClient getOperationsClient() { + return operationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Retrieves an aggregated list of forwarding rules. @@ -302,21 +318,23 @@ public final AggregatedListForwardingRulesPagedResponse aggregatedListForwarding ** FirewallSettings.Builder firewallSettingsBuilder = * FirewallSettings.newBuilder(); - * firewallSettingsBuilder.deleteFirewallSettings().getRetrySettings().toBuilder() + * firewallSettingsBuilder.getFirewallSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * FirewallSettings firewallSettings = firewallSettingsBuilder.build(); *@@ -68,6 +70,14 @@ public UnaryCallSettingsdeleteFirewallSet return ((FirewallStubSettings) getStubSettings()).deleteFirewallSettings(); } + /** Returns the object with the settings used for calls to deleteFirewall. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + deleteFirewallOperationSettings() { + return ((FirewallStubSettings) getStubSettings()).deleteFirewallOperationSettings(); + } + /** Returns the object with the settings used for calls to getFirewall. */ public UnaryCallSettings getFirewallSettings() { return ((FirewallStubSettings) getStubSettings()).getFirewallSettings(); @@ -78,6 +88,14 @@ public UnaryCallSettings insertFirewallSet return ((FirewallStubSettings) getStubSettings()).insertFirewallSettings(); } + /** Returns the object with the settings used for calls to insertFirewall. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + insertFirewallOperationSettings() { + return ((FirewallStubSettings) getStubSettings()).insertFirewallOperationSettings(); + } + /** Returns the object with the settings used for calls to listFirewalls. */ public PagedCallSettings listFirewallsSettings() { @@ -89,11 +107,27 @@ public UnaryCallSettings patchFirewallSetti return ((FirewallStubSettings) getStubSettings()).patchFirewallSettings(); } + /** Returns the object with the settings used for calls to patchFirewall. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + patchFirewallOperationSettings() { + return ((FirewallStubSettings) getStubSettings()).patchFirewallOperationSettings(); + } + /** Returns the object with the settings used for calls to updateFirewall. */ public UnaryCallSettings updateFirewallSettings() { return ((FirewallStubSettings) getStubSettings()).updateFirewallSettings(); } + /** Returns the object with the settings used for calls to updateFirewall. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + updateFirewallOperationSettings() { + return ((FirewallStubSettings) getStubSettings()).updateFirewallOperationSettings(); + } + public static final FirewallSettings create(FirewallStubSettings stub) throws IOException { return new FirewallSettings.Builder(stub.toBuilder()).build(); } @@ -201,6 +235,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().deleteFirewallSettings(); } + /** Returns the builder for the settings used for calls to deleteFirewall. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteFirewallOperationSettings() { + return getStubSettingsBuilder().deleteFirewallOperationSettings(); + } + /** Returns the builder for the settings used for calls to getFirewall. */ public UnaryCallSettings.Builder getFirewallSettings() { return getStubSettingsBuilder().getFirewallSettings(); @@ -212,6 +254,14 @@ public UnaryCallSettings.Builder getFirewallSe return getStubSettingsBuilder().insertFirewallSettings(); } + /** Returns the builder for the settings used for calls to insertFirewall. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + insertFirewallOperationSettings() { + return getStubSettingsBuilder().insertFirewallOperationSettings(); + } + /** Returns the builder for the settings used for calls to listFirewalls. */ public PagedCallSettings.Builder< ListFirewallsHttpRequest, FirewallList, ListFirewallsPagedResponse> @@ -224,12 +274,28 @@ public UnaryCallSettings.Builder patchFirew return getStubSettingsBuilder().patchFirewallSettings(); } + /** Returns the builder for the settings used for calls to patchFirewall. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + patchFirewallOperationSettings() { + return getStubSettingsBuilder().patchFirewallOperationSettings(); + } + /** Returns the builder for the settings used for calls to updateFirewall. */ public UnaryCallSettings.Builder updateFirewallSettings() { return getStubSettingsBuilder().updateFirewallSettings(); } + /** Returns the builder for the settings used for calls to updateFirewall. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updateFirewallOperationSettings() { + return getStubSettingsBuilder().updateFirewallOperationSettings(); + } + @Override public FirewallSettings build() throws IOException { return new FirewallSettings(this); diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleClient.java index ba45653bc3ea..18ff46d57b03 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleClient.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleClient.java @@ -20,9 +20,12 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.EmptyMessage; +import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.ForwardingRuleStub; @@ -43,7 +46,7 @@ * * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) { * ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]"); - * Operation response = forwardingRuleClient.deleteForwardingRule(forwardingRule); + * ForwardingRule response = forwardingRuleClient.getForwardingRule(forwardingRule); * } **
* try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
* ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
- * Operation response = forwardingRuleClient.deleteForwardingRule(forwardingRule);
+ * forwardingRuleClient.deleteForwardingRuleAsync(forwardingRule).get();
* }
*
*
* @param forwardingRule Name of the ForwardingRule resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteForwardingRule(ProjectRegionForwardingRuleName forwardingRule) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
* ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
- * Operation response = forwardingRuleClient.deleteForwardingRule(forwardingRule.toString());
+ * forwardingRuleClient.deleteForwardingRuleAsync(forwardingRule.toString()).get();
* }
*
*
* @param forwardingRule Name of the ForwardingRule resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteForwardingRule(String forwardingRule) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+ * ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+ * DeleteForwardingRuleHttpRequest request = DeleteForwardingRuleHttpRequest.newBuilder()
+ * .setForwardingRule(forwardingRule.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = forwardingRuleClient.deleteForwardingRuleOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+ * ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+ * ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
+ * InsertForwardingRuleHttpRequest request = InsertForwardingRuleHttpRequest.newBuilder()
+ * .setRegion(region.toString())
+ * .setForwardingRuleResource(forwardingRuleResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = forwardingRuleClient.insertForwardingRuleOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+ * ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+ * TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+ * SetTargetForwardingRuleHttpRequest request = SetTargetForwardingRuleHttpRequest.newBuilder()
+ * .setForwardingRule(forwardingRule.toString())
+ * .setTargetReferenceResource(targetReferenceResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = forwardingRuleClient.setTargetForwardingRuleOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of deleteForwardingRule to 30 seconds: + * example, to set the total timeout of getForwardingRule to 30 seconds: * *
*@@ -103,6 +106,7 @@ public class GlobalAddressClient implements BackgroundResource { private final GlobalAddressSettings settings; private final GlobalAddressStub stub; + private final GlobalOperationClient operationsClient; /** Constructs an instance of GlobalAddressClient with default settings. */ public static final GlobalAddressClient create() throws IOException { @@ -135,12 +139,14 @@ public static final GlobalAddressClient create(GlobalAddressStub stub) { protected GlobalAddressClient(GlobalAddressSettings settings) throws IOException { this.settings = settings; this.stub = ((GlobalAddressStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected GlobalAddressClient(GlobalAddressStub stub) { this.settings = null; this.stub = stub; + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } public final GlobalAddressSettings getSettings() { @@ -152,6 +158,16 @@ public GlobalAddressStub getStub() { return stub; } + /** + * Returns the GlobalOperationClient that can be used to query the status of a long-running + * operation returned by another API method call. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final GlobalOperationClient getOperationsClient() { + return operationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes the specified address resource. @@ -161,21 +177,23 @@ public GlobalAddressStub getStub() { ** ForwardingRuleSettings.Builder forwardingRuleSettingsBuilder = * ForwardingRuleSettings.newBuilder(); - * forwardingRuleSettingsBuilder.deleteForwardingRuleSettings().getRetrySettings().toBuilder() + * forwardingRuleSettingsBuilder.getForwardingRuleSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * ForwardingRuleSettings forwardingRuleSettings = forwardingRuleSettingsBuilder.build(); *@@ -79,6 +81,14 @@ public class ForwardingRuleSettings extends ClientSettings+ deleteForwardingRuleOperationSettings() { + return ((ForwardingRuleStubSettings) getStubSettings()).deleteForwardingRuleOperationSettings(); + } + /** Returns the object with the settings used for calls to getForwardingRule. */ public UnaryCallSettings getForwardingRuleSettings() { @@ -91,6 +101,14 @@ public class ForwardingRuleSettings extends ClientSettings + insertForwardingRuleOperationSettings() { + return ((ForwardingRuleStubSettings) getStubSettings()).insertForwardingRuleOperationSettings(); + } + /** Returns the object with the settings used for calls to listForwardingRules. */ public PagedCallSettings< ListForwardingRulesHttpRequest, ForwardingRuleList, ListForwardingRulesPagedResponse> @@ -104,6 +122,15 @@ public class ForwardingRuleSettings extends ClientSettings + setTargetForwardingRuleOperationSettings() { + return ((ForwardingRuleStubSettings) getStubSettings()) + .setTargetForwardingRuleOperationSettings(); + } + public static final ForwardingRuleSettings create(ForwardingRuleStubSettings stub) throws IOException { return new ForwardingRuleSettings.Builder(stub.toBuilder()).build(); @@ -221,6 +248,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().deleteForwardingRuleSettings(); } + /** Returns the builder for the settings used for calls to deleteForwardingRule. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteForwardingRuleOperationSettings() { + return getStubSettingsBuilder().deleteForwardingRuleOperationSettings(); + } + /** Returns the builder for the settings used for calls to getForwardingRule. */ public UnaryCallSettings.Builder getForwardingRuleSettings() { @@ -233,6 +268,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().insertForwardingRuleSettings(); } + /** Returns the builder for the settings used for calls to insertForwardingRule. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + insertForwardingRuleOperationSettings() { + return getStubSettingsBuilder().insertForwardingRuleOperationSettings(); + } + /** Returns the builder for the settings used for calls to listForwardingRules. */ public PagedCallSettings.Builder< ListForwardingRulesHttpRequest, ForwardingRuleList, ListForwardingRulesPagedResponse> @@ -246,6 +289,15 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().setTargetForwardingRuleSettings(); } + /** Returns the builder for the settings used for calls to setTargetForwardingRule. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + SetTargetForwardingRuleHttpRequest, EmptyMessage, Operation> + setTargetForwardingRuleOperationSettings() { + return getStubSettingsBuilder().setTargetForwardingRuleOperationSettings(); + } + @Override public ForwardingRuleSettings build() throws IOException { return new ForwardingRuleSettings(this); diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalAddressClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalAddressClient.java index 9aa48d06041f..1783e026afe3 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalAddressClient.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalAddressClient.java @@ -20,9 +20,12 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.EmptyMessage; +import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.GlobalAddressStub; @@ -43,7 +46,7 @@ * * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) { * ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]"); - * Operation response = globalAddressClient.deleteGlobalAddress(address); + * Address response = globalAddressClient.getGlobalAddress(address); * } **
* try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
* ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
- * Operation response = globalAddressClient.deleteGlobalAddress(address);
+ * globalAddressClient.deleteGlobalAddressAsync(address).get();
* }
*
*
* @param address Name of the address resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteGlobalAddress(ProjectGlobalAddressName address) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
* ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
- * Operation response = globalAddressClient.deleteGlobalAddress(address.toString());
+ * globalAddressClient.deleteGlobalAddressAsync(address.toString()).get();
* }
*
*
* @param address Name of the address resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteGlobalAddress(String address) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+ * ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
+ * DeleteGlobalAddressHttpRequest request = DeleteGlobalAddressHttpRequest.newBuilder()
+ * .setAddress(address.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = globalAddressClient.deleteGlobalAddressOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+ * ProjectName project = ProjectName.of("[PROJECT]");
+ * Address addressResource = Address.newBuilder().build();
+ * InsertGlobalAddressHttpRequest request = InsertGlobalAddressHttpRequest.newBuilder()
+ * .setProject(project.toString())
+ * .setAddressResource(addressResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = globalAddressClient.insertGlobalAddressOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of deleteGlobalAddress to 30 seconds: + * example, to set the total timeout of getGlobalAddress to 30 seconds: * *
*@@ -104,6 +107,7 @@ public class GlobalForwardingRuleClient implements BackgroundResource { private final GlobalForwardingRuleSettings settings; private final GlobalForwardingRuleStub stub; + private final GlobalOperationClient operationsClient; /** Constructs an instance of GlobalForwardingRuleClient with default settings. */ public static final GlobalForwardingRuleClient create() throws IOException { @@ -136,12 +140,14 @@ public static final GlobalForwardingRuleClient create(GlobalForwardingRuleStub s protected GlobalForwardingRuleClient(GlobalForwardingRuleSettings settings) throws IOException { this.settings = settings; this.stub = ((GlobalForwardingRuleStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected GlobalForwardingRuleClient(GlobalForwardingRuleStub stub) { this.settings = null; this.stub = stub; + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } public final GlobalForwardingRuleSettings getSettings() { @@ -153,6 +159,16 @@ public GlobalForwardingRuleStub getStub() { return stub; } + /** + * Returns the GlobalOperationClient that can be used to query the status of a long-running + * operation returned by another API method call. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final GlobalOperationClient getOperationsClient() { + return operationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes the specified GlobalForwardingRule resource. @@ -162,22 +178,23 @@ public GlobalForwardingRuleStub getStub() { ** GlobalAddressSettings.Builder globalAddressSettingsBuilder = * GlobalAddressSettings.newBuilder(); - * globalAddressSettingsBuilder.deleteGlobalAddressSettings().getRetrySettings().toBuilder() + * globalAddressSettingsBuilder.getGlobalAddressSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * GlobalAddressSettings globalAddressSettings = globalAddressSettingsBuilder.build(); *@@ -69,6 +71,14 @@ public class GlobalAddressSettings extends ClientSettingsreturn ((GlobalAddressStubSettings) getStubSettings()).deleteGlobalAddressSettings(); } + /** Returns the object with the settings used for calls to deleteGlobalAddress. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + deleteGlobalAddressOperationSettings() { + return ((GlobalAddressStubSettings) getStubSettings()).deleteGlobalAddressOperationSettings(); + } + /** Returns the object with the settings used for calls to getGlobalAddress. */ public UnaryCallSettings getGlobalAddressSettings() { return ((GlobalAddressStubSettings) getStubSettings()).getGlobalAddressSettings(); @@ -80,6 +90,14 @@ public UnaryCallSettings getGlobalAddressS return ((GlobalAddressStubSettings) getStubSettings()).insertGlobalAddressSettings(); } + /** Returns the object with the settings used for calls to insertGlobalAddress. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + insertGlobalAddressOperationSettings() { + return ((GlobalAddressStubSettings) getStubSettings()).insertGlobalAddressOperationSettings(); + } + /** Returns the object with the settings used for calls to listGlobalAddresses. */ public PagedCallSettings< ListGlobalAddressesHttpRequest, AddressList, ListGlobalAddressesPagedResponse> @@ -195,6 +213,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().deleteGlobalAddressSettings(); } + /** Returns the builder for the settings used for calls to deleteGlobalAddress. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteGlobalAddressOperationSettings() { + return getStubSettingsBuilder().deleteGlobalAddressOperationSettings(); + } + /** Returns the builder for the settings used for calls to getGlobalAddress. */ public UnaryCallSettings.Builder getGlobalAddressSettings() { @@ -207,6 +233,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().insertGlobalAddressSettings(); } + /** Returns the builder for the settings used for calls to insertGlobalAddress. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + insertGlobalAddressOperationSettings() { + return getStubSettingsBuilder().insertGlobalAddressOperationSettings(); + } + /** Returns the builder for the settings used for calls to listGlobalAddresses. */ public PagedCallSettings.Builder< ListGlobalAddressesHttpRequest, AddressList, ListGlobalAddressesPagedResponse> diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalForwardingRuleClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalForwardingRuleClient.java index 64156dde5424..e7543a904b64 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalForwardingRuleClient.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalForwardingRuleClient.java @@ -20,9 +20,12 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.EmptyMessage; +import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.GlobalForwardingRuleStub; @@ -43,7 +46,7 @@ * * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) { * ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]"); - * Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(forwardingRule); + * ForwardingRule response = globalForwardingRuleClient.getGlobalForwardingRule(forwardingRule); * } **
* try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
* ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
- * Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(forwardingRule);
+ * globalForwardingRuleClient.deleteGlobalForwardingRuleAsync(forwardingRule).get();
* }
*
*
* @param forwardingRule Name of the ForwardingRule resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteGlobalForwardingRule(
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
* ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
- * Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(forwardingRule.toString());
+ * globalForwardingRuleClient.deleteGlobalForwardingRuleAsync(forwardingRule.toString()).get();
* }
*
*
* @param forwardingRule Name of the ForwardingRule resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteGlobalForwardingRule(String forwardingRule) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+ * ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+ * DeleteGlobalForwardingRuleHttpRequest request = DeleteGlobalForwardingRuleHttpRequest.newBuilder()
+ * .setForwardingRule(forwardingRule.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = globalForwardingRuleClient.deleteGlobalForwardingRuleOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+ * ProjectName project = ProjectName.of("[PROJECT]");
+ * ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
+ * InsertGlobalForwardingRuleHttpRequest request = InsertGlobalForwardingRuleHttpRequest.newBuilder()
+ * .setProject(project.toString())
+ * .setForwardingRuleResource(forwardingRuleResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = globalForwardingRuleClient.insertGlobalForwardingRuleOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+ * ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+ * TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+ * SetTargetGlobalForwardingRuleHttpRequest request = SetTargetGlobalForwardingRuleHttpRequest.newBuilder()
+ * .setForwardingRule(forwardingRule.toString())
+ * .setTargetReferenceResource(targetReferenceResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = globalForwardingRuleClient.setTargetGlobalForwardingRuleOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of deleteGlobalForwardingRule to 30 seconds: + * example, to set the total timeout of getGlobalForwardingRule to 30 seconds: * *
**/ @BetaApi - public final UnaryCallable* GlobalForwardingRuleSettings.Builder globalForwardingRuleSettingsBuilder = * GlobalForwardingRuleSettings.newBuilder(); - * globalForwardingRuleSettingsBuilder.deleteGlobalForwardingRuleSettings().getRetrySettings().toBuilder() + * globalForwardingRuleSettingsBuilder.getGlobalForwardingRuleSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * GlobalForwardingRuleSettings globalForwardingRuleSettings = globalForwardingRuleSettingsBuilder.build(); *@@ -70,6 +72,15 @@ public class GlobalForwardingRuleSettings extends ClientSettings+ deleteGlobalForwardingRuleOperationSettings() { + return ((GlobalForwardingRuleStubSettings) getStubSettings()) + .deleteGlobalForwardingRuleOperationSettings(); + } + /** Returns the object with the settings used for calls to getGlobalForwardingRule. */ public UnaryCallSettings getGlobalForwardingRuleSettings() { @@ -83,6 +94,15 @@ public class GlobalForwardingRuleSettings extends ClientSettings + insertGlobalForwardingRuleOperationSettings() { + return ((GlobalForwardingRuleStubSettings) getStubSettings()) + .insertGlobalForwardingRuleOperationSettings(); + } + /** Returns the object with the settings used for calls to listGlobalForwardingRules. */ public PagedCallSettings< ListGlobalForwardingRulesHttpRequest, @@ -100,6 +120,15 @@ public class GlobalForwardingRuleSettings extends ClientSettings + setTargetGlobalForwardingRuleOperationSettings() { + return ((GlobalForwardingRuleStubSettings) getStubSettings()) + .setTargetGlobalForwardingRuleOperationSettings(); + } + public static final GlobalForwardingRuleSettings create(GlobalForwardingRuleStubSettings stub) throws IOException { return new GlobalForwardingRuleSettings.Builder(stub.toBuilder()).build(); @@ -209,6 +238,15 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().deleteGlobalForwardingRuleSettings(); } + /** Returns the builder for the settings used for calls to deleteGlobalForwardingRule. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + DeleteGlobalForwardingRuleHttpRequest, EmptyMessage, Operation> + deleteGlobalForwardingRuleOperationSettings() { + return getStubSettingsBuilder().deleteGlobalForwardingRuleOperationSettings(); + } + /** Returns the builder for the settings used for calls to getGlobalForwardingRule. */ public UnaryCallSettings.Builder getGlobalForwardingRuleSettings() { @@ -221,6 +259,15 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().insertGlobalForwardingRuleSettings(); } + /** Returns the builder for the settings used for calls to insertGlobalForwardingRule. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + InsertGlobalForwardingRuleHttpRequest, EmptyMessage, Operation> + insertGlobalForwardingRuleOperationSettings() { + return getStubSettingsBuilder().insertGlobalForwardingRuleOperationSettings(); + } + /** Returns the builder for the settings used for calls to listGlobalForwardingRules. */ public PagedCallSettings.Builder< ListGlobalForwardingRulesHttpRequest, @@ -236,6 +283,15 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().setTargetGlobalForwardingRuleSettings(); } + /** Returns the builder for the settings used for calls to setTargetGlobalForwardingRule. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + SetTargetGlobalForwardingRuleHttpRequest, EmptyMessage, Operation> + setTargetGlobalForwardingRuleOperationSettings() { + return getStubSettingsBuilder().setTargetGlobalForwardingRuleOperationSettings(); + } + @Override public GlobalForwardingRuleSettings build() throws IOException { return new GlobalForwardingRuleSettings(this); diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalOperationClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalOperationClient.java index cf3ff11bfbfe..1f8c5af1629d 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalOperationClient.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalOperationClient.java @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.EmptyMessage; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; @@ -387,7 +388,7 @@ public final void deleteGlobalOperation(DeleteGlobalOperationHttpRequest request *
* try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
* ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
- * Operation response = healthCheckClient.deleteHealthCheck(healthCheck);
+ * HealthCheck response = healthCheckClient.getHealthCheck(healthCheck);
* }
*
*
@@ -103,6 +106,7 @@
public class HealthCheckClient implements BackgroundResource {
private final HealthCheckSettings settings;
private final HealthCheckStub stub;
+ private final GlobalOperationClient operationsClient;
/** Constructs an instance of HealthCheckClient with default settings. */
public static final HealthCheckClient create() throws IOException {
@@ -134,12 +138,14 @@ public static final HealthCheckClient create(HealthCheckStub stub) {
protected HealthCheckClient(HealthCheckSettings settings) throws IOException {
this.settings = settings;
this.stub = ((HealthCheckStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub());
}
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected HealthCheckClient(HealthCheckStub stub) {
this.settings = null;
this.stub = stub;
+ this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub());
}
public final HealthCheckSettings getSettings() {
@@ -151,6 +157,16 @@ public HealthCheckStub getStub() {
return stub;
}
+ /**
+ * Returns the GlobalOperationClient that can be used to query the status of a long-running
+ * operation returned by another API method call.
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final GlobalOperationClient getOperationsClient() {
+ return operationsClient;
+ }
+
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes the specified HealthCheck resource.
@@ -160,21 +176,23 @@ public HealthCheckStub getStub() {
*
* try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
* ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
- * Operation response = healthCheckClient.deleteHealthCheck(healthCheck);
+ * healthCheckClient.deleteHealthCheckAsync(healthCheck).get();
* }
*
*
* @param healthCheck Name of the HealthCheck resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteHealthCheck(ProjectGlobalHealthCheckName healthCheck) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
* ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
- * Operation response = healthCheckClient.deleteHealthCheck(healthCheck.toString());
+ * healthCheckClient.deleteHealthCheckAsync(healthCheck.toString()).get();
* }
*
*
* @param healthCheck Name of the HealthCheck resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteHealthCheck(String healthCheck) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+ * ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+ * DeleteHealthCheckHttpRequest request = DeleteHealthCheckHttpRequest.newBuilder()
+ * .setHealthCheck(healthCheck.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = healthCheckClient.deleteHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+ * ProjectName project = ProjectName.of("[PROJECT]");
+ * HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+ * InsertHealthCheckHttpRequest request = InsertHealthCheckHttpRequest.newBuilder()
+ * .setProject(project.toString())
+ * .setHealthCheckResource(healthCheckResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = healthCheckClient.insertHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+ * ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+ * HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * PatchHealthCheckHttpRequest request = PatchHealthCheckHttpRequest.newBuilder()
+ * .setHealthCheck(healthCheck.toString())
+ * .setHealthCheckResource(healthCheckResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = healthCheckClient.patchHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+ * ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+ * HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * UpdateHealthCheckHttpRequest request = UpdateHealthCheckHttpRequest.newBuilder()
+ * .setHealthCheck(healthCheck.toString())
+ * .setHealthCheckResource(healthCheckResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = healthCheckClient.updateHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of deleteHealthCheck to 30 seconds: + * example, to set the total timeout of getHealthCheck to 30 seconds: * *
*@@ -104,6 +107,7 @@ public class HttpHealthCheckClient implements BackgroundResource { private final HttpHealthCheckSettings settings; private final HttpHealthCheckStub stub; + private final GlobalOperationClient operationsClient; /** Constructs an instance of HttpHealthCheckClient with default settings. */ public static final HttpHealthCheckClient create() throws IOException { @@ -136,12 +140,14 @@ public static final HttpHealthCheckClient create(HttpHealthCheckStub stub) { protected HttpHealthCheckClient(HttpHealthCheckSettings settings) throws IOException { this.settings = settings; this.stub = ((HttpHealthCheckStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected HttpHealthCheckClient(HttpHealthCheckStub stub) { this.settings = null; this.stub = stub; + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } public final HttpHealthCheckSettings getSettings() { @@ -153,6 +159,16 @@ public HttpHealthCheckStub getStub() { return stub; } + /** + * Returns the GlobalOperationClient that can be used to query the status of a long-running + * operation returned by another API method call. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final GlobalOperationClient getOperationsClient() { + return operationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes the specified HttpHealthCheck resource. @@ -162,21 +178,23 @@ public HttpHealthCheckStub getStub() { ** HealthCheckSettings.Builder healthCheckSettingsBuilder = * HealthCheckSettings.newBuilder(); - * healthCheckSettingsBuilder.deleteHealthCheckSettings().getRetrySettings().toBuilder() + * healthCheckSettingsBuilder.getHealthCheckSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * HealthCheckSettings healthCheckSettings = healthCheckSettingsBuilder.build(); *@@ -68,6 +70,14 @@ public UnaryCallSettingsdeleteHealthCh return ((HealthCheckStubSettings) getStubSettings()).deleteHealthCheckSettings(); } + /** Returns the object with the settings used for calls to deleteHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + deleteHealthCheckOperationSettings() { + return ((HealthCheckStubSettings) getStubSettings()).deleteHealthCheckOperationSettings(); + } + /** Returns the object with the settings used for calls to getHealthCheck. */ public UnaryCallSettings getHealthCheckSettings() { return ((HealthCheckStubSettings) getStubSettings()).getHealthCheckSettings(); @@ -78,6 +88,14 @@ public UnaryCallSettings insertHealthCh return ((HealthCheckStubSettings) getStubSettings()).insertHealthCheckSettings(); } + /** Returns the object with the settings used for calls to insertHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + insertHealthCheckOperationSettings() { + return ((HealthCheckStubSettings) getStubSettings()).insertHealthCheckOperationSettings(); + } + /** Returns the object with the settings used for calls to listHealthChecks. */ public PagedCallSettings< ListHealthChecksHttpRequest, HealthCheckList, ListHealthChecksPagedResponse> @@ -90,11 +108,27 @@ public UnaryCallSettings patchHealthChec return ((HealthCheckStubSettings) getStubSettings()).patchHealthCheckSettings(); } + /** Returns the object with the settings used for calls to patchHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + patchHealthCheckOperationSettings() { + return ((HealthCheckStubSettings) getStubSettings()).patchHealthCheckOperationSettings(); + } + /** Returns the object with the settings used for calls to updateHealthCheck. */ public UnaryCallSettings updateHealthCheckSettings() { return ((HealthCheckStubSettings) getStubSettings()).updateHealthCheckSettings(); } + /** Returns the object with the settings used for calls to updateHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + updateHealthCheckOperationSettings() { + return ((HealthCheckStubSettings) getStubSettings()).updateHealthCheckOperationSettings(); + } + public static final HealthCheckSettings create(HealthCheckStubSettings stub) throws IOException { return new HealthCheckSettings.Builder(stub.toBuilder()).build(); } @@ -202,6 +236,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().deleteHealthCheckSettings(); } + /** Returns the builder for the settings used for calls to deleteHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteHealthCheckOperationSettings() { + return getStubSettingsBuilder().deleteHealthCheckOperationSettings(); + } + /** Returns the builder for the settings used for calls to getHealthCheck. */ public UnaryCallSettings.Builder getHealthCheckSettings() { @@ -214,6 +256,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().insertHealthCheckSettings(); } + /** Returns the builder for the settings used for calls to insertHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + insertHealthCheckOperationSettings() { + return getStubSettingsBuilder().insertHealthCheckOperationSettings(); + } + /** Returns the builder for the settings used for calls to listHealthChecks. */ public PagedCallSettings.Builder< ListHealthChecksHttpRequest, HealthCheckList, ListHealthChecksPagedResponse> @@ -227,12 +277,28 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().patchHealthCheckSettings(); } + /** Returns the builder for the settings used for calls to patchHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + patchHealthCheckOperationSettings() { + return getStubSettingsBuilder().patchHealthCheckOperationSettings(); + } + /** Returns the builder for the settings used for calls to updateHealthCheck. */ public UnaryCallSettings.Builder updateHealthCheckSettings() { return getStubSettingsBuilder().updateHealthCheckSettings(); } + /** Returns the builder for the settings used for calls to updateHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updateHealthCheckOperationSettings() { + return getStubSettingsBuilder().updateHealthCheckOperationSettings(); + } + @Override public HealthCheckSettings build() throws IOException { return new HealthCheckSettings(this); diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckClient.java index dd2f1223f2f2..b514566de3e5 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckClient.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckClient.java @@ -20,9 +20,12 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.EmptyMessage; +import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.HttpHealthCheckStub; @@ -43,7 +46,7 @@ * * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) { * ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]"); - * Operation response = httpHealthCheckClient.deleteHttpHealthCheck(httpHealthCheck); + * HttpHealthCheck2 response = httpHealthCheckClient.getHttpHealthCheck(httpHealthCheck); * } **
* try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
* ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
- * Operation response = httpHealthCheckClient.deleteHttpHealthCheck(httpHealthCheck);
+ * httpHealthCheckClient.deleteHttpHealthCheckAsync(httpHealthCheck).get();
* }
*
*
* @param httpHealthCheck Name of the HttpHealthCheck resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteHttpHealthCheck(ProjectGlobalHttpHealthCheckName httpHealthCheck) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
* ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
- * Operation response = httpHealthCheckClient.deleteHttpHealthCheck(httpHealthCheck.toString());
+ * httpHealthCheckClient.deleteHttpHealthCheckAsync(httpHealthCheck.toString()).get();
* }
*
*
* @param httpHealthCheck Name of the HttpHealthCheck resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteHttpHealthCheck(String httpHealthCheck) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+ * ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+ * DeleteHttpHealthCheckHttpRequest request = DeleteHttpHealthCheckHttpRequest.newBuilder()
+ * .setHttpHealthCheck(httpHealthCheck.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = httpHealthCheckClient.deleteHttpHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+ * ProjectName project = ProjectName.of("[PROJECT]");
+ * HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+ * InsertHttpHealthCheckHttpRequest request = InsertHttpHealthCheckHttpRequest.newBuilder()
+ * .setProject(project.toString())
+ * .setHttpHealthCheckResource(httpHealthCheckResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = httpHealthCheckClient.insertHttpHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+ * ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+ * HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * PatchHttpHealthCheckHttpRequest request = PatchHttpHealthCheckHttpRequest.newBuilder()
+ * .setHttpHealthCheck(httpHealthCheck.toString())
+ * .setHttpHealthCheckResource(httpHealthCheckResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = httpHealthCheckClient.patchHttpHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+ * ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+ * HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * UpdateHttpHealthCheckHttpRequest request = UpdateHttpHealthCheckHttpRequest.newBuilder()
+ * .setHttpHealthCheck(httpHealthCheck.toString())
+ * .setHttpHealthCheckResource(httpHealthCheckResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = httpHealthCheckClient.updateHttpHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of deleteHttpHealthCheck to 30 seconds: + * example, to set the total timeout of getHttpHealthCheck to 30 seconds: * *
*@@ -104,6 +107,7 @@ public class HttpsHealthCheckClient implements BackgroundResource { private final HttpsHealthCheckSettings settings; private final HttpsHealthCheckStub stub; + private final GlobalOperationClient operationsClient; /** Constructs an instance of HttpsHealthCheckClient with default settings. */ public static final HttpsHealthCheckClient create() throws IOException { @@ -136,12 +140,14 @@ public static final HttpsHealthCheckClient create(HttpsHealthCheckStub stub) { protected HttpsHealthCheckClient(HttpsHealthCheckSettings settings) throws IOException { this.settings = settings; this.stub = ((HttpsHealthCheckStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected HttpsHealthCheckClient(HttpsHealthCheckStub stub) { this.settings = null; this.stub = stub; + this.operationsClient = GlobalOperationClient.create(this.stub.getOperationsStub()); } public final HttpsHealthCheckSettings getSettings() { @@ -153,6 +159,16 @@ public HttpsHealthCheckStub getStub() { return stub; } + /** + * Returns the GlobalOperationClient that can be used to query the status of a long-running + * operation returned by another API method call. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final GlobalOperationClient getOperationsClient() { + return operationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes the specified HttpsHealthCheck resource. @@ -162,22 +178,23 @@ public HttpsHealthCheckStub getStub() { ** HttpHealthCheckSettings.Builder httpHealthCheckSettingsBuilder = * HttpHealthCheckSettings.newBuilder(); - * httpHealthCheckSettingsBuilder.deleteHttpHealthCheckSettings().getRetrySettings().toBuilder() + * httpHealthCheckSettingsBuilder.getHttpHealthCheckSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * HttpHealthCheckSettings httpHealthCheckSettings = httpHealthCheckSettingsBuilder.build(); *@@ -69,6 +71,15 @@ public class HttpHealthCheckSettings extends ClientSettings+ deleteHttpHealthCheckOperationSettings() { + return ((HttpHealthCheckStubSettings) getStubSettings()) + .deleteHttpHealthCheckOperationSettings(); + } + /** Returns the object with the settings used for calls to getHttpHealthCheck. */ public UnaryCallSettings getHttpHealthCheckSettings() { @@ -81,6 +92,15 @@ public class HttpHealthCheckSettings extends ClientSettings + insertHttpHealthCheckOperationSettings() { + return ((HttpHealthCheckStubSettings) getStubSettings()) + .insertHttpHealthCheckOperationSettings(); + } + /** Returns the object with the settings used for calls to listHttpHealthChecks. */ public PagedCallSettings< ListHttpHealthChecksHttpRequest, HttpHealthCheckList, ListHttpHealthChecksPagedResponse> @@ -94,12 +114,30 @@ public class HttpHealthCheckSettings extends ClientSettings + patchHttpHealthCheckOperationSettings() { + return ((HttpHealthCheckStubSettings) getStubSettings()) + .patchHttpHealthCheckOperationSettings(); + } + /** Returns the object with the settings used for calls to updateHttpHealthCheck. */ public UnaryCallSettings updateHttpHealthCheckSettings() { return ((HttpHealthCheckStubSettings) getStubSettings()).updateHttpHealthCheckSettings(); } + /** Returns the object with the settings used for calls to updateHttpHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + updateHttpHealthCheckOperationSettings() { + return ((HttpHealthCheckStubSettings) getStubSettings()) + .updateHttpHealthCheckOperationSettings(); + } + public static final HttpHealthCheckSettings create(HttpHealthCheckStubSettings stub) throws IOException { return new HttpHealthCheckSettings.Builder(stub.toBuilder()).build(); @@ -208,6 +246,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().deleteHttpHealthCheckSettings(); } + /** Returns the builder for the settings used for calls to deleteHttpHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteHttpHealthCheckOperationSettings() { + return getStubSettingsBuilder().deleteHttpHealthCheckOperationSettings(); + } + /** Returns the builder for the settings used for calls to getHttpHealthCheck. */ public UnaryCallSettings.Builder getHttpHealthCheckSettings() { @@ -220,6 +266,14 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().insertHttpHealthCheckSettings(); } + /** Returns the builder for the settings used for calls to insertHttpHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + insertHttpHealthCheckOperationSettings() { + return getStubSettingsBuilder().insertHttpHealthCheckOperationSettings(); + } + /** Returns the builder for the settings used for calls to listHttpHealthChecks. */ public PagedCallSettings.Builder< ListHttpHealthChecksHttpRequest, HttpHealthCheckList, ListHttpHealthChecksPagedResponse> @@ -233,12 +287,28 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().patchHttpHealthCheckSettings(); } + /** Returns the builder for the settings used for calls to patchHttpHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + patchHttpHealthCheckOperationSettings() { + return getStubSettingsBuilder().patchHttpHealthCheckOperationSettings(); + } + /** Returns the builder for the settings used for calls to updateHttpHealthCheck. */ public UnaryCallSettings.Builder updateHttpHealthCheckSettings() { return getStubSettingsBuilder().updateHttpHealthCheckSettings(); } + /** Returns the builder for the settings used for calls to updateHttpHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updateHttpHealthCheckOperationSettings() { + return getStubSettingsBuilder().updateHttpHealthCheckOperationSettings(); + } + @Override public HttpHealthCheckSettings build() throws IOException { return new HttpHealthCheckSettings(this); diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckClient.java index 7fcf330f460b..ed2f564546eb 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckClient.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckClient.java @@ -20,9 +20,12 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.EmptyMessage; +import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.HttpsHealthCheckStub; @@ -43,7 +46,7 @@ * * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) { * ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]"); - * Operation response = httpsHealthCheckClient.deleteHttpsHealthCheck(httpsHealthCheck); + * HttpsHealthCheck2 response = httpsHealthCheckClient.getHttpsHealthCheck(httpsHealthCheck); * } **
* try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
* ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
- * Operation response = httpsHealthCheckClient.deleteHttpsHealthCheck(httpsHealthCheck);
+ * httpsHealthCheckClient.deleteHttpsHealthCheckAsync(httpsHealthCheck).get();
* }
*
*
* @param httpsHealthCheck Name of the HttpsHealthCheck resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteHttpsHealthCheck(
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
* ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
- * Operation response = httpsHealthCheckClient.deleteHttpsHealthCheck(httpsHealthCheck.toString());
+ * httpsHealthCheckClient.deleteHttpsHealthCheckAsync(httpsHealthCheck.toString()).get();
* }
*
*
* @param httpsHealthCheck Name of the HttpsHealthCheck resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi
- public final Operation deleteHttpsHealthCheck(String httpsHealthCheck) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+ * ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+ * DeleteHttpsHealthCheckHttpRequest request = DeleteHttpsHealthCheckHttpRequest.newBuilder()
+ * .setHttpsHealthCheck(httpsHealthCheck.toString())
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = httpsHealthCheckClient.deleteHttpsHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+ * ProjectName project = ProjectName.of("[PROJECT]");
+ * HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+ * InsertHttpsHealthCheckHttpRequest request = InsertHttpsHealthCheckHttpRequest.newBuilder()
+ * .setProject(project.toString())
+ * .setHttpsHealthCheckResource(httpsHealthCheckResource)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = httpsHealthCheckClient.insertHttpsHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+ * ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+ * HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * PatchHttpsHealthCheckHttpRequest request = PatchHttpsHealthCheckHttpRequest.newBuilder()
+ * .setHttpsHealthCheck(httpsHealthCheck.toString())
+ * .setHttpsHealthCheckResource(httpsHealthCheckResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = httpsHealthCheckClient.patchHttpsHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+ * ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+ * HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+ * List<String> fieldMask = new ArrayList<>();
+ * UpdateHttpsHealthCheckHttpRequest request = UpdateHttpsHealthCheckHttpRequest.newBuilder()
+ * .setHttpsHealthCheck(httpsHealthCheck.toString())
+ * .setHttpsHealthCheckResource(httpsHealthCheckResource)
+ * .addAllFieldMask(fieldMask)
+ * .build();
+ * OperationFuture<EmptyMessage, Operation> future = httpsHealthCheckClient.updateHttpsHealthCheckOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. For - * example, to set the total timeout of deleteHttpsHealthCheck to 30 seconds: + * example, to set the total timeout of getHttpsHealthCheck to 30 seconds: * *
** HttpsHealthCheckSettings.Builder httpsHealthCheckSettingsBuilder = * HttpsHealthCheckSettings.newBuilder(); - * httpsHealthCheckSettingsBuilder.deleteHttpsHealthCheckSettings().getRetrySettings().toBuilder() + * httpsHealthCheckSettingsBuilder.getHttpsHealthCheckSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * HttpsHealthCheckSettings httpsHealthCheckSettings = httpsHealthCheckSettingsBuilder.build(); *@@ -69,6 +71,15 @@ public class HttpsHealthCheckSettings extends ClientSettings+ deleteHttpsHealthCheckOperationSettings() { + return ((HttpsHealthCheckStubSettings) getStubSettings()) + .deleteHttpsHealthCheckOperationSettings(); + } + /** Returns the object with the settings used for calls to getHttpsHealthCheck. */ public UnaryCallSettings getHttpsHealthCheckSettings() { @@ -81,6 +92,15 @@ public class HttpsHealthCheckSettings extends ClientSettings + insertHttpsHealthCheckOperationSettings() { + return ((HttpsHealthCheckStubSettings) getStubSettings()) + .insertHttpsHealthCheckOperationSettings(); + } + /** Returns the object with the settings used for calls to listHttpsHealthChecks. */ public PagedCallSettings< ListHttpsHealthChecksHttpRequest, @@ -96,12 +116,30 @@ public class HttpsHealthCheckSettings extends ClientSettings + patchHttpsHealthCheckOperationSettings() { + return ((HttpsHealthCheckStubSettings) getStubSettings()) + .patchHttpsHealthCheckOperationSettings(); + } + /** Returns the object with the settings used for calls to updateHttpsHealthCheck. */ public UnaryCallSettings updateHttpsHealthCheckSettings() { return ((HttpsHealthCheckStubSettings) getStubSettings()).updateHttpsHealthCheckSettings(); } + /** Returns the object with the settings used for calls to updateHttpsHealthCheck. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings