@Generated(value="by gapic-generator") @BetaApi public class TargetTcpProxyClient extends Object implements 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 (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
Operation response = targetTcpProxyClient.deleteTargetTcpProxy(targetTcpProxy);
}
Note: close() needs to be called on the targetTcpProxyClient 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 TargetTcpProxySettings to create(). For example:
To customize credentials:
TargetTcpProxySettings targetTcpProxySettings =
TargetTcpProxySettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
TargetTcpProxyClient targetTcpProxyClient =
TargetTcpProxyClient.create(targetTcpProxySettings);
To customize the endpoint:
TargetTcpProxySettings targetTcpProxySettings =
TargetTcpProxySettings.newBuilder().setEndpoint(myEndpoint).build();
TargetTcpProxyClient targetTcpProxyClient =
TargetTcpProxyClient.create(targetTcpProxySettings);
Modifier and Type | Class and Description |
---|---|
static class |
TargetTcpProxyClient.ListTargetTcpProxiesFixedSizeCollection |
static class |
TargetTcpProxyClient.ListTargetTcpProxiesPage |
static class |
TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
TargetTcpProxyClient(TargetTcpProxySettings settings)
Constructs an instance of TargetTcpProxyClient, using the given settings.
|
protected |
TargetTcpProxyClient(TargetTcpProxyStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static TargetTcpProxyClient |
create()
Constructs an instance of TargetTcpProxyClient with default settings.
|
static TargetTcpProxyClient |
create(TargetTcpProxySettings settings)
Constructs an instance of TargetTcpProxyClient, using the given settings.
|
static TargetTcpProxyClient |
create(TargetTcpProxyStub stub)
Constructs an instance of TargetTcpProxyClient, using the given stub for making calls.
|
Operation |
deleteTargetTcpProxy(DeleteTargetTcpProxyHttpRequest request)
Deletes the specified TargetTcpProxy resource.
|
Operation |
deleteTargetTcpProxy(ProjectGlobalTargetTcpProxyName targetTcpProxy)
Deletes the specified TargetTcpProxy resource.
|
Operation |
deleteTargetTcpProxy(String targetTcpProxy)
Deletes the specified TargetTcpProxy resource.
|
UnaryCallable<DeleteTargetTcpProxyHttpRequest,Operation> |
deleteTargetTcpProxyCallable()
Deletes the specified TargetTcpProxy resource.
|
TargetTcpProxySettings |
getSettings() |
TargetTcpProxyStub |
getStub() |
TargetTcpProxy |
getTargetTcpProxy(GetTargetTcpProxyHttpRequest request)
Returns the specified TargetTcpProxy resource.
|
TargetTcpProxy |
getTargetTcpProxy(ProjectGlobalTargetTcpProxyName targetTcpProxy)
Returns the specified TargetTcpProxy resource.
|
TargetTcpProxy |
getTargetTcpProxy(String targetTcpProxy)
Returns the specified TargetTcpProxy resource.
|
UnaryCallable<GetTargetTcpProxyHttpRequest,TargetTcpProxy> |
getTargetTcpProxyCallable()
Returns the specified TargetTcpProxy resource.
|
Operation |
insertTargetTcpProxy(InsertTargetTcpProxyHttpRequest request)
Creates a TargetTcpProxy resource in the specified project using the data included in the
request.
|
Operation |
insertTargetTcpProxy(ProjectName project,
TargetTcpProxy targetTcpProxyResource)
Creates a TargetTcpProxy resource in the specified project using the data included in the
request.
|
Operation |
insertTargetTcpProxy(String project,
TargetTcpProxy targetTcpProxyResource)
Creates a TargetTcpProxy resource in the specified project using the data included in the
request.
|
UnaryCallable<InsertTargetTcpProxyHttpRequest,Operation> |
insertTargetTcpProxyCallable()
Creates a TargetTcpProxy resource in the specified project using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse |
listTargetTcpProxies(ListTargetTcpProxiesHttpRequest request)
Retrieves the list of TargetTcpProxy resources available to the specified project.
|
TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse |
listTargetTcpProxies(ProjectName project)
Retrieves the list of TargetTcpProxy resources available to the specified project.
|
TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse |
listTargetTcpProxies(String project)
Retrieves the list of TargetTcpProxy resources available to the specified project.
|
UnaryCallable<ListTargetTcpProxiesHttpRequest,TargetTcpProxyList> |
listTargetTcpProxiesCallable()
Retrieves the list of TargetTcpProxy resources available to the specified project.
|
UnaryCallable<ListTargetTcpProxiesHttpRequest,TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse> |
listTargetTcpProxiesPagedCallable()
Retrieves the list of TargetTcpProxy resources available to the specified project.
|
Operation |
setBackendServiceTargetTcpProxy(ProjectGlobalTargetTcpProxyName targetTcpProxy,
TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource)
Changes the BackendService for TargetTcpProxy.
|
Operation |
setBackendServiceTargetTcpProxy(SetBackendServiceTargetTcpProxyHttpRequest request)
Changes the BackendService for TargetTcpProxy.
|
Operation |
setBackendServiceTargetTcpProxy(String targetTcpProxy,
TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource)
Changes the BackendService for TargetTcpProxy.
|
UnaryCallable<SetBackendServiceTargetTcpProxyHttpRequest,Operation> |
setBackendServiceTargetTcpProxyCallable()
Changes the BackendService for TargetTcpProxy.
|
Operation |
setProxyHeaderTargetTcpProxy(ProjectGlobalTargetTcpProxyName targetTcpProxy,
TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource)
Changes the ProxyHeaderType for TargetTcpProxy.
|
Operation |
setProxyHeaderTargetTcpProxy(SetProxyHeaderTargetTcpProxyHttpRequest request)
Changes the ProxyHeaderType for TargetTcpProxy.
|
Operation |
setProxyHeaderTargetTcpProxy(String targetTcpProxy,
TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource)
Changes the ProxyHeaderType for TargetTcpProxy.
|
UnaryCallable<SetProxyHeaderTargetTcpProxyHttpRequest,Operation> |
setProxyHeaderTargetTcpProxyCallable()
Changes the ProxyHeaderType for TargetTcpProxy.
|
void |
shutdown() |
void |
shutdownNow() |
protected TargetTcpProxyClient(TargetTcpProxySettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected TargetTcpProxyClient(TargetTcpProxyStub stub)
public static final TargetTcpProxyClient create() throws IOException
IOException
public static final TargetTcpProxyClient create(TargetTcpProxySettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final TargetTcpProxyClient create(TargetTcpProxyStub stub)
public final TargetTcpProxySettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public TargetTcpProxyStub getStub()
@BetaApi public final Operation deleteTargetTcpProxy(ProjectGlobalTargetTcpProxyName targetTcpProxy)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
Operation response = targetTcpProxyClient.deleteTargetTcpProxy(targetTcpProxy);
}
targetTcpProxy
- Name of the TargetTcpProxy resource to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteTargetTcpProxy(String targetTcpProxy)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
Operation response = targetTcpProxyClient.deleteTargetTcpProxy(targetTcpProxy.toString());
}
targetTcpProxy
- Name of the TargetTcpProxy resource to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteTargetTcpProxy(DeleteTargetTcpProxyHttpRequest request)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedTargetTcpProxy = ProjectGlobalTargetTcpProxyName.format("[PROJECT]", "[TARGET_TCP_PROXY]");
DeleteTargetTcpProxyHttpRequest request = DeleteTargetTcpProxyHttpRequest.newBuilder()
.setTargetTcpProxy(formattedTargetTcpProxy)
.build();
Operation response = targetTcpProxyClient.deleteTargetTcpProxy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DeleteTargetTcpProxyHttpRequest,Operation> deleteTargetTcpProxyCallable()
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedTargetTcpProxy = ProjectGlobalTargetTcpProxyName.format("[PROJECT]", "[TARGET_TCP_PROXY]");
DeleteTargetTcpProxyHttpRequest request = DeleteTargetTcpProxyHttpRequest.newBuilder()
.setTargetTcpProxy(formattedTargetTcpProxy)
.build();
ApiFuture<Operation> future = targetTcpProxyClient.deleteTargetTcpProxyCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TargetTcpProxy getTargetTcpProxy(ProjectGlobalTargetTcpProxyName targetTcpProxy)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
TargetTcpProxy response = targetTcpProxyClient.getTargetTcpProxy(targetTcpProxy);
}
targetTcpProxy
- Name of the TargetTcpProxy resource to return.ApiException
- if the remote call fails@BetaApi public final TargetTcpProxy getTargetTcpProxy(String targetTcpProxy)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
TargetTcpProxy response = targetTcpProxyClient.getTargetTcpProxy(targetTcpProxy.toString());
}
targetTcpProxy
- Name of the TargetTcpProxy resource to return.ApiException
- if the remote call fails@BetaApi public final TargetTcpProxy getTargetTcpProxy(GetTargetTcpProxyHttpRequest request)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedTargetTcpProxy = ProjectGlobalTargetTcpProxyName.format("[PROJECT]", "[TARGET_TCP_PROXY]");
GetTargetTcpProxyHttpRequest request = GetTargetTcpProxyHttpRequest.newBuilder()
.setTargetTcpProxy(formattedTargetTcpProxy)
.build();
TargetTcpProxy response = targetTcpProxyClient.getTargetTcpProxy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetTargetTcpProxyHttpRequest,TargetTcpProxy> getTargetTcpProxyCallable()
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedTargetTcpProxy = ProjectGlobalTargetTcpProxyName.format("[PROJECT]", "[TARGET_TCP_PROXY]");
GetTargetTcpProxyHttpRequest request = GetTargetTcpProxyHttpRequest.newBuilder()
.setTargetTcpProxy(formattedTargetTcpProxy)
.build();
ApiFuture<TargetTcpProxy> future = targetTcpProxyClient.getTargetTcpProxyCallable().futureCall(request);
// Do something
TargetTcpProxy response = future.get();
}
@BetaApi public final Operation insertTargetTcpProxy(ProjectName project, TargetTcpProxy targetTcpProxyResource)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
TargetTcpProxy targetTcpProxyResource = TargetTcpProxy.newBuilder().build();
Operation response = targetTcpProxyClient.insertTargetTcpProxy(project, targetTcpProxyResource);
}
project
- Project ID for this request.targetTcpProxyResource
- A TargetTcpProxy resource. This resource defines a TCP proxy. (==
resource_for beta.targetTcpProxies ==) (== resource_for v1.targetTcpProxies ==)ApiException
- if the remote call fails@BetaApi public final Operation insertTargetTcpProxy(String project, TargetTcpProxy targetTcpProxyResource)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
TargetTcpProxy targetTcpProxyResource = TargetTcpProxy.newBuilder().build();
Operation response = targetTcpProxyClient.insertTargetTcpProxy(project.toString(), targetTcpProxyResource);
}
project
- Project ID for this request.targetTcpProxyResource
- A TargetTcpProxy resource. This resource defines a TCP proxy. (==
resource_for beta.targetTcpProxies ==) (== resource_for v1.targetTcpProxies ==)ApiException
- if the remote call fails@BetaApi public final Operation insertTargetTcpProxy(InsertTargetTcpProxyHttpRequest request)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
TargetTcpProxy targetTcpProxyResource = TargetTcpProxy.newBuilder().build();
InsertTargetTcpProxyHttpRequest request = InsertTargetTcpProxyHttpRequest.newBuilder()
.setProject(formattedProject)
.setTargetTcpProxyResource(targetTcpProxyResource)
.build();
Operation response = targetTcpProxyClient.insertTargetTcpProxy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<InsertTargetTcpProxyHttpRequest,Operation> insertTargetTcpProxyCallable()
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
TargetTcpProxy targetTcpProxyResource = TargetTcpProxy.newBuilder().build();
InsertTargetTcpProxyHttpRequest request = InsertTargetTcpProxyHttpRequest.newBuilder()
.setProject(formattedProject)
.setTargetTcpProxyResource(targetTcpProxyResource)
.build();
ApiFuture<Operation> future = targetTcpProxyClient.insertTargetTcpProxyCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse listTargetTcpProxies(ProjectName project)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (TargetTcpProxy element : targetTcpProxyClient.listTargetTcpProxies(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse listTargetTcpProxies(String project)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (TargetTcpProxy element : targetTcpProxyClient.listTargetTcpProxies(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse listTargetTcpProxies(ListTargetTcpProxiesHttpRequest request)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListTargetTcpProxiesHttpRequest request = ListTargetTcpProxiesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (TargetTcpProxy element : targetTcpProxyClient.listTargetTcpProxies(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<ListTargetTcpProxiesHttpRequest,TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse> listTargetTcpProxiesPagedCallable()
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListTargetTcpProxiesHttpRequest request = ListTargetTcpProxiesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListTargetTcpProxiesPagedResponse> future = targetTcpProxyClient.listTargetTcpProxiesPagedCallable().futureCall(request);
// Do something
for (TargetTcpProxy element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<ListTargetTcpProxiesHttpRequest,TargetTcpProxyList> listTargetTcpProxiesCallable()
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListTargetTcpProxiesHttpRequest request = ListTargetTcpProxiesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
TargetTcpProxyList response = targetTcpProxyClient.listTargetTcpProxiesCallable().call(request);
for (TargetTcpProxy 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 setBackendServiceTargetTcpProxy(ProjectGlobalTargetTcpProxyName targetTcpProxy, TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource = TargetTcpProxiesSetBackendServiceRequest.newBuilder().build();
Operation response = targetTcpProxyClient.setBackendServiceTargetTcpProxy(targetTcpProxy, targetTcpProxiesSetBackendServiceRequestResource);
}
targetTcpProxy
- Name of the TargetTcpProxy resource whose BackendService resource is to
be set.targetTcpProxiesSetBackendServiceRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation setBackendServiceTargetTcpProxy(String targetTcpProxy, TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource = TargetTcpProxiesSetBackendServiceRequest.newBuilder().build();
Operation response = targetTcpProxyClient.setBackendServiceTargetTcpProxy(targetTcpProxy.toString(), targetTcpProxiesSetBackendServiceRequestResource);
}
targetTcpProxy
- Name of the TargetTcpProxy resource whose BackendService resource is to
be set.targetTcpProxiesSetBackendServiceRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation setBackendServiceTargetTcpProxy(SetBackendServiceTargetTcpProxyHttpRequest request)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedTargetTcpProxy = ProjectGlobalTargetTcpProxyName.format("[PROJECT]", "[TARGET_TCP_PROXY]");
TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource = TargetTcpProxiesSetBackendServiceRequest.newBuilder().build();
SetBackendServiceTargetTcpProxyHttpRequest request = SetBackendServiceTargetTcpProxyHttpRequest.newBuilder()
.setTargetTcpProxy(formattedTargetTcpProxy)
.setTargetTcpProxiesSetBackendServiceRequestResource(targetTcpProxiesSetBackendServiceRequestResource)
.build();
Operation response = targetTcpProxyClient.setBackendServiceTargetTcpProxy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<SetBackendServiceTargetTcpProxyHttpRequest,Operation> setBackendServiceTargetTcpProxyCallable()
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedTargetTcpProxy = ProjectGlobalTargetTcpProxyName.format("[PROJECT]", "[TARGET_TCP_PROXY]");
TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource = TargetTcpProxiesSetBackendServiceRequest.newBuilder().build();
SetBackendServiceTargetTcpProxyHttpRequest request = SetBackendServiceTargetTcpProxyHttpRequest.newBuilder()
.setTargetTcpProxy(formattedTargetTcpProxy)
.setTargetTcpProxiesSetBackendServiceRequestResource(targetTcpProxiesSetBackendServiceRequestResource)
.build();
ApiFuture<Operation> future = targetTcpProxyClient.setBackendServiceTargetTcpProxyCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setProxyHeaderTargetTcpProxy(ProjectGlobalTargetTcpProxyName targetTcpProxy, TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource = TargetTcpProxiesSetProxyHeaderRequest.newBuilder().build();
Operation response = targetTcpProxyClient.setProxyHeaderTargetTcpProxy(targetTcpProxy, targetTcpProxiesSetProxyHeaderRequestResource);
}
targetTcpProxy
- Name of the TargetTcpProxy resource whose ProxyHeader is to be set.targetTcpProxiesSetProxyHeaderRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation setProxyHeaderTargetTcpProxy(String targetTcpProxy, TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource = TargetTcpProxiesSetProxyHeaderRequest.newBuilder().build();
Operation response = targetTcpProxyClient.setProxyHeaderTargetTcpProxy(targetTcpProxy.toString(), targetTcpProxiesSetProxyHeaderRequestResource);
}
targetTcpProxy
- Name of the TargetTcpProxy resource whose ProxyHeader is to be set.targetTcpProxiesSetProxyHeaderRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation setProxyHeaderTargetTcpProxy(SetProxyHeaderTargetTcpProxyHttpRequest request)
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedTargetTcpProxy = ProjectGlobalTargetTcpProxyName.format("[PROJECT]", "[TARGET_TCP_PROXY]");
TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource = TargetTcpProxiesSetProxyHeaderRequest.newBuilder().build();
SetProxyHeaderTargetTcpProxyHttpRequest request = SetProxyHeaderTargetTcpProxyHttpRequest.newBuilder()
.setTargetTcpProxy(formattedTargetTcpProxy)
.setTargetTcpProxiesSetProxyHeaderRequestResource(targetTcpProxiesSetProxyHeaderRequestResource)
.build();
Operation response = targetTcpProxyClient.setProxyHeaderTargetTcpProxy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<SetProxyHeaderTargetTcpProxyHttpRequest,Operation> setProxyHeaderTargetTcpProxyCallable()
Sample code:
try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
String formattedTargetTcpProxy = ProjectGlobalTargetTcpProxyName.format("[PROJECT]", "[TARGET_TCP_PROXY]");
TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource = TargetTcpProxiesSetProxyHeaderRequest.newBuilder().build();
SetProxyHeaderTargetTcpProxyHttpRequest request = SetProxyHeaderTargetTcpProxyHttpRequest.newBuilder()
.setTargetTcpProxy(formattedTargetTcpProxy)
.setTargetTcpProxiesSetProxyHeaderRequestResource(targetTcpProxiesSetProxyHeaderRequestResource)
.build();
ApiFuture<Operation> future = targetTcpProxyClient.setProxyHeaderTargetTcpProxyCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.