| GitHub Repository | Product Reference |
Service Description: Provides methods for handling CmsMetadataValue objects.
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create()) {
CmsMetadataValueName name = CmsMetadataValueName.of("[NETWORK_CODE]", "[CMS_METADATA_VALUE]");
CmsMetadataValue response = cmsMetadataValueServiceClient.getCmsMetadataValue(name);
}
Note: close() needs to be called on the CmsMetadataValueServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
GetCmsMetadataValue |
API to retrieve a |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListCmsMetadataValues |
API to retrieve a list of |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 CmsMetadataValueServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
CmsMetadataValueServiceSettings cmsMetadataValueServiceSettings =
CmsMetadataValueServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create(cmsMetadataValueServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
CmsMetadataValueServiceSettings cmsMetadataValueServiceSettings =
CmsMetadataValueServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create(cmsMetadataValueServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final CmsMetadataValueServiceClient create()Constructs an instance of CmsMetadataValueServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
CmsMetadataValueServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(CmsMetadataValueServiceSettings settings)
public static final CmsMetadataValueServiceClient create(CmsMetadataValueServiceSettings settings)Constructs an instance of CmsMetadataValueServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
CmsMetadataValueServiceSettings |
| Returns | |
|---|---|
| Type | Description |
CmsMetadataValueServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(CmsMetadataValueServiceStub stub)
public static final CmsMetadataValueServiceClient create(CmsMetadataValueServiceStub stub)Constructs an instance of CmsMetadataValueServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(CmsMetadataValueServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
CmsMetadataValueServiceStub |
| Returns | |
|---|---|
| Type | Description |
CmsMetadataValueServiceClient |
|
Constructors
CmsMetadataValueServiceClient(CmsMetadataValueServiceSettings settings)
protected CmsMetadataValueServiceClient(CmsMetadataValueServiceSettings settings)Constructs an instance of CmsMetadataValueServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
CmsMetadataValueServiceSettings |
CmsMetadataValueServiceClient(CmsMetadataValueServiceStub stub)
protected CmsMetadataValueServiceClient(CmsMetadataValueServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
CmsMetadataValueServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
public final void close()getCmsMetadataValue(CmsMetadataValueName name)
public final CmsMetadataValue getCmsMetadataValue(CmsMetadataValueName name)API to retrieve a CmsMetadataKey object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create()) {
CmsMetadataValueName name = CmsMetadataValueName.of("[NETWORK_CODE]", "[CMS_METADATA_VALUE]");
CmsMetadataValue response = cmsMetadataValueServiceClient.getCmsMetadataValue(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
CmsMetadataValueNameRequired. The resource name of the CmsMetadataKey. Format:
|
| Returns | |
|---|---|
| Type | Description |
CmsMetadataValue |
|
getCmsMetadataValue(GetCmsMetadataValueRequest request)
public final CmsMetadataValue getCmsMetadataValue(GetCmsMetadataValueRequest request)API to retrieve a CmsMetadataKey object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create()) {
GetCmsMetadataValueRequest request =
GetCmsMetadataValueRequest.newBuilder()
.setName(CmsMetadataValueName.of("[NETWORK_CODE]", "[CMS_METADATA_VALUE]").toString())
.build();
CmsMetadataValue response = cmsMetadataValueServiceClient.getCmsMetadataValue(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetCmsMetadataValueRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
CmsMetadataValue |
|
getCmsMetadataValue(String name)
public final CmsMetadataValue getCmsMetadataValue(String name)API to retrieve a CmsMetadataKey object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create()) {
String name = CmsMetadataValueName.of("[NETWORK_CODE]", "[CMS_METADATA_VALUE]").toString();
CmsMetadataValue response = cmsMetadataValueServiceClient.getCmsMetadataValue(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the CmsMetadataKey. Format:
|
| Returns | |
|---|---|
| Type | Description |
CmsMetadataValue |
|
getCmsMetadataValueCallable()
public final UnaryCallable<GetCmsMetadataValueRequest,CmsMetadataValue> getCmsMetadataValueCallable()API to retrieve a CmsMetadataKey object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create()) {
GetCmsMetadataValueRequest request =
GetCmsMetadataValueRequest.newBuilder()
.setName(CmsMetadataValueName.of("[NETWORK_CODE]", "[CMS_METADATA_VALUE]").toString())
.build();
ApiFuture<CmsMetadataValue> future =
cmsMetadataValueServiceClient.getCmsMetadataValueCallable().futureCall(request);
// Do something.
CmsMetadataValue response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetCmsMetadataValueRequest,CmsMetadataValue> |
|
getSettings()
public final CmsMetadataValueServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
CmsMetadataValueServiceSettings |
|
getStub()
public CmsMetadataValueServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
CmsMetadataValueServiceStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listCmsMetadataValues(ListCmsMetadataValuesRequest request)
public final CmsMetadataValueServiceClient.ListCmsMetadataValuesPagedResponse listCmsMetadataValues(ListCmsMetadataValuesRequest request)API to retrieve a list of CmsMetadataValue objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create()) {
ListCmsMetadataValuesRequest request =
ListCmsMetadataValuesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
for (CmsMetadataValue element :
cmsMetadataValueServiceClient.listCmsMetadataValues(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListCmsMetadataValuesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
CmsMetadataValueServiceClient.ListCmsMetadataValuesPagedResponse |
|
listCmsMetadataValues(NetworkName parent)
public final CmsMetadataValueServiceClient.ListCmsMetadataValuesPagedResponse listCmsMetadataValues(NetworkName parent)API to retrieve a list of CmsMetadataValue objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
for (CmsMetadataValue element :
cmsMetadataValueServiceClient.listCmsMetadataValues(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
NetworkNameRequired. The parent, which owns this collection of CmsMetadataValues. Format:
|
| Returns | |
|---|---|
| Type | Description |
CmsMetadataValueServiceClient.ListCmsMetadataValuesPagedResponse |
|
listCmsMetadataValues(String parent)
public final CmsMetadataValueServiceClient.ListCmsMetadataValuesPagedResponse listCmsMetadataValues(String parent)API to retrieve a list of CmsMetadataValue objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
for (CmsMetadataValue element :
cmsMetadataValueServiceClient.listCmsMetadataValues(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent, which owns this collection of CmsMetadataValues. Format:
|
| Returns | |
|---|---|
| Type | Description |
CmsMetadataValueServiceClient.ListCmsMetadataValuesPagedResponse |
|
listCmsMetadataValuesCallable()
public final UnaryCallable<ListCmsMetadataValuesRequest,ListCmsMetadataValuesResponse> listCmsMetadataValuesCallable()API to retrieve a list of CmsMetadataValue objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create()) {
ListCmsMetadataValuesRequest request =
ListCmsMetadataValuesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
while (true) {
ListCmsMetadataValuesResponse response =
cmsMetadataValueServiceClient.listCmsMetadataValuesCallable().call(request);
for (CmsMetadataValue element : response.getCmsMetadataValuesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListCmsMetadataValuesRequest,ListCmsMetadataValuesResponse> |
|
listCmsMetadataValuesPagedCallable()
public final UnaryCallable<ListCmsMetadataValuesRequest,CmsMetadataValueServiceClient.ListCmsMetadataValuesPagedResponse> listCmsMetadataValuesPagedCallable()API to retrieve a list of CmsMetadataValue objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CmsMetadataValueServiceClient cmsMetadataValueServiceClient =
CmsMetadataValueServiceClient.create()) {
ListCmsMetadataValuesRequest request =
ListCmsMetadataValuesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
ApiFuture<CmsMetadataValue> future =
cmsMetadataValueServiceClient.listCmsMetadataValuesPagedCallable().futureCall(request);
// Do something.
for (CmsMetadataValue element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListCmsMetadataValuesRequest,ListCmsMetadataValuesPagedResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()