@BetaApi
  public final Operation setDeletionProtectionInstance(
      String resource, Boolean deletionProtection) {

    SetDeletionProtectionInstanceHttpRequest request =
        SetDeletionProtectionInstanceHttpRequest.newBuilder()
            .setResource(resource)
            .setDeletionProtection(deletionProtection)
            .build();
    return setDeletionProtectionInstance(request);
  }
@ BetaApi public final Operation setDeletionProtectionInstance ( String resource , Boolean deletionProtection ) { SetDeletionProtectionInstanceHttpRequest request = SetDeletionProtectionInstanceHttpRequest . newBuilder ( ) . setResource ( resource ) . setDeletionProtection ( deletionProtection ) . build ( ) ; return setDeletionProtectionInstance ( request ) ; }
Sets deletion protection on the instance.

<p>Sample code:

<pre><code>
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
Boolean deletionProtection = false;
Operation response = instanceClient.setDeletionProtectionInstance(resource.toString(), deletionProtection);
}
</code></pre>

@param resource Name or id of the resource for this request.
@param deletionProtection Whether the resource should be protected against deletion.
@throws com.google.api.gax.rpc.ApiException if the remote call fails