- 0.48.0 (latest)
- 0.46.0
- 0.45.0
- 0.44.0
- 0.43.0
- 0.42.0
- 0.41.0
- 0.40.0
- 0.39.0
- 0.38.0
- 0.37.0
- 0.36.0
- 0.34.0
- 0.33.0
- 0.32.0
- 0.31.0
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.0
- 0.26.0
- 0.25.0
- 0.24.0
- 0.21.0
- 0.20.0
- 0.19.0
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.0
- 0.13.0
- 0.12.0
- 0.11.0
- 0.10.0
- 0.9.0
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
public class DataPolicyServiceClient implements BackgroundResource
Service Description: Data Policy Service provides APIs for managing the label-policy bindings.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
DataPolicy dataPolicy = DataPolicy.newBuilder().build();
DataPolicy response = dataPolicyServiceClient.createDataPolicy(parent, dataPolicy);
}
Note: close() needs to be called on the DataPolicyServiceClient 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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns 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 DataPolicyServiceSettings 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
DataPolicyServiceSettings dataPolicyServiceSettings =
DataPolicyServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DataPolicyServiceClient dataPolicyServiceClient =
DataPolicyServiceClient.create(dataPolicyServiceSettings);
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
DataPolicyServiceSettings dataPolicyServiceSettings =
DataPolicyServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
DataPolicyServiceClient dataPolicyServiceClient =
DataPolicyServiceClient.create(dataPolicyServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
DataPolicyServiceSettings dataPolicyServiceSettings =
DataPolicyServiceSettings.newHttpJsonBuilder().build();
DataPolicyServiceClient dataPolicyServiceClient =
DataPolicyServiceClient.create(dataPolicyServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final DataPolicyServiceClient create()
Constructs an instance of DataPolicyServiceClient with default settings.
Type | Description |
DataPolicyServiceClient |
Type | Description |
IOException |
create(DataPolicyServiceSettings settings)
public static final DataPolicyServiceClient create(DataPolicyServiceSettings settings)
Constructs an instance of DataPolicyServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | DataPolicyServiceSettings |
Type | Description |
DataPolicyServiceClient |
Type | Description |
IOException |
create(DataPolicyServiceStub stub)
public static final DataPolicyServiceClient create(DataPolicyServiceStub stub)
Constructs an instance of DataPolicyServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DataPolicyServiceSettings).
Name | Description |
stub | DataPolicyServiceStub |
Type | Description |
DataPolicyServiceClient |
Constructors
DataPolicyServiceClient(DataPolicyServiceSettings settings)
protected DataPolicyServiceClient(DataPolicyServiceSettings settings)
Constructs an instance of DataPolicyServiceClient, 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.
Name | Description |
settings | DataPolicyServiceSettings |
DataPolicyServiceClient(DataPolicyServiceStub stub)
protected DataPolicyServiceClient(DataPolicyServiceStub stub)
Name | Description |
stub | DataPolicyServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
createDataPolicy(CreateDataPolicyRequest request)
public final DataPolicy createDataPolicy(CreateDataPolicyRequest request)
Creates a new data policy under a project with the given dataPolicyId
(used as the display
name), policy tag, and data policy type.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
CreateDataPolicyRequest request =
CreateDataPolicyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setDataPolicy(DataPolicy.newBuilder().build())
.build();
DataPolicy response = dataPolicyServiceClient.createDataPolicy(request);
}
Name | Description |
request | CreateDataPolicyRequest The request object containing all of the parameters for the API call. |
Type | Description |
DataPolicy |
createDataPolicy(LocationName parent, DataPolicy dataPolicy)
public final DataPolicy createDataPolicy(LocationName parent, DataPolicy dataPolicy)
Creates a new data policy under a project with the given dataPolicyId
(used as the display
name), policy tag, and data policy type.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
DataPolicy dataPolicy = DataPolicy.newBuilder().build();
DataPolicy response = dataPolicyServiceClient.createDataPolicy(parent, dataPolicy);
}
Name | Description |
parent | LocationName Required. Resource name of the project that the data policy will belong to. The
format is |
dataPolicy | DataPolicy Required. The data policy to create. The |
Type | Description |
DataPolicy |
createDataPolicy(String parent, DataPolicy dataPolicy)
public final DataPolicy createDataPolicy(String parent, DataPolicy dataPolicy)
Creates a new data policy under a project with the given dataPolicyId
(used as the display
name), policy tag, and data policy type.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
DataPolicy dataPolicy = DataPolicy.newBuilder().build();
DataPolicy response = dataPolicyServiceClient.createDataPolicy(parent, dataPolicy);
}
Name | Description |
parent | String Required. Resource name of the project that the data policy will belong to. The
format is |
dataPolicy | DataPolicy Required. The data policy to create. The |
Type | Description |
DataPolicy |
createDataPolicyCallable()
public final UnaryCallable<CreateDataPolicyRequest,DataPolicy> createDataPolicyCallable()
Creates a new data policy under a project with the given dataPolicyId
(used as the display
name), policy tag, and data policy type.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
CreateDataPolicyRequest request =
CreateDataPolicyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setDataPolicy(DataPolicy.newBuilder().build())
.build();
ApiFuture<DataPolicy> future =
dataPolicyServiceClient.createDataPolicyCallable().futureCall(request);
// Do something.
DataPolicy response = future.get();
}
Type | Description |
UnaryCallable<CreateDataPolicyRequest,DataPolicy> |
deleteDataPolicy(DataPolicyName name)
public final void deleteDataPolicy(DataPolicyName name)
Deletes the data policy specified by its resource name.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]");
dataPolicyServiceClient.deleteDataPolicy(name);
}
Name | Description |
name | DataPolicyName Required. Resource name of the data policy to delete. Format is
|
deleteDataPolicy(DeleteDataPolicyRequest request)
public final void deleteDataPolicy(DeleteDataPolicyRequest request)
Deletes the data policy specified by its resource name.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
DeleteDataPolicyRequest request =
DeleteDataPolicyRequest.newBuilder()
.setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
.build();
dataPolicyServiceClient.deleteDataPolicy(request);
}
Name | Description |
request | DeleteDataPolicyRequest The request object containing all of the parameters for the API call. |
deleteDataPolicy(String name)
public final void deleteDataPolicy(String name)
Deletes the data policy specified by its resource name.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
String name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString();
dataPolicyServiceClient.deleteDataPolicy(name);
}
Name | Description |
name | String Required. Resource name of the data policy to delete. Format is
|
deleteDataPolicyCallable()
public final UnaryCallable<DeleteDataPolicyRequest,Empty> deleteDataPolicyCallable()
Deletes the data policy specified by its resource name.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
DeleteDataPolicyRequest request =
DeleteDataPolicyRequest.newBuilder()
.setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
.build();
ApiFuture<Empty> future =
dataPolicyServiceClient.deleteDataPolicyCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
UnaryCallable<DeleteDataPolicyRequest,Empty> |
getDataPolicy(DataPolicyName name)
public final DataPolicy getDataPolicy(DataPolicyName name)
Gets the data policy specified by its resource name.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]");
DataPolicy response = dataPolicyServiceClient.getDataPolicy(name);
}
Name | Description |
name | DataPolicyName Required. Resource name of the requested data policy. Format is
|
Type | Description |
DataPolicy |
getDataPolicy(GetDataPolicyRequest request)
public final DataPolicy getDataPolicy(GetDataPolicyRequest request)
Gets the data policy specified by its resource name.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
GetDataPolicyRequest request =
GetDataPolicyRequest.newBuilder()
.setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
.build();
DataPolicy response = dataPolicyServiceClient.getDataPolicy(request);
}
Name | Description |
request | GetDataPolicyRequest The request object containing all of the parameters for the API call. |
Type | Description |
DataPolicy |
getDataPolicy(String name)
public final DataPolicy getDataPolicy(String name)
Gets the data policy specified by its resource name.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
String name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString();
DataPolicy response = dataPolicyServiceClient.getDataPolicy(name);
}
Name | Description |
name | String Required. Resource name of the requested data policy. Format is
|
Type | Description |
DataPolicy |
getDataPolicyCallable()
public final UnaryCallable<GetDataPolicyRequest,DataPolicy> getDataPolicyCallable()
Gets the data policy specified by its resource name.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
GetDataPolicyRequest request =
GetDataPolicyRequest.newBuilder()
.setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
.build();
ApiFuture<DataPolicy> future =
dataPolicyServiceClient.getDataPolicyCallable().futureCall(request);
// Do something.
DataPolicy response = future.get();
}
Type | Description |
UnaryCallable<GetDataPolicyRequest,DataPolicy> |
getIamPolicy(GetIamPolicyRequest request)
public final Policy getIamPolicy(GetIamPolicyRequest request)
Gets the IAM policy for the specified data policy.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = dataPolicyServiceClient.getIamPolicy(request);
}
Name | Description |
request | com.google.iam.v1.GetIamPolicyRequest The request object containing all of the parameters for the API call. |
Type | Description |
com.google.iam.v1.Policy |
getIamPolicyCallable()
public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()
Gets the IAM policy for the specified data policy.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future = dataPolicyServiceClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Type | Description |
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getSettings()
public final DataPolicyServiceSettings getSettings()
Type | Description |
DataPolicyServiceSettings |
getStub()
public DataPolicyServiceStub getStub()
Type | Description |
DataPolicyServiceStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listDataPolicies(ListDataPoliciesRequest request)
public final DataPolicyServiceClient.ListDataPoliciesPagedResponse listDataPolicies(ListDataPoliciesRequest request)
List all of the data policies in the specified parent project.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
ListDataPoliciesRequest request =
ListDataPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (DataPolicy element : dataPolicyServiceClient.listDataPolicies(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListDataPoliciesRequest The request object containing all of the parameters for the API call. |
Type | Description |
DataPolicyServiceClient.ListDataPoliciesPagedResponse |
listDataPolicies(LocationName parent)
public final DataPolicyServiceClient.ListDataPoliciesPagedResponse listDataPolicies(LocationName parent)
List all of the data policies in the specified parent project.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (DataPolicy element : dataPolicyServiceClient.listDataPolicies(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | LocationName Required. Resource name of the project for which to list data policies. Format is
|
Type | Description |
DataPolicyServiceClient.ListDataPoliciesPagedResponse |
listDataPolicies(String parent)
public final DataPolicyServiceClient.ListDataPoliciesPagedResponse listDataPolicies(String parent)
List all of the data policies in the specified parent project.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (DataPolicy element : dataPolicyServiceClient.listDataPolicies(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. Resource name of the project for which to list data policies. Format is
|
Type | Description |
DataPolicyServiceClient.ListDataPoliciesPagedResponse |
listDataPoliciesCallable()
public final UnaryCallable<ListDataPoliciesRequest,ListDataPoliciesResponse> listDataPoliciesCallable()
List all of the data policies in the specified parent project.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
ListDataPoliciesRequest request =
ListDataPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListDataPoliciesResponse response =
dataPolicyServiceClient.listDataPoliciesCallable().call(request);
for (DataPolicy element : response.getDataPoliciesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListDataPoliciesRequest,ListDataPoliciesResponse> |
listDataPoliciesPagedCallable()
public final UnaryCallable<ListDataPoliciesRequest,DataPolicyServiceClient.ListDataPoliciesPagedResponse> listDataPoliciesPagedCallable()
List all of the data policies in the specified parent project.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
ListDataPoliciesRequest request =
ListDataPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<DataPolicy> future =
dataPolicyServiceClient.listDataPoliciesPagedCallable().futureCall(request);
// Do something.
for (DataPolicy element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListDataPoliciesRequest,ListDataPoliciesPagedResponse> |
renameDataPolicy(RenameDataPolicyRequest request)
public final DataPolicy renameDataPolicy(RenameDataPolicyRequest request)
Renames the id (display name) of the specified data policy.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
RenameDataPolicyRequest request =
RenameDataPolicyRequest.newBuilder()
.setName("name3373707")
.setNewDataPolicyId("newDataPolicyId288407927")
.build();
DataPolicy response = dataPolicyServiceClient.renameDataPolicy(request);
}
Name | Description |
request | RenameDataPolicyRequest The request object containing all of the parameters for the API call. |
Type | Description |
DataPolicy |
renameDataPolicy(String name, String newDataPolicyId)
public final DataPolicy renameDataPolicy(String name, String newDataPolicyId)
Renames the id (display name) of the specified data policy.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
String name = "name3373707";
String newDataPolicyId = "newDataPolicyId288407927";
DataPolicy response = dataPolicyServiceClient.renameDataPolicy(name, newDataPolicyId);
}
Name | Description |
name | String Required. Resource name of the data policy to rename. The format is
|
newDataPolicyId | String Required. The new data policy id. |
Type | Description |
DataPolicy |
renameDataPolicyCallable()
public final UnaryCallable<RenameDataPolicyRequest,DataPolicy> renameDataPolicyCallable()
Renames the id (display name) of the specified data policy.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
RenameDataPolicyRequest request =
RenameDataPolicyRequest.newBuilder()
.setName("name3373707")
.setNewDataPolicyId("newDataPolicyId288407927")
.build();
ApiFuture<DataPolicy> future =
dataPolicyServiceClient.renameDataPolicyCallable().futureCall(request);
// Do something.
DataPolicy response = future.get();
}
Type | Description |
UnaryCallable<RenameDataPolicyRequest,DataPolicy> |
setIamPolicy(SetIamPolicyRequest request)
public final Policy setIamPolicy(SetIamPolicyRequest request)
Sets the IAM policy for the specified data policy.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = dataPolicyServiceClient.setIamPolicy(request);
}
Name | Description |
request | com.google.iam.v1.SetIamPolicyRequest The request object containing all of the parameters for the API call. |
Type | Description |
com.google.iam.v1.Policy |
setIamPolicyCallable()
public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()
Sets the IAM policy for the specified data policy.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future = dataPolicyServiceClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Type | Description |
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
testIamPermissions(TestIamPermissionsRequest request)
public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)
Returns the caller's permission on the specified data policy resource.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = dataPolicyServiceClient.testIamPermissions(request);
}
Name | Description |
request | com.google.iam.v1.TestIamPermissionsRequest The request object containing all of the parameters for the API call. |
Type | Description |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissionsCallable()
public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()
Returns the caller's permission on the specified data policy resource.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
dataPolicyServiceClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse response = future.get();
}
Type | Description |
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
updateDataPolicy(DataPolicy dataPolicy, FieldMask updateMask)
public final DataPolicy updateDataPolicy(DataPolicy dataPolicy, FieldMask updateMask)
Updates the metadata for an existing data policy. The target data policy can be specified by the resource name.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
DataPolicy dataPolicy = DataPolicy.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
DataPolicy response = dataPolicyServiceClient.updateDataPolicy(dataPolicy, updateMask);
}
Name | Description |
dataPolicy | DataPolicy Required. Update the data policy's metadata. The target data policy is determined by the |
updateMask | FieldMask The update mask applies to the resource. For the Updates to the |
Type | Description |
DataPolicy |
updateDataPolicy(UpdateDataPolicyRequest request)
public final DataPolicy updateDataPolicy(UpdateDataPolicyRequest request)
Updates the metadata for an existing data policy. The target data policy can be specified by the resource name.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
UpdateDataPolicyRequest request =
UpdateDataPolicyRequest.newBuilder()
.setDataPolicy(DataPolicy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
DataPolicy response = dataPolicyServiceClient.updateDataPolicy(request);
}
Name | Description |
request | UpdateDataPolicyRequest The request object containing all of the parameters for the API call. |
Type | Description |
DataPolicy |
updateDataPolicyCallable()
public final UnaryCallable<UpdateDataPolicyRequest,DataPolicy> updateDataPolicyCallable()
Updates the metadata for an existing data policy. The target data policy can be specified by the resource name.
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 (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
UpdateDataPolicyRequest request =
UpdateDataPolicyRequest.newBuilder()
.setDataPolicy(DataPolicy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<DataPolicy> future =
dataPolicyServiceClient.updateDataPolicyCallable().futureCall(request);
// Do something.
DataPolicy response = future.get();
}
Type | Description |
UnaryCallable<UpdateDataPolicyRequest,DataPolicy> |