@Generated(value="by gapic-generator") @BetaApi public class GlobalForwardingRuleClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(forwardingRule);
}
Note: close() needs to be called on the globalForwardingRuleClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of GlobalForwardingRuleSettings to create(). For example:
To customize credentials:
GlobalForwardingRuleSettings globalForwardingRuleSettings =
GlobalForwardingRuleSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
GlobalForwardingRuleClient globalForwardingRuleClient =
GlobalForwardingRuleClient.create(globalForwardingRuleSettings);
To customize the endpoint:
GlobalForwardingRuleSettings globalForwardingRuleSettings =
GlobalForwardingRuleSettings.newBuilder().setEndpoint(myEndpoint).build();
GlobalForwardingRuleClient globalForwardingRuleClient =
GlobalForwardingRuleClient.create(globalForwardingRuleSettings);
Modifier and Type | Class and Description |
---|---|
static class |
GlobalForwardingRuleClient.ListGlobalForwardingRulesFixedSizeCollection |
static class |
GlobalForwardingRuleClient.ListGlobalForwardingRulesPage |
static class |
GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
GlobalForwardingRuleClient(GlobalForwardingRuleSettings settings)
Constructs an instance of GlobalForwardingRuleClient, using the given settings.
|
protected |
GlobalForwardingRuleClient(GlobalForwardingRuleStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static GlobalForwardingRuleClient |
create()
Constructs an instance of GlobalForwardingRuleClient with default settings.
|
static GlobalForwardingRuleClient |
create(GlobalForwardingRuleSettings settings)
Constructs an instance of GlobalForwardingRuleClient, using the given settings.
|
static GlobalForwardingRuleClient |
create(GlobalForwardingRuleStub stub)
Constructs an instance of GlobalForwardingRuleClient, using the given stub for making calls.
|
Operation |
deleteGlobalForwardingRule(DeleteGlobalForwardingRuleHttpRequest request)
Deletes the specified GlobalForwardingRule resource.
|
Operation |
deleteGlobalForwardingRule(ProjectGlobalForwardingRuleName forwardingRule)
Deletes the specified GlobalForwardingRule resource.
|
Operation |
deleteGlobalForwardingRule(String forwardingRule)
Deletes the specified GlobalForwardingRule resource.
|
com.google.api.gax.rpc.UnaryCallable<DeleteGlobalForwardingRuleHttpRequest,Operation> |
deleteGlobalForwardingRuleCallable()
Deletes the specified GlobalForwardingRule resource.
|
ForwardingRule |
getGlobalForwardingRule(GetGlobalForwardingRuleHttpRequest request)
Returns the specified GlobalForwardingRule resource.
|
ForwardingRule |
getGlobalForwardingRule(ProjectGlobalForwardingRuleName forwardingRule)
Returns the specified GlobalForwardingRule resource.
|
ForwardingRule |
getGlobalForwardingRule(String forwardingRule)
Returns the specified GlobalForwardingRule resource.
|
com.google.api.gax.rpc.UnaryCallable<GetGlobalForwardingRuleHttpRequest,ForwardingRule> |
getGlobalForwardingRuleCallable()
Returns the specified GlobalForwardingRule resource.
|
GlobalForwardingRuleSettings |
getSettings() |
GlobalForwardingRuleStub |
getStub() |
Operation |
insertGlobalForwardingRule(InsertGlobalForwardingRuleHttpRequest request)
Creates a GlobalForwardingRule resource in the specified project using the data included in the
request.
|
Operation |
insertGlobalForwardingRule(ProjectName project,
ForwardingRule forwardingRuleResource)
Creates a GlobalForwardingRule resource in the specified project using the data included in the
request.
|
Operation |
insertGlobalForwardingRule(String project,
ForwardingRule forwardingRuleResource)
Creates a GlobalForwardingRule resource in the specified project using the data included in the
request.
|
com.google.api.gax.rpc.UnaryCallable<InsertGlobalForwardingRuleHttpRequest,Operation> |
insertGlobalForwardingRuleCallable()
Creates a GlobalForwardingRule resource in the specified project using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse |
listGlobalForwardingRules(ListGlobalForwardingRulesHttpRequest request)
Retrieves a list of GlobalForwardingRule resources available to the specified project.
|
GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse |
listGlobalForwardingRules(ProjectName project)
Retrieves a list of GlobalForwardingRule resources available to the specified project.
|
GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse |
listGlobalForwardingRules(String project)
Retrieves a list of GlobalForwardingRule resources available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListGlobalForwardingRulesHttpRequest,ForwardingRuleList> |
listGlobalForwardingRulesCallable()
Retrieves a list of GlobalForwardingRule resources available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListGlobalForwardingRulesHttpRequest,GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse> |
listGlobalForwardingRulesPagedCallable()
Retrieves a list of GlobalForwardingRule resources available to the specified project.
|
Operation |
setTargetGlobalForwardingRule(ProjectGlobalForwardingRuleName forwardingRule,
TargetReference targetReferenceResource)
Changes target URL for the GlobalForwardingRule resource.
|
Operation |
setTargetGlobalForwardingRule(SetTargetGlobalForwardingRuleHttpRequest request)
Changes target URL for the GlobalForwardingRule resource.
|
Operation |
setTargetGlobalForwardingRule(String forwardingRule,
TargetReference targetReferenceResource)
Changes target URL for the GlobalForwardingRule resource.
|
com.google.api.gax.rpc.UnaryCallable<SetTargetGlobalForwardingRuleHttpRequest,Operation> |
setTargetGlobalForwardingRuleCallable()
Changes target URL for the GlobalForwardingRule resource.
|
void |
shutdown() |
void |
shutdownNow() |
protected GlobalForwardingRuleClient(GlobalForwardingRuleSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected GlobalForwardingRuleClient(GlobalForwardingRuleStub stub)
public static final GlobalForwardingRuleClient create() throws IOException
IOException
public static final GlobalForwardingRuleClient create(GlobalForwardingRuleSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final GlobalForwardingRuleClient create(GlobalForwardingRuleStub stub)
public final GlobalForwardingRuleSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public GlobalForwardingRuleStub getStub()
@BetaApi public final Operation deleteGlobalForwardingRule(ProjectGlobalForwardingRuleName forwardingRule)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(forwardingRule);
}
forwardingRule
- Name of the ForwardingRule resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteGlobalForwardingRule(String forwardingRule)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(forwardingRule.toString());
}
forwardingRule
- Name of the ForwardingRule resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteGlobalForwardingRule(DeleteGlobalForwardingRuleHttpRequest request)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
String formattedForwardingRule = ProjectGlobalForwardingRuleName.format("[PROJECT]", "[FORWARDING_RULE]");
DeleteGlobalForwardingRuleHttpRequest request = DeleteGlobalForwardingRuleHttpRequest.newBuilder()
.setForwardingRule(formattedForwardingRule)
.build();
Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteGlobalForwardingRuleHttpRequest,Operation> deleteGlobalForwardingRuleCallable()
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
String formattedForwardingRule = ProjectGlobalForwardingRuleName.format("[PROJECT]", "[FORWARDING_RULE]");
DeleteGlobalForwardingRuleHttpRequest request = DeleteGlobalForwardingRuleHttpRequest.newBuilder()
.setForwardingRule(formattedForwardingRule)
.build();
ApiFuture<Operation> future = globalForwardingRuleClient.deleteGlobalForwardingRuleCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final ForwardingRule getGlobalForwardingRule(ProjectGlobalForwardingRuleName forwardingRule)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
ForwardingRule response = globalForwardingRuleClient.getGlobalForwardingRule(forwardingRule);
}
forwardingRule
- Name of the ForwardingRule resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final ForwardingRule getGlobalForwardingRule(String forwardingRule)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
ForwardingRule response = globalForwardingRuleClient.getGlobalForwardingRule(forwardingRule.toString());
}
forwardingRule
- Name of the ForwardingRule resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final ForwardingRule getGlobalForwardingRule(GetGlobalForwardingRuleHttpRequest request)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
String formattedForwardingRule = ProjectGlobalForwardingRuleName.format("[PROJECT]", "[FORWARDING_RULE]");
GetGlobalForwardingRuleHttpRequest request = GetGlobalForwardingRuleHttpRequest.newBuilder()
.setForwardingRule(formattedForwardingRule)
.build();
ForwardingRule response = globalForwardingRuleClient.getGlobalForwardingRule(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetGlobalForwardingRuleHttpRequest,ForwardingRule> getGlobalForwardingRuleCallable()
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
String formattedForwardingRule = ProjectGlobalForwardingRuleName.format("[PROJECT]", "[FORWARDING_RULE]");
GetGlobalForwardingRuleHttpRequest request = GetGlobalForwardingRuleHttpRequest.newBuilder()
.setForwardingRule(formattedForwardingRule)
.build();
ApiFuture<ForwardingRule> future = globalForwardingRuleClient.getGlobalForwardingRuleCallable().futureCall(request);
// Do something
ForwardingRule response = future.get();
}
@BetaApi public final Operation insertGlobalForwardingRule(ProjectName project, ForwardingRule forwardingRuleResource)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
Operation response = globalForwardingRuleClient.insertGlobalForwardingRule(project, forwardingRuleResource);
}
project
- Project ID for this request.forwardingRuleResource
- Represents a Forwarding Rule resource.
A forwardingRules resource represents a regional forwarding rule.
Regional external forwarding rules can reference any of the following resources:
- A target instance - A Cloud VPN Classic gateway (targetVpnGateway), - A target pool for a Network Load Balancer - A global target HTTP(S) proxy for an HTTP(S) load balancer using Standard Tier - A target SSL proxy for a SSL Proxy load balancer using Standard Tier - A target TCP proxy for a TCP Proxy load balancer using Standard Tier.
Regional internal forwarding rules can reference the backend service of an internal TCP/UDP load balancer.
For regional internal forwarding rules, the following applies: - If the loadBalancingScheme for the load balancer is INTERNAL, then the forwarding rule references a regional internal backend service. - If the loadBalancingScheme for the load balancer is INTERNAL_MANAGED, then the forwarding rule must reference a regional target HTTP(S) proxy.
For more information, read Using Forwarding rules.
A globalForwardingRules resource represents a global forwarding rule.
Global forwarding rules are only used by load balancers that use Premium Tier. (== resource_for beta.forwardingRules ==) (== resource_for v1.forwardingRules ==) (== resource_for beta.globalForwardingRules ==) (== resource_for v1.globalForwardingRules ==) (== resource_for beta.regionForwardingRules ==) (== resource_for v1.regionForwardingRules ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertGlobalForwardingRule(String project, ForwardingRule forwardingRuleResource)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
Operation response = globalForwardingRuleClient.insertGlobalForwardingRule(project.toString(), forwardingRuleResource);
}
project
- Project ID for this request.forwardingRuleResource
- Represents a Forwarding Rule resource.
A forwardingRules resource represents a regional forwarding rule.
Regional external forwarding rules can reference any of the following resources:
- A target instance - A Cloud VPN Classic gateway (targetVpnGateway), - A target pool for a Network Load Balancer - A global target HTTP(S) proxy for an HTTP(S) load balancer using Standard Tier - A target SSL proxy for a SSL Proxy load balancer using Standard Tier - A target TCP proxy for a TCP Proxy load balancer using Standard Tier.
Regional internal forwarding rules can reference the backend service of an internal TCP/UDP load balancer.
For regional internal forwarding rules, the following applies: - If the loadBalancingScheme for the load balancer is INTERNAL, then the forwarding rule references a regional internal backend service. - If the loadBalancingScheme for the load balancer is INTERNAL_MANAGED, then the forwarding rule must reference a regional target HTTP(S) proxy.
For more information, read Using Forwarding rules.
A globalForwardingRules resource represents a global forwarding rule.
Global forwarding rules are only used by load balancers that use Premium Tier. (== resource_for beta.forwardingRules ==) (== resource_for v1.forwardingRules ==) (== resource_for beta.globalForwardingRules ==) (== resource_for v1.globalForwardingRules ==) (== resource_for beta.regionForwardingRules ==) (== resource_for v1.regionForwardingRules ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertGlobalForwardingRule(InsertGlobalForwardingRuleHttpRequest request)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
InsertGlobalForwardingRuleHttpRequest request = InsertGlobalForwardingRuleHttpRequest.newBuilder()
.setProject(formattedProject)
.setForwardingRuleResource(forwardingRuleResource)
.build();
Operation response = globalForwardingRuleClient.insertGlobalForwardingRule(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<InsertGlobalForwardingRuleHttpRequest,Operation> insertGlobalForwardingRuleCallable()
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
InsertGlobalForwardingRuleHttpRequest request = InsertGlobalForwardingRuleHttpRequest.newBuilder()
.setProject(formattedProject)
.setForwardingRuleResource(forwardingRuleResource)
.build();
ApiFuture<Operation> future = globalForwardingRuleClient.insertGlobalForwardingRuleCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse listGlobalForwardingRules(ProjectName project)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (ForwardingRule element : globalForwardingRuleClient.listGlobalForwardingRules(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse listGlobalForwardingRules(String project)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (ForwardingRule element : globalForwardingRuleClient.listGlobalForwardingRules(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse listGlobalForwardingRules(ListGlobalForwardingRulesHttpRequest request)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListGlobalForwardingRulesHttpRequest request = ListGlobalForwardingRulesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (ForwardingRule element : globalForwardingRuleClient.listGlobalForwardingRules(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListGlobalForwardingRulesHttpRequest,GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse> listGlobalForwardingRulesPagedCallable()
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListGlobalForwardingRulesHttpRequest request = ListGlobalForwardingRulesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListGlobalForwardingRulesPagedResponse> future = globalForwardingRuleClient.listGlobalForwardingRulesPagedCallable().futureCall(request);
// Do something
for (ForwardingRule element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListGlobalForwardingRulesHttpRequest,ForwardingRuleList> listGlobalForwardingRulesCallable()
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListGlobalForwardingRulesHttpRequest request = ListGlobalForwardingRulesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
ForwardingRuleList response = globalForwardingRuleClient.listGlobalForwardingRulesCallable().call(request);
for (ForwardingRule element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation setTargetGlobalForwardingRule(ProjectGlobalForwardingRuleName forwardingRule, TargetReference targetReferenceResource)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
TargetReference targetReferenceResource = TargetReference.newBuilder().build();
Operation response = globalForwardingRuleClient.setTargetGlobalForwardingRule(forwardingRule, targetReferenceResource);
}
forwardingRule
- Name of the ForwardingRule resource in which target is to be set.targetReferenceResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setTargetGlobalForwardingRule(String forwardingRule, TargetReference targetReferenceResource)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
TargetReference targetReferenceResource = TargetReference.newBuilder().build();
Operation response = globalForwardingRuleClient.setTargetGlobalForwardingRule(forwardingRule.toString(), targetReferenceResource);
}
forwardingRule
- Name of the ForwardingRule resource in which target is to be set.targetReferenceResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setTargetGlobalForwardingRule(SetTargetGlobalForwardingRuleHttpRequest request)
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
String formattedForwardingRule = ProjectGlobalForwardingRuleName.format("[PROJECT]", "[FORWARDING_RULE]");
TargetReference targetReferenceResource = TargetReference.newBuilder().build();
SetTargetGlobalForwardingRuleHttpRequest request = SetTargetGlobalForwardingRuleHttpRequest.newBuilder()
.setForwardingRule(formattedForwardingRule)
.setTargetReferenceResource(targetReferenceResource)
.build();
Operation response = globalForwardingRuleClient.setTargetGlobalForwardingRule(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetTargetGlobalForwardingRuleHttpRequest,Operation> setTargetGlobalForwardingRuleCallable()
Sample code:
try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
String formattedForwardingRule = ProjectGlobalForwardingRuleName.format("[PROJECT]", "[FORWARDING_RULE]");
TargetReference targetReferenceResource = TargetReference.newBuilder().build();
SetTargetGlobalForwardingRuleHttpRequest request = SetTargetGlobalForwardingRuleHttpRequest.newBuilder()
.setForwardingRule(formattedForwardingRule)
.setTargetReferenceResource(targetReferenceResource)
.build();
ApiFuture<Operation> future = globalForwardingRuleClient.setTargetGlobalForwardingRuleCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.