@Generated(value="by gapic-generator") @BetaApi public class UrlMapClient 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 (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
Operation response = urlMapClient.deleteUrlMap(urlMap);
}
Note: close() needs to be called on the urlMapClient 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 UrlMapSettings to create(). For example:
To customize credentials:
UrlMapSettings urlMapSettings =
UrlMapSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
UrlMapClient urlMapClient =
UrlMapClient.create(urlMapSettings);
To customize the endpoint:
UrlMapSettings urlMapSettings =
UrlMapSettings.newBuilder().setEndpoint(myEndpoint).build();
UrlMapClient urlMapClient =
UrlMapClient.create(urlMapSettings);
Modifier and Type | Class and Description |
---|---|
static class |
UrlMapClient.AggregatedListUrlMapsFixedSizeCollection |
static class |
UrlMapClient.AggregatedListUrlMapsPage |
static class |
UrlMapClient.AggregatedListUrlMapsPagedResponse |
static class |
UrlMapClient.ListUrlMapsFixedSizeCollection |
static class |
UrlMapClient.ListUrlMapsPage |
static class |
UrlMapClient.ListUrlMapsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
UrlMapClient(UrlMapSettings settings)
Constructs an instance of UrlMapClient, using the given settings.
|
protected |
UrlMapClient(UrlMapStub stub) |
Modifier and Type | Method and Description |
---|---|
UrlMapClient.AggregatedListUrlMapsPagedResponse |
aggregatedListUrlMaps(AggregatedListUrlMapsHttpRequest request)
Retrieves the list of all UrlMap resources, regional and global, available to the specified
project.
|
UrlMapClient.AggregatedListUrlMapsPagedResponse |
aggregatedListUrlMaps(ProjectName project)
Retrieves the list of all UrlMap resources, regional and global, available to the specified
project.
|
UrlMapClient.AggregatedListUrlMapsPagedResponse |
aggregatedListUrlMaps(String project)
Retrieves the list of all UrlMap resources, regional and global, available to the specified
project.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListUrlMapsHttpRequest,UrlMapsAggregatedList> |
aggregatedListUrlMapsCallable()
Retrieves the list of all UrlMap resources, regional and global, available to the specified
project.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListUrlMapsHttpRequest,UrlMapClient.AggregatedListUrlMapsPagedResponse> |
aggregatedListUrlMapsPagedCallable()
Retrieves the list of all UrlMap resources, regional and global, available to the specified
project.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static UrlMapClient |
create()
Constructs an instance of UrlMapClient with default settings.
|
static UrlMapClient |
create(UrlMapSettings settings)
Constructs an instance of UrlMapClient, using the given settings.
|
static UrlMapClient |
create(UrlMapStub stub)
Constructs an instance of UrlMapClient, using the given stub for making calls.
|
Operation |
deleteUrlMap(DeleteUrlMapHttpRequest request)
Deletes the specified UrlMap resource.
|
Operation |
deleteUrlMap(ProjectGlobalUrlMapName urlMap)
Deletes the specified UrlMap resource.
|
Operation |
deleteUrlMap(String urlMap)
Deletes the specified UrlMap resource.
|
com.google.api.gax.rpc.UnaryCallable<DeleteUrlMapHttpRequest,Operation> |
deleteUrlMapCallable()
Deletes the specified UrlMap resource.
|
UrlMapSettings |
getSettings() |
UrlMapStub |
getStub() |
UrlMap |
getUrlMap(GetUrlMapHttpRequest request)
Returns the specified UrlMap resource.
|
UrlMap |
getUrlMap(ProjectGlobalUrlMapName urlMap)
Returns the specified UrlMap resource.
|
UrlMap |
getUrlMap(String urlMap)
Returns the specified UrlMap resource.
|
com.google.api.gax.rpc.UnaryCallable<GetUrlMapHttpRequest,UrlMap> |
getUrlMapCallable()
Returns the specified UrlMap resource.
|
Operation |
insertUrlMap(InsertUrlMapHttpRequest request)
Creates a UrlMap resource in the specified project using the data included in the request.
|
Operation |
insertUrlMap(ProjectName project,
UrlMap urlMapResource)
Creates a UrlMap resource in the specified project using the data included in the request.
|
Operation |
insertUrlMap(String project,
UrlMap urlMapResource)
Creates a UrlMap resource in the specified project using the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<InsertUrlMapHttpRequest,Operation> |
insertUrlMapCallable()
Creates a UrlMap resource in the specified project using the data included in the request.
|
Operation |
invalidateCacheUrlMap(InvalidateCacheUrlMapHttpRequest request)
Initiates a cache invalidation operation, invalidating the specified path, scoped to the
specified UrlMap.
|
Operation |
invalidateCacheUrlMap(ProjectGlobalUrlMapName urlMap,
CacheInvalidationRule cacheInvalidationRuleResource)
Initiates a cache invalidation operation, invalidating the specified path, scoped to the
specified UrlMap.
|
Operation |
invalidateCacheUrlMap(String urlMap,
CacheInvalidationRule cacheInvalidationRuleResource)
Initiates a cache invalidation operation, invalidating the specified path, scoped to the
specified UrlMap.
|
com.google.api.gax.rpc.UnaryCallable<InvalidateCacheUrlMapHttpRequest,Operation> |
invalidateCacheUrlMapCallable()
Initiates a cache invalidation operation, invalidating the specified path, scoped to the
specified UrlMap.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
UrlMapClient.ListUrlMapsPagedResponse |
listUrlMaps(ListUrlMapsHttpRequest request)
Retrieves the list of UrlMap resources available to the specified project.
|
UrlMapClient.ListUrlMapsPagedResponse |
listUrlMaps(ProjectName project)
Retrieves the list of UrlMap resources available to the specified project.
|
UrlMapClient.ListUrlMapsPagedResponse |
listUrlMaps(String project)
Retrieves the list of UrlMap resources available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListUrlMapsHttpRequest,UrlMapList> |
listUrlMapsCallable()
Retrieves the list of UrlMap resources available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListUrlMapsHttpRequest,UrlMapClient.ListUrlMapsPagedResponse> |
listUrlMapsPagedCallable()
Retrieves the list of UrlMap resources available to the specified project.
|
Operation |
patchUrlMap(PatchUrlMapHttpRequest request)
Patches the specified UrlMap resource with the data included in the request.
|
Operation |
patchUrlMap(ProjectGlobalUrlMapName urlMap,
UrlMap urlMapResource,
List<String> fieldMask)
Patches the specified UrlMap resource with the data included in the request.
|
Operation |
patchUrlMap(String urlMap,
UrlMap urlMapResource,
List<String> fieldMask)
Patches the specified UrlMap resource with the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<PatchUrlMapHttpRequest,Operation> |
patchUrlMapCallable()
Patches the specified UrlMap resource with the data included in the request.
|
void |
shutdown() |
void |
shutdownNow() |
Operation |
updateUrlMap(ProjectGlobalUrlMapName urlMap,
UrlMap urlMapResource,
List<String> fieldMask)
Updates the specified UrlMap resource with the data included in the request.
|
Operation |
updateUrlMap(String urlMap,
UrlMap urlMapResource,
List<String> fieldMask)
Updates the specified UrlMap resource with the data included in the request.
|
Operation |
updateUrlMap(UpdateUrlMapHttpRequest request)
Updates the specified UrlMap resource with the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<UpdateUrlMapHttpRequest,Operation> |
updateUrlMapCallable()
Updates the specified UrlMap resource with the data included in the request.
|
UrlMapsValidateResponse |
validateUrlMap(ProjectGlobalUrlMapName urlMap,
UrlMapsValidateRequest urlMapsValidateRequestResource)
Runs static validation for the UrlMap.
|
UrlMapsValidateResponse |
validateUrlMap(String urlMap,
UrlMapsValidateRequest urlMapsValidateRequestResource)
Runs static validation for the UrlMap.
|
UrlMapsValidateResponse |
validateUrlMap(ValidateUrlMapHttpRequest request)
Runs static validation for the UrlMap.
|
com.google.api.gax.rpc.UnaryCallable<ValidateUrlMapHttpRequest,UrlMapsValidateResponse> |
validateUrlMapCallable()
Runs static validation for the UrlMap.
|
protected UrlMapClient(UrlMapSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected UrlMapClient(UrlMapStub stub)
public static final UrlMapClient create() throws IOException
IOException
public static final UrlMapClient create(UrlMapSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final UrlMapClient create(UrlMapStub stub)
public final UrlMapSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public UrlMapStub getStub()
@BetaApi public final UrlMapClient.AggregatedListUrlMapsPagedResponse aggregatedListUrlMaps(ProjectName project)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (UrlMapsScopedList element : urlMapClient.aggregatedListUrlMaps(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Name of the project scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final UrlMapClient.AggregatedListUrlMapsPagedResponse aggregatedListUrlMaps(String project)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (UrlMapsScopedList element : urlMapClient.aggregatedListUrlMaps(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Name of the project scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final UrlMapClient.AggregatedListUrlMapsPagedResponse aggregatedListUrlMaps(AggregatedListUrlMapsHttpRequest request)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListUrlMapsHttpRequest request = AggregatedListUrlMapsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (UrlMapsScopedList element : urlMapClient.aggregatedListUrlMaps(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<AggregatedListUrlMapsHttpRequest,UrlMapClient.AggregatedListUrlMapsPagedResponse> aggregatedListUrlMapsPagedCallable()
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListUrlMapsHttpRequest request = AggregatedListUrlMapsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListUrlMapsPagedResponse> future = urlMapClient.aggregatedListUrlMapsPagedCallable().futureCall(request);
// Do something
for (UrlMapsScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListUrlMapsHttpRequest,UrlMapsAggregatedList> aggregatedListUrlMapsCallable()
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListUrlMapsHttpRequest request = AggregatedListUrlMapsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
UrlMapsAggregatedList response = urlMapClient.aggregatedListUrlMapsCallable().call(request);
for (UrlMapsScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation deleteUrlMap(ProjectGlobalUrlMapName urlMap)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
Operation response = urlMapClient.deleteUrlMap(urlMap);
}
urlMap
- Name of the UrlMap resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteUrlMap(String urlMap)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
Operation response = urlMapClient.deleteUrlMap(urlMap.toString());
}
urlMap
- Name of the UrlMap resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteUrlMap(DeleteUrlMapHttpRequest request)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
DeleteUrlMapHttpRequest request = DeleteUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.build();
Operation response = urlMapClient.deleteUrlMap(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<DeleteUrlMapHttpRequest,Operation> deleteUrlMapCallable()
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
DeleteUrlMapHttpRequest request = DeleteUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.build();
ApiFuture<Operation> future = urlMapClient.deleteUrlMapCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final UrlMap getUrlMap(ProjectGlobalUrlMapName urlMap)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
UrlMap response = urlMapClient.getUrlMap(urlMap);
}
urlMap
- Name of the UrlMap resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final UrlMap getUrlMap(String urlMap)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
UrlMap response = urlMapClient.getUrlMap(urlMap.toString());
}
urlMap
- Name of the UrlMap resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final UrlMap getUrlMap(GetUrlMapHttpRequest request)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
GetUrlMapHttpRequest request = GetUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.build();
UrlMap response = urlMapClient.getUrlMap(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<GetUrlMapHttpRequest,UrlMap> getUrlMapCallable()
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
GetUrlMapHttpRequest request = GetUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.build();
ApiFuture<UrlMap> future = urlMapClient.getUrlMapCallable().futureCall(request);
// Do something
UrlMap response = future.get();
}
@BetaApi public final Operation insertUrlMap(ProjectName project, UrlMap urlMapResource)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
Operation response = urlMapClient.insertUrlMap(project, urlMapResource);
}
project
- Project ID for this request.urlMapResource
- Represents a URL Map resource.
A URL map resource is a component of certain types of load balancers. This resource defines mappings from host names and URL paths to either a backend service or a backend bucket.
To use this resource, the backend service must have a loadBalancingScheme of either EXTERNAL, INTERNAL_SELF_MANAGED, or INTERNAL_MANAGED For more information, read URL Map Concepts.
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertUrlMap(String project, UrlMap urlMapResource)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
Operation response = urlMapClient.insertUrlMap(project.toString(), urlMapResource);
}
project
- Project ID for this request.urlMapResource
- Represents a URL Map resource.
A URL map resource is a component of certain types of load balancers. This resource defines mappings from host names and URL paths to either a backend service or a backend bucket.
To use this resource, the backend service must have a loadBalancingScheme of either EXTERNAL, INTERNAL_SELF_MANAGED, or INTERNAL_MANAGED For more information, read URL Map Concepts.
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertUrlMap(InsertUrlMapHttpRequest request)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
InsertUrlMapHttpRequest request = InsertUrlMapHttpRequest.newBuilder()
.setProject(formattedProject)
.setUrlMapResource(urlMapResource)
.build();
Operation response = urlMapClient.insertUrlMap(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<InsertUrlMapHttpRequest,Operation> insertUrlMapCallable()
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
InsertUrlMapHttpRequest request = InsertUrlMapHttpRequest.newBuilder()
.setProject(formattedProject)
.setUrlMapResource(urlMapResource)
.build();
ApiFuture<Operation> future = urlMapClient.insertUrlMapCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation invalidateCacheUrlMap(ProjectGlobalUrlMapName urlMap, CacheInvalidationRule cacheInvalidationRuleResource)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
CacheInvalidationRule cacheInvalidationRuleResource = CacheInvalidationRule.newBuilder().build();
Operation response = urlMapClient.invalidateCacheUrlMap(urlMap, cacheInvalidationRuleResource);
}
urlMap
- Name of the UrlMap scoping this request.cacheInvalidationRuleResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation invalidateCacheUrlMap(String urlMap, CacheInvalidationRule cacheInvalidationRuleResource)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
CacheInvalidationRule cacheInvalidationRuleResource = CacheInvalidationRule.newBuilder().build();
Operation response = urlMapClient.invalidateCacheUrlMap(urlMap.toString(), cacheInvalidationRuleResource);
}
urlMap
- Name of the UrlMap scoping this request.cacheInvalidationRuleResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation invalidateCacheUrlMap(InvalidateCacheUrlMapHttpRequest request)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
CacheInvalidationRule cacheInvalidationRuleResource = CacheInvalidationRule.newBuilder().build();
InvalidateCacheUrlMapHttpRequest request = InvalidateCacheUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.setCacheInvalidationRuleResource(cacheInvalidationRuleResource)
.build();
Operation response = urlMapClient.invalidateCacheUrlMap(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<InvalidateCacheUrlMapHttpRequest,Operation> invalidateCacheUrlMapCallable()
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
CacheInvalidationRule cacheInvalidationRuleResource = CacheInvalidationRule.newBuilder().build();
InvalidateCacheUrlMapHttpRequest request = InvalidateCacheUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.setCacheInvalidationRuleResource(cacheInvalidationRuleResource)
.build();
ApiFuture<Operation> future = urlMapClient.invalidateCacheUrlMapCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final UrlMapClient.ListUrlMapsPagedResponse listUrlMaps(ProjectName project)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (UrlMap element : urlMapClient.listUrlMaps(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final UrlMapClient.ListUrlMapsPagedResponse listUrlMaps(String project)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (UrlMap element : urlMapClient.listUrlMaps(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 UrlMapClient.ListUrlMapsPagedResponse listUrlMaps(ListUrlMapsHttpRequest request)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListUrlMapsHttpRequest request = ListUrlMapsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (UrlMap element : urlMapClient.listUrlMaps(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<ListUrlMapsHttpRequest,UrlMapClient.ListUrlMapsPagedResponse> listUrlMapsPagedCallable()
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListUrlMapsHttpRequest request = ListUrlMapsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListUrlMapsPagedResponse> future = urlMapClient.listUrlMapsPagedCallable().futureCall(request);
// Do something
for (UrlMap element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListUrlMapsHttpRequest,UrlMapList> listUrlMapsCallable()
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListUrlMapsHttpRequest request = ListUrlMapsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
UrlMapList response = urlMapClient.listUrlMapsCallable().call(request);
for (UrlMap 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 patchUrlMap(ProjectGlobalUrlMapName urlMap, UrlMap urlMapResource, List<String> fieldMask)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = urlMapClient.patchUrlMap(urlMap, urlMapResource, fieldMask);
}
urlMap
- Name of the UrlMap resource to patch.urlMapResource
- Represents a URL Map resource.
A URL map resource is a component of certain types of load balancers. This resource defines mappings from host names and URL paths to either a backend service or a backend bucket.
To use this resource, the backend service must have a loadBalancingScheme of either EXTERNAL, INTERNAL_SELF_MANAGED, or INTERNAL_MANAGED For more information, read URL Map Concepts.
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation patchUrlMap(String urlMap, UrlMap urlMapResource, List<String> fieldMask)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = urlMapClient.patchUrlMap(urlMap.toString(), urlMapResource, fieldMask);
}
urlMap
- Name of the UrlMap resource to patch.urlMapResource
- Represents a URL Map resource.
A URL map resource is a component of certain types of load balancers. This resource defines mappings from host names and URL paths to either a backend service or a backend bucket.
To use this resource, the backend service must have a loadBalancingScheme of either EXTERNAL, INTERNAL_SELF_MANAGED, or INTERNAL_MANAGED For more information, read URL Map Concepts.
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation patchUrlMap(PatchUrlMapHttpRequest request)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchUrlMapHttpRequest request = PatchUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.setUrlMapResource(urlMapResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = urlMapClient.patchUrlMap(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<PatchUrlMapHttpRequest,Operation> patchUrlMapCallable()
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchUrlMapHttpRequest request = PatchUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.setUrlMapResource(urlMapResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = urlMapClient.patchUrlMapCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation updateUrlMap(ProjectGlobalUrlMapName urlMap, UrlMap urlMapResource, List<String> fieldMask)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = urlMapClient.updateUrlMap(urlMap, urlMapResource, fieldMask);
}
urlMap
- Name of the UrlMap resource to update.urlMapResource
- Represents a URL Map resource.
A URL map resource is a component of certain types of load balancers. This resource defines mappings from host names and URL paths to either a backend service or a backend bucket.
To use this resource, the backend service must have a loadBalancingScheme of either EXTERNAL, INTERNAL_SELF_MANAGED, or INTERNAL_MANAGED For more information, read URL Map Concepts.
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateUrlMap(String urlMap, UrlMap urlMapResource, List<String> fieldMask)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = urlMapClient.updateUrlMap(urlMap.toString(), urlMapResource, fieldMask);
}
urlMap
- Name of the UrlMap resource to update.urlMapResource
- Represents a URL Map resource.
A URL map resource is a component of certain types of load balancers. This resource defines mappings from host names and URL paths to either a backend service or a backend bucket.
To use this resource, the backend service must have a loadBalancingScheme of either EXTERNAL, INTERNAL_SELF_MANAGED, or INTERNAL_MANAGED For more information, read URL Map Concepts.
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateUrlMap(UpdateUrlMapHttpRequest request)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateUrlMapHttpRequest request = UpdateUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.setUrlMapResource(urlMapResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = urlMapClient.updateUrlMap(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<UpdateUrlMapHttpRequest,Operation> updateUrlMapCallable()
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateUrlMapHttpRequest request = UpdateUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.setUrlMapResource(urlMapResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = urlMapClient.updateUrlMapCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final UrlMapsValidateResponse validateUrlMap(ProjectGlobalUrlMapName urlMap, UrlMapsValidateRequest urlMapsValidateRequestResource)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
UrlMapsValidateRequest urlMapsValidateRequestResource = UrlMapsValidateRequest.newBuilder().build();
UrlMapsValidateResponse response = urlMapClient.validateUrlMap(urlMap, urlMapsValidateRequestResource);
}
urlMap
- Name of the UrlMap resource to be validated as.urlMapsValidateRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final UrlMapsValidateResponse validateUrlMap(String urlMap, UrlMapsValidateRequest urlMapsValidateRequestResource)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
UrlMapsValidateRequest urlMapsValidateRequestResource = UrlMapsValidateRequest.newBuilder().build();
UrlMapsValidateResponse response = urlMapClient.validateUrlMap(urlMap.toString(), urlMapsValidateRequestResource);
}
urlMap
- Name of the UrlMap resource to be validated as.urlMapsValidateRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final UrlMapsValidateResponse validateUrlMap(ValidateUrlMapHttpRequest request)
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
UrlMapsValidateRequest urlMapsValidateRequestResource = UrlMapsValidateRequest.newBuilder().build();
ValidateUrlMapHttpRequest request = ValidateUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.setUrlMapsValidateRequestResource(urlMapsValidateRequestResource)
.build();
UrlMapsValidateResponse response = urlMapClient.validateUrlMap(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<ValidateUrlMapHttpRequest,UrlMapsValidateResponse> validateUrlMapCallable()
Sample code:
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
String formattedUrlMap = ProjectGlobalUrlMapName.format("[PROJECT]", "[URL_MAP]");
UrlMapsValidateRequest urlMapsValidateRequestResource = UrlMapsValidateRequest.newBuilder().build();
ValidateUrlMapHttpRequest request = ValidateUrlMapHttpRequest.newBuilder()
.setUrlMap(formattedUrlMap)
.setUrlMapsValidateRequestResource(urlMapsValidateRequestResource)
.build();
ApiFuture<UrlMapsValidateResponse> future = urlMapClient.validateUrlMapCallable().futureCall(request);
// Do something
UrlMapsValidateResponse 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.