- 1.53.0 (latest)
- 1.52.0
- 1.51.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.37.0
- 1.36.0
- 1.35.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.0
- 1.27.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.5
- 1.2.1
- 1.1.9
GitHub Repository | Product Reference |
Service Description: An interface to interact with resource settings and setting values throughout the resource hierarchy.
Services may surface a number of settings for users to control how their resources behave. Values of settings applied on a given Cloud resource are evaluated hierarchically and inherited by all descendants of that resource.
For all requests, returns a google.rpc.Status
with google.rpc.Code.PERMISSION_DENIED
if
the IAM check fails or the parent
resource is not in a Cloud Organization. For all requests,
returns a google.rpc.Status
with google.rpc.Code.INVALID_ARGUMENT
if the request is
malformed.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
SettingName name =
SettingName.ofOrganizationSettingNameName("[ORGANIZATION]", "[SETTING_NAME]");
Setting response = resourceSettingsServiceClient.getSetting(name);
}
Note: close() needs to be called on the ResourceSettingsServiceClient 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 |
---|---|---|
ListSettings |
Lists all the settings that are available on the Cloud resource |
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.
|
GetSetting |
Gets a setting. Returns 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.
|
UpdateSetting |
Updates a setting. Returns a On success, the response will contain only Note: the supplied setting will perform a full overwrite of the |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
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 ResourceSettingsServiceSettings 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
ResourceSettingsServiceSettings resourceSettingsServiceSettings =
ResourceSettingsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create(resourceSettingsServiceSettings);
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
ResourceSettingsServiceSettings resourceSettingsServiceSettings =
ResourceSettingsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create(resourceSettingsServiceSettings);
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
ResourceSettingsServiceSettings resourceSettingsServiceSettings =
ResourceSettingsServiceSettings.newHttpJsonBuilder().build();
ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create(resourceSettingsServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final ResourceSettingsServiceClient create()
Constructs an instance of ResourceSettingsServiceClient with default settings.
Returns | |
---|---|
Type | Description |
ResourceSettingsServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(ResourceSettingsServiceSettings settings)
public static final ResourceSettingsServiceClient create(ResourceSettingsServiceSettings settings)
Constructs an instance of ResourceSettingsServiceClient, 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 |
ResourceSettingsServiceSettings |
Returns | |
---|---|
Type | Description |
ResourceSettingsServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(ResourceSettingsServiceStub stub)
public static final ResourceSettingsServiceClient create(ResourceSettingsServiceStub stub)
Constructs an instance of ResourceSettingsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ResourceSettingsServiceSettings).
Parameter | |
---|---|
Name | Description |
stub |
ResourceSettingsServiceStub |
Returns | |
---|---|
Type | Description |
ResourceSettingsServiceClient |
Constructors
ResourceSettingsServiceClient(ResourceSettingsServiceSettings settings)
protected ResourceSettingsServiceClient(ResourceSettingsServiceSettings settings)
Constructs an instance of ResourceSettingsServiceClient, 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 |
ResourceSettingsServiceSettings |
ResourceSettingsServiceClient(ResourceSettingsServiceStub stub)
protected ResourceSettingsServiceClient(ResourceSettingsServiceStub stub)
Parameter | |
---|---|
Name | Description |
stub |
ResourceSettingsServiceStub |
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()
getSetting(GetSettingRequest request)
public final Setting getSetting(GetSettingRequest request)
Gets a setting.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the setting does not
exist.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
GetSettingRequest request =
GetSettingRequest.newBuilder()
.setName(
SettingName.ofOrganizationSettingNameName("[ORGANIZATION]", "[SETTING_NAME]")
.toString())
.setView(SettingView.forNumber(0))
.build();
Setting response = resourceSettingsServiceClient.getSetting(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetSettingRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Setting |
getSetting(SettingName name)
public final Setting getSetting(SettingName name)
Gets a setting.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the setting does not
exist.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
SettingName name =
SettingName.ofOrganizationSettingNameName("[ORGANIZATION]", "[SETTING_NAME]");
Setting response = resourceSettingsServiceClient.getSetting(name);
}
Parameter | |
---|---|
Name | Description |
name |
SettingName Required. The name of the setting to get. See Setting for naming requirements. |
Returns | |
---|---|
Type | Description |
Setting |
getSetting(String name)
public final Setting getSetting(String name)
Gets a setting.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the setting does not
exist.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
String name =
SettingName.ofProjectNumberSettingNameName("[PROJECT_NUMBER]", "[SETTING_NAME]")
.toString();
Setting response = resourceSettingsServiceClient.getSetting(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. The name of the setting to get. See Setting for naming requirements. |
Returns | |
---|---|
Type | Description |
Setting |
getSettingCallable()
public final UnaryCallable<GetSettingRequest,Setting> getSettingCallable()
Gets a setting.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the setting does not
exist.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
GetSettingRequest request =
GetSettingRequest.newBuilder()
.setName(
SettingName.ofOrganizationSettingNameName("[ORGANIZATION]", "[SETTING_NAME]")
.toString())
.setView(SettingView.forNumber(0))
.build();
ApiFuture<Setting> future =
resourceSettingsServiceClient.getSettingCallable().futureCall(request);
// Do something.
Setting response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetSettingRequest,Setting> |
getSettings()
public final ResourceSettingsServiceSettings getSettings()
Returns | |
---|---|
Type | Description |
ResourceSettingsServiceSettings |
getStub()
public ResourceSettingsServiceStub getStub()
Returns | |
---|---|
Type | Description |
ResourceSettingsServiceStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listSettings(ResourceName parent)
public final ResourceSettingsServiceClient.ListSettingsPagedResponse listSettings(ResourceName parent)
Lists all the settings that are available on the Cloud resource parent
.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
ResourceName parent =
new ResourceName() {
{@literal @}Override
public Map<String, String> getFieldValuesMap() {
Map<String, String> fieldValuesMap = new HashMap<>();
fieldValuesMap.put("parent", "organizations/organization-8287");
return fieldValuesMap;
}
{@literal @}Override
public String getFieldValue(String fieldName) {
return getFieldValuesMap().get(fieldName);
}
{@literal @}Override
public String toString() {
return "organizations/organization-8287";
}
};
for (Setting element : resourceSettingsServiceClient.listSettings(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
com.google.api.resourcenames.ResourceName Required. The Cloud resource that parents the setting. Must be in one of the following forms:
|
Returns | |
---|---|
Type | Description |
ResourceSettingsServiceClient.ListSettingsPagedResponse |
listSettings(ListSettingsRequest request)
public final ResourceSettingsServiceClient.ListSettingsPagedResponse listSettings(ListSettingsRequest request)
Lists all the settings that are available on the Cloud resource parent
.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
ListSettingsRequest request =
ListSettingsRequest.newBuilder()
.setParent("ListSettingsRequest-286838706".toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(SettingView.forNumber(0))
.build();
for (Setting element : resourceSettingsServiceClient.listSettings(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
ListSettingsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
ResourceSettingsServiceClient.ListSettingsPagedResponse |
listSettings(String parent)
public final ResourceSettingsServiceClient.ListSettingsPagedResponse listSettings(String parent)
Lists all the settings that are available on the Cloud resource parent
.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
String parent =
SettingName.ofProjectNumberSettingNameName("[PROJECT_NUMBER]", "[SETTING_NAME]")
.toString();
for (Setting element : resourceSettingsServiceClient.listSettings(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
String Required. The Cloud resource that parents the setting. Must be in one of the following forms:
|
Returns | |
---|---|
Type | Description |
ResourceSettingsServiceClient.ListSettingsPagedResponse |
listSettingsCallable()
public final UnaryCallable<ListSettingsRequest,ListSettingsResponse> listSettingsCallable()
Lists all the settings that are available on the Cloud resource parent
.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
ListSettingsRequest request =
ListSettingsRequest.newBuilder()
.setParent("ListSettingsRequest-286838706".toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(SettingView.forNumber(0))
.build();
while (true) {
ListSettingsResponse response =
resourceSettingsServiceClient.listSettingsCallable().call(request);
for (Setting element : response.getSettingsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListSettingsRequest,ListSettingsResponse> |
listSettingsPagedCallable()
public final UnaryCallable<ListSettingsRequest,ResourceSettingsServiceClient.ListSettingsPagedResponse> listSettingsPagedCallable()
Lists all the settings that are available on the Cloud resource parent
.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
ListSettingsRequest request =
ListSettingsRequest.newBuilder()
.setParent("ListSettingsRequest-286838706".toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(SettingView.forNumber(0))
.build();
ApiFuture<Setting> future =
resourceSettingsServiceClient.listSettingsPagedCallable().futureCall(request);
// Do something.
for (Setting element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListSettingsRequest,ListSettingsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateSetting(UpdateSettingRequest request)
public final Setting updateSetting(UpdateSettingRequest request)
Updates a setting.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the setting does not
exist. Returns a google.rpc.Status
with google.rpc.Code.FAILED_PRECONDITION
if the setting
is flagged as read only. Returns a google.rpc.Status
with google.rpc.Code.ABORTED
if the
etag supplied in the request does not match the persisted etag of the setting value.
On success, the response will contain only name
, local_value
and etag
. The metadata
and effective_value
cannot be updated through this API.
Note: the supplied setting will perform a full overwrite of the local_value
field.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
UpdateSettingRequest request =
UpdateSettingRequest.newBuilder().setSetting(Setting.newBuilder().build()).build();
Setting response = resourceSettingsServiceClient.updateSetting(request);
}
Parameter | |
---|---|
Name | Description |
request |
UpdateSettingRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Setting |
updateSettingCallable()
public final UnaryCallable<UpdateSettingRequest,Setting> updateSettingCallable()
Updates a setting.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the setting does not
exist. Returns a google.rpc.Status
with google.rpc.Code.FAILED_PRECONDITION
if the setting
is flagged as read only. Returns a google.rpc.Status
with google.rpc.Code.ABORTED
if the
etag supplied in the request does not match the persisted etag of the setting value.
On success, the response will contain only name
, local_value
and etag
. The metadata
and effective_value
cannot be updated through this API.
Note: the supplied setting will perform a full overwrite of the local_value
field.
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 (ResourceSettingsServiceClient resourceSettingsServiceClient =
ResourceSettingsServiceClient.create()) {
UpdateSettingRequest request =
UpdateSettingRequest.newBuilder().setSetting(Setting.newBuilder().build()).build();
ApiFuture<Setting> future =
resourceSettingsServiceClient.updateSettingCallable().futureCall(request);
// Do something.
Setting response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateSettingRequest,Setting> |