@Generated(value="by gapic-generator") @BetaApi public class TargetHttpProxyClient 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 (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
Operation response = targetHttpProxyClient.deleteTargetHttpProxy(targetHttpProxy);
}
Note: close() needs to be called on the targetHttpProxyClient 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 TargetHttpProxySettings to create(). For example:
To customize credentials:
TargetHttpProxySettings targetHttpProxySettings =
TargetHttpProxySettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
TargetHttpProxyClient targetHttpProxyClient =
TargetHttpProxyClient.create(targetHttpProxySettings);
To customize the endpoint:
TargetHttpProxySettings targetHttpProxySettings =
TargetHttpProxySettings.newBuilder().setEndpoint(myEndpoint).build();
TargetHttpProxyClient targetHttpProxyClient =
TargetHttpProxyClient.create(targetHttpProxySettings);
Modifier and Type | Class and Description |
---|---|
static class |
TargetHttpProxyClient.ListTargetHttpProxiesFixedSizeCollection |
static class |
TargetHttpProxyClient.ListTargetHttpProxiesPage |
static class |
TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
TargetHttpProxyClient(TargetHttpProxySettings settings)
Constructs an instance of TargetHttpProxyClient, using the given settings.
|
protected |
TargetHttpProxyClient(TargetHttpProxyStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static TargetHttpProxyClient |
create()
Constructs an instance of TargetHttpProxyClient with default settings.
|
static TargetHttpProxyClient |
create(TargetHttpProxySettings settings)
Constructs an instance of TargetHttpProxyClient, using the given settings.
|
static TargetHttpProxyClient |
create(TargetHttpProxyStub stub)
Constructs an instance of TargetHttpProxyClient, using the given stub for making calls.
|
Operation |
deleteTargetHttpProxy(DeleteTargetHttpProxyHttpRequest request)
Deletes the specified TargetHttpProxy resource.
|
Operation |
deleteTargetHttpProxy(ProjectGlobalTargetHttpProxyName targetHttpProxy)
Deletes the specified TargetHttpProxy resource.
|
Operation |
deleteTargetHttpProxy(String targetHttpProxy)
Deletes the specified TargetHttpProxy resource.
|
UnaryCallable<DeleteTargetHttpProxyHttpRequest,Operation> |
deleteTargetHttpProxyCallable()
Deletes the specified TargetHttpProxy resource.
|
TargetHttpProxySettings |
getSettings() |
TargetHttpProxyStub |
getStub() |
TargetHttpProxy |
getTargetHttpProxy(GetTargetHttpProxyHttpRequest request)
Returns the specified TargetHttpProxy resource.
|
TargetHttpProxy |
getTargetHttpProxy(ProjectGlobalTargetHttpProxyName targetHttpProxy)
Returns the specified TargetHttpProxy resource.
|
TargetHttpProxy |
getTargetHttpProxy(String targetHttpProxy)
Returns the specified TargetHttpProxy resource.
|
UnaryCallable<GetTargetHttpProxyHttpRequest,TargetHttpProxy> |
getTargetHttpProxyCallable()
Returns the specified TargetHttpProxy resource.
|
Operation |
insertTargetHttpProxy(InsertTargetHttpProxyHttpRequest request)
Creates a TargetHttpProxy resource in the specified project using the data included in the
request.
|
Operation |
insertTargetHttpProxy(ProjectName project,
TargetHttpProxy targetHttpProxyResource)
Creates a TargetHttpProxy resource in the specified project using the data included in the
request.
|
Operation |
insertTargetHttpProxy(String project,
TargetHttpProxy targetHttpProxyResource)
Creates a TargetHttpProxy resource in the specified project using the data included in the
request.
|
UnaryCallable<InsertTargetHttpProxyHttpRequest,Operation> |
insertTargetHttpProxyCallable()
Creates a TargetHttpProxy resource in the specified project using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse |
listTargetHttpProxies(ListTargetHttpProxiesHttpRequest request)
Retrieves the list of TargetHttpProxy resources available to the specified project.
|
TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse |
listTargetHttpProxies(ProjectName project)
Retrieves the list of TargetHttpProxy resources available to the specified project.
|
TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse |
listTargetHttpProxies(String project)
Retrieves the list of TargetHttpProxy resources available to the specified project.
|
UnaryCallable<ListTargetHttpProxiesHttpRequest,TargetHttpProxyList> |
listTargetHttpProxiesCallable()
Retrieves the list of TargetHttpProxy resources available to the specified project.
|
UnaryCallable<ListTargetHttpProxiesHttpRequest,TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse> |
listTargetHttpProxiesPagedCallable()
Retrieves the list of TargetHttpProxy resources available to the specified project.
|
Operation |
setUrlMapTargetHttpProxy(ProjectTargetHttpProxyName targetHttpProxy,
UrlMapReference urlMapReferenceResource)
Changes the URL map for TargetHttpProxy.
|
Operation |
setUrlMapTargetHttpProxy(SetUrlMapTargetHttpProxyHttpRequest request)
Changes the URL map for TargetHttpProxy.
|
Operation |
setUrlMapTargetHttpProxy(String targetHttpProxy,
UrlMapReference urlMapReferenceResource)
Changes the URL map for TargetHttpProxy.
|
UnaryCallable<SetUrlMapTargetHttpProxyHttpRequest,Operation> |
setUrlMapTargetHttpProxyCallable()
Changes the URL map for TargetHttpProxy.
|
void |
shutdown() |
void |
shutdownNow() |
protected TargetHttpProxyClient(TargetHttpProxySettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected TargetHttpProxyClient(TargetHttpProxyStub stub)
public static final TargetHttpProxyClient create() throws IOException
IOException
public static final TargetHttpProxyClient create(TargetHttpProxySettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final TargetHttpProxyClient create(TargetHttpProxyStub stub)
public final TargetHttpProxySettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public TargetHttpProxyStub getStub()
@BetaApi public final Operation deleteTargetHttpProxy(ProjectGlobalTargetHttpProxyName targetHttpProxy)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
Operation response = targetHttpProxyClient.deleteTargetHttpProxy(targetHttpProxy);
}
targetHttpProxy
- Name of the TargetHttpProxy resource to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteTargetHttpProxy(String targetHttpProxy)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
Operation response = targetHttpProxyClient.deleteTargetHttpProxy(targetHttpProxy.toString());
}
targetHttpProxy
- Name of the TargetHttpProxy resource to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteTargetHttpProxy(DeleteTargetHttpProxyHttpRequest request)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
String formattedTargetHttpProxy = ProjectGlobalTargetHttpProxyName.format("[PROJECT]", "[TARGET_HTTP_PROXY]");
DeleteTargetHttpProxyHttpRequest request = DeleteTargetHttpProxyHttpRequest.newBuilder()
.setTargetHttpProxy(formattedTargetHttpProxy)
.build();
Operation response = targetHttpProxyClient.deleteTargetHttpProxy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DeleteTargetHttpProxyHttpRequest,Operation> deleteTargetHttpProxyCallable()
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
String formattedTargetHttpProxy = ProjectGlobalTargetHttpProxyName.format("[PROJECT]", "[TARGET_HTTP_PROXY]");
DeleteTargetHttpProxyHttpRequest request = DeleteTargetHttpProxyHttpRequest.newBuilder()
.setTargetHttpProxy(formattedTargetHttpProxy)
.build();
ApiFuture<Operation> future = targetHttpProxyClient.deleteTargetHttpProxyCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TargetHttpProxy getTargetHttpProxy(ProjectGlobalTargetHttpProxyName targetHttpProxy)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
TargetHttpProxy response = targetHttpProxyClient.getTargetHttpProxy(targetHttpProxy);
}
targetHttpProxy
- Name of the TargetHttpProxy resource to return.ApiException
- if the remote call fails@BetaApi public final TargetHttpProxy getTargetHttpProxy(String targetHttpProxy)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
TargetHttpProxy response = targetHttpProxyClient.getTargetHttpProxy(targetHttpProxy.toString());
}
targetHttpProxy
- Name of the TargetHttpProxy resource to return.ApiException
- if the remote call fails@BetaApi public final TargetHttpProxy getTargetHttpProxy(GetTargetHttpProxyHttpRequest request)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
String formattedTargetHttpProxy = ProjectGlobalTargetHttpProxyName.format("[PROJECT]", "[TARGET_HTTP_PROXY]");
GetTargetHttpProxyHttpRequest request = GetTargetHttpProxyHttpRequest.newBuilder()
.setTargetHttpProxy(formattedTargetHttpProxy)
.build();
TargetHttpProxy response = targetHttpProxyClient.getTargetHttpProxy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetTargetHttpProxyHttpRequest,TargetHttpProxy> getTargetHttpProxyCallable()
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
String formattedTargetHttpProxy = ProjectGlobalTargetHttpProxyName.format("[PROJECT]", "[TARGET_HTTP_PROXY]");
GetTargetHttpProxyHttpRequest request = GetTargetHttpProxyHttpRequest.newBuilder()
.setTargetHttpProxy(formattedTargetHttpProxy)
.build();
ApiFuture<TargetHttpProxy> future = targetHttpProxyClient.getTargetHttpProxyCallable().futureCall(request);
// Do something
TargetHttpProxy response = future.get();
}
@BetaApi public final Operation insertTargetHttpProxy(ProjectName project, TargetHttpProxy targetHttpProxyResource)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
TargetHttpProxy targetHttpProxyResource = TargetHttpProxy.newBuilder().build();
Operation response = targetHttpProxyClient.insertTargetHttpProxy(project, targetHttpProxyResource);
}
project
- Project ID for this request.targetHttpProxyResource
- A TargetHttpProxy resource. This resource defines an HTTP proxy.
(== resource_for beta.targetHttpProxies ==) (== resource_for v1.targetHttpProxies ==)ApiException
- if the remote call fails@BetaApi public final Operation insertTargetHttpProxy(String project, TargetHttpProxy targetHttpProxyResource)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
TargetHttpProxy targetHttpProxyResource = TargetHttpProxy.newBuilder().build();
Operation response = targetHttpProxyClient.insertTargetHttpProxy(project.toString(), targetHttpProxyResource);
}
project
- Project ID for this request.targetHttpProxyResource
- A TargetHttpProxy resource. This resource defines an HTTP proxy.
(== resource_for beta.targetHttpProxies ==) (== resource_for v1.targetHttpProxies ==)ApiException
- if the remote call fails@BetaApi public final Operation insertTargetHttpProxy(InsertTargetHttpProxyHttpRequest request)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
TargetHttpProxy targetHttpProxyResource = TargetHttpProxy.newBuilder().build();
InsertTargetHttpProxyHttpRequest request = InsertTargetHttpProxyHttpRequest.newBuilder()
.setProject(formattedProject)
.setTargetHttpProxyResource(targetHttpProxyResource)
.build();
Operation response = targetHttpProxyClient.insertTargetHttpProxy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<InsertTargetHttpProxyHttpRequest,Operation> insertTargetHttpProxyCallable()
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
TargetHttpProxy targetHttpProxyResource = TargetHttpProxy.newBuilder().build();
InsertTargetHttpProxyHttpRequest request = InsertTargetHttpProxyHttpRequest.newBuilder()
.setProject(formattedProject)
.setTargetHttpProxyResource(targetHttpProxyResource)
.build();
ApiFuture<Operation> future = targetHttpProxyClient.insertTargetHttpProxyCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse listTargetHttpProxies(ProjectName project)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (TargetHttpProxy element : targetHttpProxyClient.listTargetHttpProxies(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse listTargetHttpProxies(String project)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (TargetHttpProxy element : targetHttpProxyClient.listTargetHttpProxies(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse listTargetHttpProxies(ListTargetHttpProxiesHttpRequest request)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListTargetHttpProxiesHttpRequest request = ListTargetHttpProxiesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (TargetHttpProxy element : targetHttpProxyClient.listTargetHttpProxies(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<ListTargetHttpProxiesHttpRequest,TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse> listTargetHttpProxiesPagedCallable()
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListTargetHttpProxiesHttpRequest request = ListTargetHttpProxiesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListTargetHttpProxiesPagedResponse> future = targetHttpProxyClient.listTargetHttpProxiesPagedCallable().futureCall(request);
// Do something
for (TargetHttpProxy element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<ListTargetHttpProxiesHttpRequest,TargetHttpProxyList> listTargetHttpProxiesCallable()
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListTargetHttpProxiesHttpRequest request = ListTargetHttpProxiesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
TargetHttpProxyList response = targetHttpProxyClient.listTargetHttpProxiesCallable().call(request);
for (TargetHttpProxy 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 setUrlMapTargetHttpProxy(ProjectTargetHttpProxyName targetHttpProxy, UrlMapReference urlMapReferenceResource)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
ProjectTargetHttpProxyName targetHttpProxy = ProjectTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
Operation response = targetHttpProxyClient.setUrlMapTargetHttpProxy(targetHttpProxy, urlMapReferenceResource);
}
targetHttpProxy
- Name of the TargetHttpProxy to set a URL map for.urlMapReferenceResource
- ApiException
- if the remote call fails@BetaApi public final Operation setUrlMapTargetHttpProxy(String targetHttpProxy, UrlMapReference urlMapReferenceResource)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
ProjectTargetHttpProxyName targetHttpProxy = ProjectTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
Operation response = targetHttpProxyClient.setUrlMapTargetHttpProxy(targetHttpProxy.toString(), urlMapReferenceResource);
}
targetHttpProxy
- Name of the TargetHttpProxy to set a URL map for.urlMapReferenceResource
- ApiException
- if the remote call fails@BetaApi public final Operation setUrlMapTargetHttpProxy(SetUrlMapTargetHttpProxyHttpRequest request)
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
String formattedTargetHttpProxy = ProjectTargetHttpProxyName.format("[PROJECT]", "[TARGET_HTTP_PROXY]");
UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
SetUrlMapTargetHttpProxyHttpRequest request = SetUrlMapTargetHttpProxyHttpRequest.newBuilder()
.setTargetHttpProxy(formattedTargetHttpProxy)
.setUrlMapReferenceResource(urlMapReferenceResource)
.build();
Operation response = targetHttpProxyClient.setUrlMapTargetHttpProxy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<SetUrlMapTargetHttpProxyHttpRequest,Operation> setUrlMapTargetHttpProxyCallable()
Sample code:
try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
String formattedTargetHttpProxy = ProjectTargetHttpProxyName.format("[PROJECT]", "[TARGET_HTTP_PROXY]");
UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
SetUrlMapTargetHttpProxyHttpRequest request = SetUrlMapTargetHttpProxyHttpRequest.newBuilder()
.setTargetHttpProxy(formattedTargetHttpProxy)
.setUrlMapReferenceResource(urlMapReferenceResource)
.build();
ApiFuture<Operation> future = targetHttpProxyClient.setUrlMapTargetHttpProxyCallable().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.