diff --git a/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/ResourceSettingsServiceClient.java b/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/ResourceSettingsServiceClient.java
index c5ad42b51adf..98dfa452f66a 100644
--- a/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/ResourceSettingsServiceClient.java
+++ b/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/ResourceSettingsServiceClient.java
@@ -112,6 +112,21 @@
* ResourceSettingsServiceClient.create(resourceSettingsServiceSettings);
* }
*
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ResourceSettingsServiceSettings resourceSettingsServiceSettings =
+ * ResourceSettingsServiceSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * ResourceSettingsServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * ResourceSettingsServiceClient resourceSettingsServiceClient =
+ * ResourceSettingsServiceClient.create(resourceSettingsServiceSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
diff --git a/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/ResourceSettingsServiceSettings.java b/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/ResourceSettingsServiceSettings.java
index 72783fefa994..2623d5cd327b 100644
--- a/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/ResourceSettingsServiceSettings.java
+++ b/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/ResourceSettingsServiceSettings.java
@@ -23,6 +23,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
@@ -115,11 +116,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return ResourceSettingsServiceStubSettings.defaultCredentialsProviderBuilder();
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return ResourceSettingsServiceStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return ResourceSettingsServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return ResourceSettingsServiceStubSettings.defaultTransportChannelProvider();
}
@@ -129,11 +137,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return ResourceSettingsServiceStubSettings.defaultApiClientHeaderProviderBuilder();
}
- /** Returns a new builder for this class. */
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -172,6 +186,11 @@ private static Builder createDefault() {
return new Builder(ResourceSettingsServiceStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(ResourceSettingsServiceStubSettings.newHttpJsonBuilder());
+ }
+
public ResourceSettingsServiceStubSettings.Builder getStubSettingsBuilder() {
return ((ResourceSettingsServiceStubSettings.Builder) getStubSettings());
}
diff --git a/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/stub/HttpJsonResourceSettingsServiceCallableFactory.java b/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/stub/HttpJsonResourceSettingsServiceCallableFactory.java
new file mode 100644
index 000000000000..7119f37956b5
--- /dev/null
+++ b/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/stub/HttpJsonResourceSettingsServiceCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the ResourceSettingsService service API.
+ *
+ *
This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonResourceSettingsServiceCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/stub/HttpJsonResourceSettingsServiceStub.java b/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/stub/HttpJsonResourceSettingsServiceStub.java
new file mode 100644
index 000000000000..202390fd8877
--- /dev/null
+++ b/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/stub/HttpJsonResourceSettingsServiceStub.java
@@ -0,0 +1,320 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.stub;
+
+import static com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient.ListSettingsPagedResponse;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.resourcesettings.v1.GetSettingRequest;
+import com.google.cloud.resourcesettings.v1.ListSettingsRequest;
+import com.google.cloud.resourcesettings.v1.ListSettingsResponse;
+import com.google.cloud.resourcesettings.v1.Setting;
+import com.google.cloud.resourcesettings.v1.UpdateSettingRequest;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the ResourceSettingsService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonResourceSettingsServiceStub extends ResourceSettingsServiceStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor
+ listSettingsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.cloud.resourcesettings.v1.ResourceSettingsService/ListSettings")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=organizations/*}/settings",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{parent=folders/*}/settings", "/v1/{parent=projects/*}/settings")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ serializer.putQueryParam(fields, "view", request.getView());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListSettingsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor getSettingMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.resourcesettings.v1.ResourceSettingsService/GetSetting")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=organizations/*/settings/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{name=folders/*/settings/*}", "/v1/{name=projects/*/settings/*}")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "view", request.getView());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Setting.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateSettingMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.cloud.resourcesettings.v1.ResourceSettingsService/UpdateSetting")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{setting.name=organizations/*/settings/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "setting.name", request.getSetting().getName());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{setting.name=folders/*/settings/*}",
+ "/v1/{setting.name=projects/*/settings/*}")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create().toBody("setting", request.getSetting()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Setting.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable listSettingsCallable;
+ private final UnaryCallable
+ listSettingsPagedCallable;
+ private final UnaryCallable getSettingCallable;
+ private final UnaryCallable updateSettingCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonResourceSettingsServiceStub create(
+ ResourceSettingsServiceStubSettings settings) throws IOException {
+ return new HttpJsonResourceSettingsServiceStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonResourceSettingsServiceStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonResourceSettingsServiceStub(
+ ResourceSettingsServiceStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonResourceSettingsServiceStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonResourceSettingsServiceStub(
+ ResourceSettingsServiceStubSettings.newHttpJsonBuilder().build(),
+ clientContext,
+ callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonResourceSettingsServiceStub, 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.
+ */
+ protected HttpJsonResourceSettingsServiceStub(
+ ResourceSettingsServiceStubSettings settings, ClientContext clientContext)
+ throws IOException {
+ this(settings, clientContext, new HttpJsonResourceSettingsServiceCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonResourceSettingsServiceStub, 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.
+ */
+ protected HttpJsonResourceSettingsServiceStub(
+ ResourceSettingsServiceStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+
+ HttpJsonCallSettings listSettingsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listSettingsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getSettingTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getSettingMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings updateSettingTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateSettingMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.listSettingsCallable =
+ callableFactory.createUnaryCallable(
+ listSettingsTransportSettings, settings.listSettingsSettings(), clientContext);
+ this.listSettingsPagedCallable =
+ callableFactory.createPagedCallable(
+ listSettingsTransportSettings, settings.listSettingsSettings(), clientContext);
+ this.getSettingCallable =
+ callableFactory.createUnaryCallable(
+ getSettingTransportSettings, settings.getSettingSettings(), clientContext);
+ this.updateSettingCallable =
+ callableFactory.createUnaryCallable(
+ updateSettingTransportSettings, settings.updateSettingSettings(), clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(listSettingsMethodDescriptor);
+ methodDescriptors.add(getSettingMethodDescriptor);
+ methodDescriptors.add(updateSettingMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ @Override
+ public UnaryCallable listSettingsCallable() {
+ return listSettingsCallable;
+ }
+
+ @Override
+ public UnaryCallable listSettingsPagedCallable() {
+ return listSettingsPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable getSettingCallable() {
+ return getSettingCallable;
+ }
+
+ @Override
+ public UnaryCallable updateSettingCallable() {
+ return updateSettingCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ backgroundResources.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return backgroundResources.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return backgroundResources.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ backgroundResources.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return backgroundResources.awaitTermination(duration, unit);
+ }
+}
diff --git a/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/stub/ResourceSettingsServiceStubSettings.java b/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/stub/ResourceSettingsServiceStubSettings.java
index 14c428967096..ca1749c36b63 100644
--- a/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/stub/ResourceSettingsServiceStubSettings.java
+++ b/java-resource-settings/google-cloud-resource-settings/src/main/java/com/google/cloud/resourcesettings/v1/stub/ResourceSettingsServiceStubSettings.java
@@ -27,6 +27,9 @@
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiCallContext;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
@@ -178,6 +181,11 @@ public ResourceSettingsServiceStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcResourceSettingsServiceStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonResourceSettingsServiceStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -210,18 +218,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
- public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(ResourceSettingsServiceStubSettings.class))
@@ -229,11 +244,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(ResourceSettingsServiceStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return ResourceSettingsServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -336,6 +370,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
private static Builder initDefaults(Builder builder) {
builder
.listSettingsSettings()
diff --git a/java-resource-settings/google-cloud-resource-settings/src/test/java/com/google/cloud/resourcesettings/v1/ResourceSettingsServiceClientHttpJsonTest.java b/java-resource-settings/google-cloud-resource-settings/src/test/java/com/google/cloud/resourcesettings/v1/ResourceSettingsServiceClientHttpJsonTest.java
new file mode 100644
index 000000000000..56a62a834d53
--- /dev/null
+++ b/java-resource-settings/google-cloud-resource-settings/src/test/java/com/google/cloud/resourcesettings/v1/ResourceSettingsServiceClientHttpJsonTest.java
@@ -0,0 +1,394 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1;
+
+import static com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient.ListSettingsPagedResponse;
+
+import com.google.api.gax.core.NoCredentialsProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.testing.MockHttpService;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ApiException;
+import com.google.api.gax.rpc.ApiExceptionFactory;
+import com.google.api.gax.rpc.InvalidArgumentException;
+import com.google.api.gax.rpc.StatusCode;
+import com.google.api.gax.rpc.testing.FakeStatusCode;
+import com.google.api.resourcenames.ResourceName;
+import com.google.cloud.resourcesettings.v1.stub.HttpJsonResourceSettingsServiceStub;
+import com.google.common.collect.Lists;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Generated;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@Generated("by gapic-generator-java")
+public class ResourceSettingsServiceClientHttpJsonTest {
+ private static MockHttpService mockService;
+ private static ResourceSettingsServiceClient client;
+
+ @BeforeClass
+ public static void startStaticServer() throws IOException {
+ mockService =
+ new MockHttpService(
+ HttpJsonResourceSettingsServiceStub.getMethodDescriptors(),
+ ResourceSettingsServiceSettings.getDefaultEndpoint());
+ ResourceSettingsServiceSettings settings =
+ ResourceSettingsServiceSettings.newHttpJsonBuilder()
+ .setTransportChannelProvider(
+ ResourceSettingsServiceSettings.defaultHttpJsonTransportProviderBuilder()
+ .setHttpTransport(mockService)
+ .build())
+ .setCredentialsProvider(NoCredentialsProvider.create())
+ .build();
+ client = ResourceSettingsServiceClient.create(settings);
+ }
+
+ @AfterClass
+ public static void stopServer() {
+ client.close();
+ }
+
+ @Before
+ public void setUp() {}
+
+ @After
+ public void tearDown() throws Exception {
+ mockService.reset();
+ }
+
+ @Test
+ public void listSettingsTest() throws Exception {
+ Setting responsesElement = Setting.newBuilder().build();
+ ListSettingsResponse expectedResponse =
+ ListSettingsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllSettings(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ResourceName parent =
+ new ResourceName() {
+ @Override
+ public Map getFieldValuesMap() {
+ Map fieldValuesMap = new HashMap<>();
+ fieldValuesMap.put("parent", "organizations/organization-8287");
+ return fieldValuesMap;
+ }
+
+ @Override
+ public String getFieldValue(String fieldName) {
+ return getFieldValuesMap().get(fieldName);
+ }
+
+ @Override
+ public String toString() {
+ return "organizations/organization-8287";
+ }
+ };
+
+ ListSettingsPagedResponse pagedListResponse = client.listSettings(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getSettingsList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listSettingsExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ResourceName parent =
+ new ResourceName() {
+ @Override
+ public Map getFieldValuesMap() {
+ Map fieldValuesMap = new HashMap<>();
+ fieldValuesMap.put("parent", "organizations/organization-8287");
+ return fieldValuesMap;
+ }
+
+ @Override
+ public String getFieldValue(String fieldName) {
+ return getFieldValuesMap().get(fieldName);
+ }
+
+ @Override
+ public String toString() {
+ return "organizations/organization-8287";
+ }
+ };
+ client.listSettings(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listSettingsTest2() throws Exception {
+ Setting responsesElement = Setting.newBuilder().build();
+ ListSettingsResponse expectedResponse =
+ ListSettingsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllSettings(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String parent = "organizations/organization-8287";
+
+ ListSettingsPagedResponse pagedListResponse = client.listSettings(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getSettingsList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listSettingsExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String parent = "organizations/organization-8287";
+ client.listSettings(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getSettingTest() throws Exception {
+ Setting expectedResponse =
+ Setting.newBuilder()
+ .setName(
+ SettingName.ofOrganizationSettingNameName("[ORGANIZATION]", "[SETTING_NAME]")
+ .toString())
+ .setMetadata(SettingMetadata.newBuilder().build())
+ .setLocalValue(Value.newBuilder().build())
+ .setEffectiveValue(Value.newBuilder().build())
+ .setEtag("etag3123477")
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ SettingName name =
+ SettingName.ofOrganizationSettingNameName("[ORGANIZATION]", "[SETTING_NAME]");
+
+ Setting actualResponse = client.getSetting(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void getSettingExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ SettingName name =
+ SettingName.ofOrganizationSettingNameName("[ORGANIZATION]", "[SETTING_NAME]");
+ client.getSetting(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getSettingTest2() throws Exception {
+ Setting expectedResponse =
+ Setting.newBuilder()
+ .setName(
+ SettingName.ofOrganizationSettingNameName("[ORGANIZATION]", "[SETTING_NAME]")
+ .toString())
+ .setMetadata(SettingMetadata.newBuilder().build())
+ .setLocalValue(Value.newBuilder().build())
+ .setEffectiveValue(Value.newBuilder().build())
+ .setEtag("etag3123477")
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String name = "organizations/organization-4339/settings/setting-4339";
+
+ Setting actualResponse = client.getSetting(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void getSettingExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String name = "organizations/organization-4339/settings/setting-4339";
+ client.getSetting(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void updateSettingTest() throws Exception {
+ Setting expectedResponse =
+ Setting.newBuilder()
+ .setName(
+ SettingName.ofOrganizationSettingNameName("[ORGANIZATION]", "[SETTING_NAME]")
+ .toString())
+ .setMetadata(SettingMetadata.newBuilder().build())
+ .setLocalValue(Value.newBuilder().build())
+ .setEffectiveValue(Value.newBuilder().build())
+ .setEtag("etag3123477")
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ UpdateSettingRequest request =
+ UpdateSettingRequest.newBuilder()
+ .setSetting(
+ Setting.newBuilder()
+ .setName(
+ SettingName.ofProjectNumberSettingNameName(
+ "[PROJECT_NUMBER]", "[SETTING_NAME]")
+ .toString())
+ .setMetadata(SettingMetadata.newBuilder().build())
+ .setLocalValue(Value.newBuilder().build())
+ .setEffectiveValue(Value.newBuilder().build())
+ .setEtag("etag3123477")
+ .build())
+ .build();
+
+ Setting actualResponse = client.updateSetting(request);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void updateSettingExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ UpdateSettingRequest request =
+ UpdateSettingRequest.newBuilder()
+ .setSetting(
+ Setting.newBuilder()
+ .setName(
+ SettingName.ofProjectNumberSettingNameName(
+ "[PROJECT_NUMBER]", "[SETTING_NAME]")
+ .toString())
+ .setMetadata(SettingMetadata.newBuilder().build())
+ .setLocalValue(Value.newBuilder().build())
+ .setEffectiveValue(Value.newBuilder().build())
+ .setEtag("etag3123477")
+ .build())
+ .build();
+ client.updateSetting(request);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+}
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/create/SyncCreateSetCredentialsProvider.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/create/SyncCreateSetCredentialsProvider.java
new file mode 100644
index 000000000000..1137798bedce
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/create/SyncCreateSetCredentialsProvider.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START
+// resourcesettings_v1_generated_resourcesettingsserviceclient_create_setcredentialsprovider_sync]
+import com.google.api.gax.core.FixedCredentialsProvider;
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceSettings;
+import com.google.cloud.resourcesettings.v1.myCredentials;
+
+public class SyncCreateSetCredentialsProvider {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider();
+ }
+
+ public static void syncCreateSetCredentialsProvider() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ ResourceSettingsServiceSettings resourceSettingsServiceSettings =
+ ResourceSettingsServiceSettings.newBuilder()
+ .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ .build();
+ ResourceSettingsServiceClient resourceSettingsServiceClient =
+ ResourceSettingsServiceClient.create(resourceSettingsServiceSettings);
+ }
+}
+// [END
+// resourcesettings_v1_generated_resourcesettingsserviceclient_create_setcredentialsprovider_sync]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/create/SyncCreateSetCredentialsProvider1.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/create/SyncCreateSetCredentialsProvider1.java
new file mode 100644
index 000000000000..705cf67b7055
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/create/SyncCreateSetCredentialsProvider1.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START
+// resourcesettings_v1_generated_resourcesettingsserviceclient_create_setcredentialsprovider1_sync]
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceSettings;
+
+public class SyncCreateSetCredentialsProvider1 {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider1();
+ }
+
+ public static void syncCreateSetCredentialsProvider1() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ ResourceSettingsServiceSettings resourceSettingsServiceSettings =
+ ResourceSettingsServiceSettings.newBuilder()
+ .setTransportChannelProvider(
+ ResourceSettingsServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ .build();
+ ResourceSettingsServiceClient resourceSettingsServiceClient =
+ ResourceSettingsServiceClient.create(resourceSettingsServiceSettings);
+ }
+}
+// [END
+// resourcesettings_v1_generated_resourcesettingsserviceclient_create_setcredentialsprovider1_sync]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/create/SyncCreateSetEndpoint.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/create/SyncCreateSetEndpoint.java
new file mode 100644
index 000000000000..ed599c828d56
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/create/SyncCreateSetEndpoint.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsserviceclient_create_setendpoint_sync]
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceSettings;
+import com.google.cloud.resourcesettings.v1.myEndpoint;
+
+public class SyncCreateSetEndpoint {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetEndpoint();
+ }
+
+ public static void syncCreateSetEndpoint() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ ResourceSettingsServiceSettings resourceSettingsServiceSettings =
+ ResourceSettingsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ ResourceSettingsServiceClient resourceSettingsServiceClient =
+ ResourceSettingsServiceClient.create(resourceSettingsServiceSettings);
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_create_setendpoint_sync]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/AsyncGetSetting.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/AsyncGetSetting.java
new file mode 100644
index 000000000000..14d0b9d267c7
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/AsyncGetSetting.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsserviceclient_getsetting_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.resourcesettings.v1.GetSettingRequest;
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.Setting;
+import com.google.cloud.resourcesettings.v1.SettingName;
+import com.google.cloud.resourcesettings.v1.SettingView;
+
+public class AsyncGetSetting {
+
+ public static void main(String[] args) throws Exception {
+ asyncGetSetting();
+ }
+
+ public static void asyncGetSetting() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ResourceSettingsServiceClient resourceSettingsServiceClient =
+ ResourceSettingsServiceClient.create()) {
+ GetSettingRequest request =
+ GetSettingRequest.newBuilder()
+ .setName(
+ SettingName.ofOrganizationSettingNameName("[ORGANIZATION]", "[SETTING_NAME]")
+ .toString())
+ .setView(SettingView.forNumber(0))
+ .build();
+ ApiFuture future =
+ resourceSettingsServiceClient.getSettingCallable().futureCall(request);
+ // Do something.
+ Setting response = future.get();
+ }
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_getsetting_async]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/SyncGetSetting.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/SyncGetSetting.java
new file mode 100644
index 000000000000..642bcfc8711b
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/SyncGetSetting.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsserviceclient_getsetting_sync]
+import com.google.cloud.resourcesettings.v1.GetSettingRequest;
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.Setting;
+import com.google.cloud.resourcesettings.v1.SettingName;
+import com.google.cloud.resourcesettings.v1.SettingView;
+
+public class SyncGetSetting {
+
+ public static void main(String[] args) throws Exception {
+ syncGetSetting();
+ }
+
+ public static void syncGetSetting() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ 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);
+ }
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_getsetting_sync]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/SyncGetSettingSettingname.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/SyncGetSettingSettingname.java
new file mode 100644
index 000000000000..364a55ae7e0c
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/SyncGetSettingSettingname.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsserviceclient_getsetting_settingname_sync]
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.Setting;
+import com.google.cloud.resourcesettings.v1.SettingName;
+
+public class SyncGetSettingSettingname {
+
+ public static void main(String[] args) throws Exception {
+ syncGetSettingSettingname();
+ }
+
+ public static void syncGetSettingSettingname() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ResourceSettingsServiceClient resourceSettingsServiceClient =
+ ResourceSettingsServiceClient.create()) {
+ SettingName name =
+ SettingName.ofOrganizationSettingNameName("[ORGANIZATION]", "[SETTING_NAME]");
+ Setting response = resourceSettingsServiceClient.getSetting(name);
+ }
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_getsetting_settingname_sync]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/SyncGetSettingString.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/SyncGetSettingString.java
new file mode 100644
index 000000000000..119efad36d82
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/getsetting/SyncGetSettingString.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsserviceclient_getsetting_string_sync]
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.Setting;
+import com.google.cloud.resourcesettings.v1.SettingName;
+
+public class SyncGetSettingString {
+
+ public static void main(String[] args) throws Exception {
+ syncGetSettingString();
+ }
+
+ public static void syncGetSettingString() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ResourceSettingsServiceClient resourceSettingsServiceClient =
+ ResourceSettingsServiceClient.create()) {
+ String name =
+ SettingName.ofProjectNumberSettingNameName("[PROJECT_NUMBER]", "[SETTING_NAME]")
+ .toString();
+ Setting response = resourceSettingsServiceClient.getSetting(name);
+ }
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_getsetting_string_sync]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/AsyncListSettings.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/AsyncListSettings.java
new file mode 100644
index 000000000000..a06ed142e08a
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/AsyncListSettings.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsserviceclient_listsettings_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.resourcesettings.v1.ListSettingsRequest;
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.Setting;
+import com.google.cloud.resourcesettings.v1.SettingView;
+
+public class AsyncListSettings {
+
+ public static void main(String[] args) throws Exception {
+ asyncListSettings();
+ }
+
+ public static void asyncListSettings() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ResourceSettingsServiceClient resourceSettingsServiceClient =
+ ResourceSettingsServiceClient.create()) {
+ ListSettingsRequest request =
+ ListSettingsRequest.newBuilder()
+ .setParent("ListSettingsRequest-286838706".toString())
+ .setPageSize(883849137)
+ .setPageToken("pageToken873572522")
+ .setView(SettingView.forNumber(0))
+ .build();
+ ApiFuture future =
+ resourceSettingsServiceClient.listSettingsPagedCallable().futureCall(request);
+ // Do something.
+ for (Setting element : future.get().iterateAll()) {
+ // doThingsWith(element);
+ }
+ }
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_listsettings_async]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/AsyncListSettingsPaged.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/AsyncListSettingsPaged.java
new file mode 100644
index 000000000000..3ef7f363357d
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/AsyncListSettingsPaged.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsserviceclient_listsettings_paged_async]
+import com.google.cloud.resourcesettings.v1.ListSettingsRequest;
+import com.google.cloud.resourcesettings.v1.ListSettingsResponse;
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.Setting;
+import com.google.cloud.resourcesettings.v1.SettingView;
+import com.google.common.base.Strings;
+
+public class AsyncListSettingsPaged {
+
+ public static void main(String[] args) throws Exception {
+ asyncListSettingsPaged();
+ }
+
+ public static void asyncListSettingsPaged() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ 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;
+ }
+ }
+ }
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_listsettings_paged_async]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/SyncListSettings.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/SyncListSettings.java
new file mode 100644
index 000000000000..6a1d8cc2e123
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/SyncListSettings.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsserviceclient_listsettings_sync]
+import com.google.cloud.resourcesettings.v1.ListSettingsRequest;
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.Setting;
+import com.google.cloud.resourcesettings.v1.SettingView;
+
+public class SyncListSettings {
+
+ public static void main(String[] args) throws Exception {
+ syncListSettings();
+ }
+
+ public static void syncListSettings() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ 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);
+ }
+ }
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_listsettings_sync]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/SyncListSettingsResourcename.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/SyncListSettingsResourcename.java
new file mode 100644
index 000000000000..fb7cfda95fe9
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/SyncListSettingsResourcename.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START
+// resourcesettings_v1_generated_resourcesettingsserviceclient_listsettings_resourcename_sync]
+import com.google.api.resourcenames.ResourceName;
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.Setting;
+import java.util.HashMap;
+import java.util.Map;
+
+public class SyncListSettingsResourcename {
+
+ public static void main(String[] args) throws Exception {
+ syncListSettingsResourcename();
+ }
+
+ public static void syncListSettingsResourcename() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ResourceSettingsServiceClient resourceSettingsServiceClient =
+ ResourceSettingsServiceClient.create()) {
+ ResourceName parent =
+ new ResourceName() {
+ @Override
+ public Map getFieldValuesMap() {
+ Map fieldValuesMap = new HashMap<>();
+ fieldValuesMap.put("parent", "organizations/organization-8287");
+ return fieldValuesMap;
+ }
+
+ @Override
+ public String getFieldValue(String fieldName) {
+ return getFieldValuesMap().get(fieldName);
+ }
+
+ @Override
+ public String toString() {
+ return "organizations/organization-8287";
+ }
+ };
+ for (Setting element : resourceSettingsServiceClient.listSettings(parent).iterateAll()) {
+ // doThingsWith(element);
+ }
+ }
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_listsettings_resourcename_sync]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/SyncListSettingsString.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/SyncListSettingsString.java
new file mode 100644
index 000000000000..577cb49eedb5
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/listsettings/SyncListSettingsString.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsserviceclient_listsettings_string_sync]
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.Setting;
+import com.google.cloud.resourcesettings.v1.SettingName;
+
+public class SyncListSettingsString {
+
+ public static void main(String[] args) throws Exception {
+ syncListSettingsString();
+ }
+
+ public static void syncListSettingsString() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ResourceSettingsServiceClient resourceSettingsServiceClient =
+ ResourceSettingsServiceClient.create()) {
+ String parent =
+ SettingName.ofProjectNumberSettingNameName("[PROJECT_NUMBER]", "[SETTING_NAME]")
+ .toString();
+ for (Setting element : resourceSettingsServiceClient.listSettings(parent).iterateAll()) {
+ // doThingsWith(element);
+ }
+ }
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_listsettings_string_sync]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/updatesetting/AsyncUpdateSetting.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/updatesetting/AsyncUpdateSetting.java
new file mode 100644
index 000000000000..99f399cc3ff6
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/updatesetting/AsyncUpdateSetting.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsserviceclient_updatesetting_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.Setting;
+import com.google.cloud.resourcesettings.v1.UpdateSettingRequest;
+
+public class AsyncUpdateSetting {
+
+ public static void main(String[] args) throws Exception {
+ asyncUpdateSetting();
+ }
+
+ public static void asyncUpdateSetting() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ResourceSettingsServiceClient resourceSettingsServiceClient =
+ ResourceSettingsServiceClient.create()) {
+ UpdateSettingRequest request =
+ UpdateSettingRequest.newBuilder().setSetting(Setting.newBuilder().build()).build();
+ ApiFuture future =
+ resourceSettingsServiceClient.updateSettingCallable().futureCall(request);
+ // Do something.
+ Setting response = future.get();
+ }
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_updatesetting_async]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/updatesetting/SyncUpdateSetting.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/updatesetting/SyncUpdateSetting.java
new file mode 100644
index 000000000000..b005bb1fe0e3
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsserviceclient/updatesetting/SyncUpdateSetting.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsserviceclient_updatesetting_sync]
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClient;
+import com.google.cloud.resourcesettings.v1.Setting;
+import com.google.cloud.resourcesettings.v1.UpdateSettingRequest;
+
+public class SyncUpdateSetting {
+
+ public static void main(String[] args) throws Exception {
+ syncUpdateSetting();
+ }
+
+ public static void syncUpdateSetting() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ResourceSettingsServiceClient resourceSettingsServiceClient =
+ ResourceSettingsServiceClient.create()) {
+ UpdateSettingRequest request =
+ UpdateSettingRequest.newBuilder().setSetting(Setting.newBuilder().build()).build();
+ Setting response = resourceSettingsServiceClient.updateSetting(request);
+ }
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsserviceclient_updatesetting_sync]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsservicesettings/getsetting/SyncGetSetting.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsservicesettings/getsetting/SyncGetSetting.java
new file mode 100644
index 000000000000..ce076a2dd147
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/resourcesettingsservicesettings/getsetting/SyncGetSetting.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsservicesettings_getsetting_sync]
+import com.google.cloud.resourcesettings.v1.ResourceSettingsServiceSettings;
+import java.time.Duration;
+
+public class SyncGetSetting {
+
+ public static void main(String[] args) throws Exception {
+ syncGetSetting();
+ }
+
+ public static void syncGetSetting() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ ResourceSettingsServiceSettings.Builder resourceSettingsServiceSettingsBuilder =
+ ResourceSettingsServiceSettings.newBuilder();
+ resourceSettingsServiceSettingsBuilder
+ .getSettingSettings()
+ .setRetrySettings(
+ resourceSettingsServiceSettingsBuilder
+ .getSettingSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ ResourceSettingsServiceSettings resourceSettingsServiceSettings =
+ resourceSettingsServiceSettingsBuilder.build();
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsservicesettings_getsetting_sync]
diff --git a/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/stub/resourcesettingsservicestubsettings/getsetting/SyncGetSetting.java b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/stub/resourcesettingsservicestubsettings/getsetting/SyncGetSetting.java
new file mode 100644
index 000000000000..4b30d2cd1e4c
--- /dev/null
+++ b/java-resource-settings/samples/snippets/generated/com/google/cloud/resourcesettings/v1/stub/resourcesettingsservicestubsettings/getsetting/SyncGetSetting.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.resourcesettings.v1.stub.samples;
+
+// [START resourcesettings_v1_generated_resourcesettingsservicestubsettings_getsetting_sync]
+import com.google.cloud.resourcesettings.v1.stub.ResourceSettingsServiceStubSettings;
+import java.time.Duration;
+
+public class SyncGetSetting {
+
+ public static void main(String[] args) throws Exception {
+ syncGetSetting();
+ }
+
+ public static void syncGetSetting() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ ResourceSettingsServiceStubSettings.Builder resourceSettingsServiceSettingsBuilder =
+ ResourceSettingsServiceStubSettings.newBuilder();
+ resourceSettingsServiceSettingsBuilder
+ .getSettingSettings()
+ .setRetrySettings(
+ resourceSettingsServiceSettingsBuilder
+ .getSettingSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ ResourceSettingsServiceStubSettings resourceSettingsServiceSettings =
+ resourceSettingsServiceSettingsBuilder.build();
+ }
+}
+// [END resourcesettings_v1_generated_resourcesettingsservicestubsettings_getsetting_sync]