diff --git a/src/main/java/com/google/api/generator/engine/writer/ImportWriterVisitor.java b/src/main/java/com/google/api/generator/engine/writer/ImportWriterVisitor.java index 85274e34b9..8774718e6d 100644 --- a/src/main/java/com/google/api/generator/engine/writer/ImportWriterVisitor.java +++ b/src/main/java/com/google/api/generator/engine/writer/ImportWriterVisitor.java @@ -60,7 +60,6 @@ import com.google.api.generator.engine.ast.VaporReference; import com.google.api.generator.engine.ast.VariableExpr; import com.google.api.generator.engine.ast.WhileStatement; -import com.google.common.base.Preconditions; import com.google.common.base.Strings; import java.util.ArrayList; import java.util.Arrays; @@ -359,11 +358,6 @@ public void visit(TryCatchStatement tryCatchStatement) { } statements(tryCatchStatement.tryBody()); - - Preconditions.checkState( - !tryCatchStatement.isSampleCode() && !tryCatchStatement.catchVariableExprs().isEmpty(), - "Import generation should not be invoked on sample code, but was found when visiting a" - + " try-catch block"); for (int i = 0; i < tryCatchStatement.catchVariableExprs().size(); i++) { tryCatchStatement.catchVariableExprs().get(i).accept(this); statements(tryCatchStatement.catchBlocks().get(i)); diff --git a/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceClientClassComposer.java b/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceClientClassComposer.java index beb777f543..df1cd05e53 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceClientClassComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceClientClassComposer.java @@ -55,6 +55,7 @@ import com.google.api.generator.engine.ast.Variable; import com.google.api.generator.engine.ast.VariableExpr; import com.google.api.generator.gapic.composer.comment.ServiceClientCommentComposer; +import com.google.api.generator.gapic.composer.samplecode.ExecutableSampleComposer; import com.google.api.generator.gapic.composer.samplecode.ServiceClientSampleCodeComposer; import com.google.api.generator.gapic.composer.store.TypeStore; import com.google.api.generator.gapic.composer.utils.ClassNames; @@ -99,6 +100,8 @@ import java.util.stream.Collectors; import javax.annotation.Generated; +import static com.google.api.generator.gapic.composer.samplecode.ExecutableSampleComposer.createExecutableSample; + public abstract class AbstractServiceClientClassComposer implements ClassComposer { private static final String PAGED_RESPONSE_TYPE_NAME_PATTERN = "%sPagedResponse"; private static final String CALLABLE_NAME_PATTERN = "%sCallable"; @@ -192,11 +195,11 @@ private static List createClassHeaderComments( ServiceClientSampleCodeComposer.composeClassHeaderMethodSampleCode( service, clientType, resourceNames, messageTypes); String credentialsSampleCode = - ServiceClientSampleCodeComposer.composeClassHeaderCredentialsSampleCode( - clientType, settingsType); + createExecutableSample(ServiceClientSampleCodeComposer.composeClassHeaderCredentialsSampleCode( + clientType, settingsType)); String endpointSampleCode = - ServiceClientSampleCodeComposer.composeClassHeaderEndpointSampleCode( - clientType, settingsType); + createExecutableSample(ServiceClientSampleCodeComposer.composeClassHeaderEndpointSampleCode( + clientType, settingsType)); return ServiceClientCommentComposer.createClassHeaderComments( service, classMethodSampleCode, credentialsSampleCode, endpointSampleCode); } @@ -697,8 +700,8 @@ private static List createMethodVariants( Optional methodSampleCode = Optional.of( - ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( - method, typeStore.get(clientName), signature, resourceNames, messageTypes)); + createExecutableSample(ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( + method, typeStore.get(clientName), signature, resourceNames, messageTypes))); MethodDefinition.Builder methodVariantBuilder = MethodDefinition.builder() .setHeaderCommentStatements( @@ -777,8 +780,8 @@ private static MethodDefinition createMethodDefaultMethod( Optional defaultMethodSampleCode = Optional.of( - ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( - method, typeStore.get(clientName), resourceNames, messageTypes)); + createExecutableSample(ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( + method, typeStore.get(clientName), resourceNames, messageTypes))); MethodInvocationExpr callableMethodExpr = MethodInvocationExpr.builder().setMethodName(callableMethodName).build(); @@ -900,36 +903,36 @@ private static MethodDefinition createCallableMethod( if (callableMethodKind.equals(CallableMethodKind.LRO)) { sampleCodeOpt = Optional.of( - ServiceClientSampleCodeComposer.composeLroCallableMethodHeaderSampleCode( + createExecutableSample(ServiceClientSampleCodeComposer.composeLroCallableMethodHeaderSampleCode( method, typeStore.get(ClassNames.getServiceClientClassName(service)), resourceNames, - messageTypes)); + messageTypes))); } else if (callableMethodKind.equals(CallableMethodKind.PAGED)) { sampleCodeOpt = Optional.of( - ServiceClientSampleCodeComposer.composePagedCallableMethodHeaderSampleCode( + createExecutableSample(ServiceClientSampleCodeComposer.composePagedCallableMethodHeaderSampleCode( method, typeStore.get(ClassNames.getServiceClientClassName(service)), resourceNames, - messageTypes)); + messageTypes))); } else if (callableMethodKind.equals(CallableMethodKind.REGULAR)) { if (method.stream().equals(Stream.NONE)) { sampleCodeOpt = Optional.of( - ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( + createExecutableSample(ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( method, typeStore.get(ClassNames.getServiceClientClassName(service)), resourceNames, - messageTypes)); + messageTypes))); } else { sampleCodeOpt = Optional.of( - ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( + createExecutableSample(ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( method, typeStore.get(ClassNames.getServiceClientClassName(service)), resourceNames, - messageTypes)); + messageTypes))); } } diff --git a/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceSettingsClassComposer.java b/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceSettingsClassComposer.java index ccf15a1d64..67c19326d5 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceSettingsClassComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceSettingsClassComposer.java @@ -50,6 +50,8 @@ import com.google.api.generator.engine.ast.Variable; import com.google.api.generator.engine.ast.VariableExpr; import com.google.api.generator.gapic.composer.comment.SettingsCommentComposer; +import com.google.api.generator.gapic.composer.samplecode.ExecutableSample; +import com.google.api.generator.gapic.composer.samplecode.ExecutableSampleComposer; import com.google.api.generator.gapic.composer.samplecode.SettingsSampleCodeComposer; import com.google.api.generator.gapic.composer.store.TypeStore; import com.google.api.generator.gapic.composer.utils.ClassNames; @@ -140,8 +142,8 @@ private static List createClassHeaderComments( Optional methodNameOpt = methodOpt.isPresent() ? Optional.of(methodOpt.get().name()) : Optional.empty(); Optional sampleCodeOpt = - SettingsSampleCodeComposer.composeSampleCode( - methodNameOpt, ClassNames.getServiceSettingsClassName(service), classType); + ExecutableSampleComposer.createExecutableSample(SettingsSampleCodeComposer.composeSampleCode( + methodNameOpt, ClassNames.getServiceSettingsClassName(service), classType)); return SettingsCommentComposer.createClassHeaderComments( ClassNames.getServiceClientClassName(service), service.defaultHost(), diff --git a/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java b/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java index 7ec411185f..6c00896230 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java @@ -79,6 +79,8 @@ import com.google.api.generator.engine.ast.Variable; import com.google.api.generator.engine.ast.VariableExpr; import com.google.api.generator.gapic.composer.comment.SettingsCommentComposer; +import com.google.api.generator.gapic.composer.samplecode.ExecutableSample; +import com.google.api.generator.gapic.composer.samplecode.ExecutableSampleComposer; import com.google.api.generator.gapic.composer.samplecode.SettingsSampleCodeComposer; import com.google.api.generator.gapic.composer.store.TypeStore; import com.google.api.generator.gapic.composer.utils.ClassNames; @@ -390,8 +392,8 @@ private static List createClassHeaderComments( Optional methodNameOpt = methodOpt.isPresent() ? Optional.of(methodOpt.get().name()) : Optional.empty(); Optional sampleCodeOpt = - SettingsSampleCodeComposer.composeSampleCode( - methodNameOpt, ClassNames.getServiceSettingsClassName(service), classType); + ExecutableSampleComposer.createExecutableSample(SettingsSampleCodeComposer.composeSampleCode( + methodNameOpt, ClassNames.getServiceSettingsClassName(service), classType)); return SettingsCommentComposer.createClassHeaderComments( ClassNames.getServiceStubClassName(service), diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSample.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSample.java new file mode 100644 index 0000000000..8fea5296c5 --- /dev/null +++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSample.java @@ -0,0 +1,46 @@ +// Copyright 2021 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 +// +// http://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.api.generator.gapic.composer.samplecode; + +import com.google.api.generator.engine.ast.AssignmentExpr; +import com.google.api.generator.engine.ast.Statement; +import java.util.List; + +public class ExecutableSample { + private final String sampleName; + private final List sampleVariableAssignments; + private final List sampleBody; + + public ExecutableSample( + String sampleName, + List sampleVariableAssignments, + List sampleBody) { + this.sampleName = sampleName; + this.sampleVariableAssignments = sampleVariableAssignments; + this.sampleBody = sampleBody; + } + + public String getSampleName() { + return sampleName; + } + + public List getSampleVariableAssignments() { + return sampleVariableAssignments; + } + + public List getSampleBody() { + return sampleBody; + } +} diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposer.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposer.java new file mode 100644 index 0000000000..58bcd29110 --- /dev/null +++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposer.java @@ -0,0 +1,142 @@ +// Copyright 2021 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 +// +// http://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.api.generator.gapic.composer.samplecode; + +import com.google.api.generator.engine.ast.AssignmentExpr; +import com.google.api.generator.engine.ast.ClassDefinition; +import com.google.api.generator.engine.ast.Expr; +import com.google.api.generator.engine.ast.ExprStatement; +import com.google.api.generator.engine.ast.MethodDefinition; +import com.google.api.generator.engine.ast.MethodInvocationExpr; +import com.google.api.generator.engine.ast.ScopeNode; +import com.google.api.generator.engine.ast.Statement; +import com.google.api.generator.engine.ast.TypeNode; +import com.google.api.generator.engine.ast.Variable; +import com.google.api.generator.engine.ast.VariableExpr; +import com.google.api.generator.gapic.utils.JavaStyle; +import com.google.common.collect.ImmutableList; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +public class ExecutableSampleComposer { + public static Optional createExecutableSample( + Optional executableSample) { + if (executableSample.isPresent()) { + return Optional.of(createExecutableSample(executableSample.get())); + } + return Optional.empty(); + } + + public static String createExecutableSample(ExecutableSample executableSample) { + String sampleMethodName = JavaStyle.toLowerCamelCase(executableSample.getSampleName()); + return SampleCodeWriter.write( + composeExecutableSample( + sampleMethodName, + executableSample.getSampleVariableAssignments(), + executableSample.getSampleBody())); + } + + private static ClassDefinition composeExecutableSample( + String sampleMethodName, + List sampleVariableAssignments, + List sampleBody) { + String sampleClassName = JavaStyle.toUpperCamelCase(sampleMethodName); + List sampleMethodArgs = composeSampleMethodArgs(sampleVariableAssignments); + MethodDefinition mainMethod = + composeMainMethod( + composeMainBody( + sampleVariableAssignments, + composeInvokeMethodStatement(sampleMethodName, sampleMethodArgs))); + MethodDefinition sampleMethod = + composeSampleMethod(sampleMethodName, sampleMethodArgs, sampleBody); + return composeSampleClass(sampleClassName, mainMethod, sampleMethod); + } + + private static List composeSampleMethodArgs( + List sampleVariableAssignments) { + return sampleVariableAssignments.stream() + .map(v -> v.variableExpr().toBuilder().setIsDecl(true).build()) + .collect(Collectors.toList()); + } + + private static Statement composeInvokeMethodStatement( + String sampleMethodName, List sampleMethodArgs) { + List invokeArgs = + sampleMethodArgs.stream() + .map(arg -> arg.toBuilder().setIsDecl(false).build()) + .collect(Collectors.toList()); + return ExprStatement.withExpr( + MethodInvocationExpr.builder() + .setMethodName(sampleMethodName) + .setArguments(invokeArgs) + .build()); + } + + private static List composeMainBody( + List sampleVariableAssignments, Statement invokeMethod) { + List setVariables = + sampleVariableAssignments.stream() + .map(var -> ExprStatement.withExpr(var)) + .collect(Collectors.toList()); + List body = new ArrayList<>(setVariables); + body.add(invokeMethod); + return body; + } + + private static ClassDefinition composeSampleClass( + String sampleClassName, MethodDefinition mainMethod, MethodDefinition sampleMethod) { + return ClassDefinition.builder() + .setScope(ScopeNode.PUBLIC) + .setPackageString("com.google.example") + .setName(sampleClassName) + .setMethods(ImmutableList.of(mainMethod, sampleMethod)) + .build(); + } + + private static MethodDefinition composeMainMethod(List mainBody) { + return MethodDefinition.builder() + .setScope(ScopeNode.PUBLIC) + .setIsStatic(true) + .setReturnType(TypeNode.VOID) + .setName("main") + .setArguments( + VariableExpr.builder() + .setVariable( + Variable.builder().setType(TypeNode.STRING_ARRAY).setName("args").build()) + .setIsDecl(true) + .build()) + .setThrowsExceptions(Arrays.asList(TypeNode.withExceptionClazz(Exception.class))) + .setBody(mainBody) + .build(); + } + + private static MethodDefinition composeSampleMethod( + String sampleMethodName, + List sampleMethodArgs, + List sampleMethodBody) { + return MethodDefinition.builder() + .setScope(ScopeNode.PUBLIC) + .setIsStatic(true) + .setReturnType(TypeNode.VOID) + .setName(sampleMethodName) + .setArguments(sampleMethodArgs) + .setThrowsExceptions(Arrays.asList(TypeNode.withExceptionClazz(Exception.class))) + .setBody(sampleMethodBody) + .build(); + } +} diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeWriter.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeWriter.java index 07abeb9a17..9eb7dfd57e 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeWriter.java +++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeWriter.java @@ -14,6 +14,8 @@ package com.google.api.generator.gapic.composer.samplecode; +import com.google.api.generator.engine.ast.ClassDefinition; +import com.google.api.generator.engine.ast.MethodInvocationExpr; import com.google.api.generator.engine.ast.Statement; import com.google.api.generator.engine.writer.JavaWriterVisitor; import java.util.Arrays; @@ -34,4 +36,18 @@ public static String write(List statements) { // Escape character "@" in the markdown code block
{@code...} tags.
     return formattedSampleCode.replaceAll("@", "{@literal @}");
   }
+
+  public static String write(ClassDefinition classDefinition) {
+    JavaWriterVisitor visitor = new JavaWriterVisitor();
+    classDefinition.accept(visitor);
+    // Escape character "@" in the markdown code block 
{@code...} tags.
+    return visitor.write().replaceAll("@", "{@literal @}");
+  }
+
+  public static String write(MethodInvocationExpr methodInvocationExpr) {
+    JavaWriterVisitor visitor = new JavaWriterVisitor();
+    methodInvocationExpr.accept(visitor);
+    // Escape character "@" in the markdown code block 
{@code...} tags.
+    return visitor.write();
+  }
 }
diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleUtil.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleUtil.java
new file mode 100644
index 0000000000..e33af9dd4b
--- /dev/null
+++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleUtil.java
@@ -0,0 +1,56 @@
+// Copyright 2021 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
+//
+//      http://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.api.generator.gapic.composer.samplecode;
+
+import com.google.api.generator.engine.ast.Expr;
+import com.google.api.generator.engine.ast.MethodInvocationExpr;
+import com.google.api.generator.engine.ast.StringObjectValue;
+import com.google.api.generator.engine.ast.TypeNode;
+import com.google.api.generator.engine.ast.ValueExpr;
+import com.google.api.generator.engine.ast.VaporReference;
+import com.google.api.generator.engine.ast.VariableExpr;
+import com.google.api.generator.gapic.utils.JavaStyle;
+import com.google.common.base.Preconditions;
+
+public class SampleUtil {
+  public static String composeSampleMethodName(String clientName, String methodName) {
+    Preconditions.checkArgument(
+        !clientName.isEmpty() && !methodName.isEmpty(),
+        "clientName and methodName must not be empty");
+    return JavaStyle.toLowerCamelCase(clientName + JavaStyle.toUpperCamelCase(methodName));
+  }
+
+  public static MethodInvocationExpr systemOutPrint(String content) {
+    return composeSystemOutPrint(ValueExpr.withValue(StringObjectValue.withValue(content)));
+  }
+
+  public static MethodInvocationExpr systemOutPrint(VariableExpr variableExpr) {
+    return composeSystemOutPrint(variableExpr.toBuilder().setIsDecl(false).build());
+  }
+
+  private static MethodInvocationExpr composeSystemOutPrint(Expr content) {
+    VaporReference out =
+        VaporReference.builder()
+            .setEnclosingClassNames("System")
+            .setName("out")
+            .setPakkage("java.lang")
+            .build();
+    return MethodInvocationExpr.builder()
+        .setStaticReferenceType(TypeNode.withReference(out))
+        .setMethodName("println")
+        .setArguments(content)
+        .build();
+  }
+}
diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleCodeComposer.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleCodeComposer.java
index df5a6cc583..a93344b4da 100644
--- a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleCodeComposer.java
+++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleCodeComposer.java
@@ -14,6 +14,9 @@
 
 package com.google.api.generator.gapic.composer.samplecode;
 
+import static com.google.api.generator.gapic.composer.samplecode.ExecutableSampleComposer.createExecutableSample;
+import static com.google.api.generator.gapic.composer.samplecode.SampleUtil.composeSampleMethodName;
+
 import com.google.api.core.ApiFuture;
 import com.google.api.gax.core.FixedCredentialsProvider;
 import com.google.api.gax.longrunning.OperationFuture;
@@ -79,17 +82,20 @@ public static String composeClassHeaderMethodSampleCode(
             .orElse(service.methods().get(0));
     if (method.stream() == Stream.NONE) {
       if (method.methodSignatures().isEmpty()) {
-        return composeRpcDefaultMethodHeaderSampleCode(
-            method, clientType, resourceNames, messageTypes);
+        return createExecutableSample(
+            composeRpcDefaultMethodHeaderSampleCode(
+                method, clientType, resourceNames, messageTypes));
       }
-      return composeRpcMethodHeaderSampleCode(
-          method, clientType, method.methodSignatures().get(0), resourceNames, messageTypes);
+      return createExecutableSample(
+          composeRpcMethodHeaderSampleCode(
+              method, clientType, method.methodSignatures().get(0), resourceNames, messageTypes));
     }
-    return composeStreamCallableMethodHeaderSampleCode(
-        method, clientType, resourceNames, messageTypes);
+    return createExecutableSample(
+        composeStreamCallableMethodHeaderSampleCode(
+            method, clientType, resourceNames, messageTypes));
   }
 
-  public static String composeClassHeaderCredentialsSampleCode(
+  public static ExecutableSample composeClassHeaderCredentialsSampleCode(
       TypeNode clientType, TypeNode settingsType) {
     // Initialize clientSettings with builder() method.
     // e.g. EchoSettings echoSettings =
@@ -155,13 +161,18 @@ public static String composeClassHeaderCredentialsSampleCode(
             .setVariableExpr(clientVarExpr.toBuilder().setIsDecl(true).build())
             .setValueExpr(createMethodExpr)
             .build();
-    return SampleCodeWriter.write(
+
+    List sampleBody =
         Arrays.asList(
-            ExprStatement.withExpr(initSettingsVarExpr),
-            ExprStatement.withExpr(initClientVarExpr)));
+            ExprStatement.withExpr(initSettingsVarExpr), ExprStatement.withExpr(initClientVarExpr));
+
+    return new ExecutableSample(
+        composeSampleMethodName(clientName, "setCredentialsProvider"),
+        new ArrayList<>(),
+        sampleBody);
   }
 
-  public static String composeClassHeaderEndpointSampleCode(
+  public static ExecutableSample composeClassHeaderEndpointSampleCode(
       TypeNode clientType, TypeNode settingsType) {
     // Initialize client settings with builder() method.
     // e.g. EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint("myEndpoint").build();
@@ -220,24 +231,24 @@ public static String composeClassHeaderEndpointSampleCode(
             .setValueExpr(createMethodExpr)
             .build();
 
-    return SampleCodeWriter.write(
+    List sampleBody =
         Arrays.asList(
-            ExprStatement.withExpr(initSettingsVarExpr),
-            ExprStatement.withExpr(initClientVarExpr)));
+            ExprStatement.withExpr(initSettingsVarExpr), ExprStatement.withExpr(initClientVarExpr));
+
+    return new ExecutableSample(
+        composeSampleMethodName(clientName, "setEndpoint"), new ArrayList<>(), sampleBody);
   }
 
-  public static String composeRpcMethodHeaderSampleCode(
+  public static ExecutableSample composeRpcMethodHeaderSampleCode(
       Method method,
       TypeNode clientType,
       List arguments,
       Map resourceNames,
       Map messageTypes) {
+    String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name());
     VariableExpr clientVarExpr =
         VariableExpr.withVariable(
-            Variable.builder()
-                .setName(JavaStyle.toLowerCamelCase(clientType.reference().name()))
-                .setType(clientType)
-                .build());
+            Variable.builder().setName(clientName).setType(clientType).build());
 
     // Assign method's arguments variable with the default values.
     List rpcMethodArgVarExprs = createRpcMethodArgumentVariableExprs(arguments);
@@ -265,25 +276,26 @@ public static String composeRpcMethodHeaderSampleCode(
               method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs));
     }
 
-    return SampleCodeWriter.write(
-        TryCatchStatement.builder()
-            .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
-            .setTryBody(bodyStatements)
-            .setIsSampleCode(true)
-            .build());
+    List sampleBody =
+        Arrays.asList(
+            TryCatchStatement.builder()
+                .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
+                .setTryBody(bodyStatements)
+                .setIsSampleCode(true)
+                .build());
+    return new ExecutableSample(
+        composeSampleMethodName(clientName, method.name()), new ArrayList<>(), sampleBody);
   }
 
-  public static String composeRpcDefaultMethodHeaderSampleCode(
+  public static ExecutableSample composeRpcDefaultMethodHeaderSampleCode(
       Method method,
       TypeNode clientType,
       Map resourceNames,
       Map messageTypes) {
+    String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name());
     VariableExpr clientVarExpr =
         VariableExpr.withVariable(
-            Variable.builder()
-                .setName(JavaStyle.toLowerCamelCase(clientType.reference().name()))
-                .setType(clientType)
-                .build());
+            Variable.builder().setName(clientName).setType(clientType).build());
 
     // Create request variable expression and assign with its default value.
     VariableExpr requestVarExpr =
@@ -322,26 +334,28 @@ public static String composeRpcDefaultMethodHeaderSampleCode(
               method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs));
     }
 
-    return SampleCodeWriter.write(
-        TryCatchStatement.builder()
-            .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
-            .setTryBody(bodyStatements)
-            .setIsSampleCode(true)
-            .build());
+    List sampleBody =
+        Arrays.asList(
+            TryCatchStatement.builder()
+                .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
+                .setTryBody(bodyStatements)
+                .setIsSampleCode(true)
+                .build());
+
+    return new ExecutableSample(
+        composeSampleMethodName(clientName, method.name()), new ArrayList<>(), sampleBody);
   }
 
   // Compose sample code for the method where it is CallableMethodKind.LRO.
-  public static String composeLroCallableMethodHeaderSampleCode(
+  public static ExecutableSample composeLroCallableMethodHeaderSampleCode(
       Method method,
       TypeNode clientType,
       Map resourceNames,
       Map messageTypes) {
+    String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name());
     VariableExpr clientVarExpr =
         VariableExpr.withVariable(
-            Variable.builder()
-                .setName(JavaStyle.toLowerCamelCase(clientType.reference().name()))
-                .setType(clientType)
-                .build());
+            Variable.builder().setName(clientName).setType(clientType).build());
     // Assign method's request variable with the default value.
     VariableExpr requestVarExpr =
         VariableExpr.withVariable(
@@ -434,26 +448,28 @@ public static String composeLroCallableMethodHeaderSampleCode(
         bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList()));
     bodyExprs.clear();
 
-    return SampleCodeWriter.write(
-        TryCatchStatement.builder()
-            .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
-            .setTryBody(bodyStatements)
-            .setIsSampleCode(true)
-            .build());
+    List sampleBody =
+        Arrays.asList(
+            TryCatchStatement.builder()
+                .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
+                .setTryBody(bodyStatements)
+                .setIsSampleCode(true)
+                .build());
+
+    return new ExecutableSample(
+        composeSampleMethodName(clientName, method.name()), new ArrayList<>(), sampleBody);
   }
 
   // Compose sample code for the method where it is CallableMethodKind.PAGED.
-  public static String composePagedCallableMethodHeaderSampleCode(
+  public static ExecutableSample composePagedCallableMethodHeaderSampleCode(
       Method method,
       TypeNode clientType,
       Map resourceNames,
       Map messageTypes) {
+    String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name());
     VariableExpr clientVarExpr =
         VariableExpr.withVariable(
-            Variable.builder()
-                .setName(JavaStyle.toLowerCamelCase(clientType.reference().name()))
-                .setType(clientType)
-                .build());
+            Variable.builder().setName(clientName).setType(clientType).build());
     // Assign method's request variable with the default value.
     VariableExpr requestVarExpr =
         VariableExpr.withVariable(
@@ -553,26 +569,28 @@ public static String composePagedCallableMethodHeaderSampleCode(
             .build();
     bodyStatements.add(repeatedResponseForStatement);
 
-    return SampleCodeWriter.write(
-        TryCatchStatement.builder()
-            .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
-            .setTryBody(bodyStatements)
-            .setIsSampleCode(true)
-            .build());
+    List sampleBody =
+        Arrays.asList(
+            TryCatchStatement.builder()
+                .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
+                .setTryBody(bodyStatements)
+                .setIsSampleCode(true)
+                .build());
+
+    return new ExecutableSample(
+        composeSampleMethodName(clientName, method.name()), new ArrayList<>(), sampleBody);
   }
 
   // Compose sample code for the method where it is CallableMethodKind.REGULAR.
-  public static String composeRegularCallableMethodHeaderSampleCode(
+  public static ExecutableSample composeRegularCallableMethodHeaderSampleCode(
       Method method,
       TypeNode clientType,
       Map resourceNames,
       Map messageTypes) {
+    String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name());
     VariableExpr clientVarExpr =
         VariableExpr.withVariable(
-            Variable.builder()
-                .setName(JavaStyle.toLowerCamelCase(clientType.reference().name()))
-                .setType(clientType)
-                .build());
+            Variable.builder().setName(clientName).setType(clientType).build());
 
     // Assign method's request variable with the default value.
     VariableExpr requestVarExpr =
@@ -603,25 +621,27 @@ public static String composeRegularCallableMethodHeaderSampleCode(
           composeUnaryOrLroCallableBodyStatements(method, clientVarExpr, requestVarExpr));
     }
 
-    return SampleCodeWriter.write(
-        TryCatchStatement.builder()
-            .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
-            .setTryBody(bodyStatements)
-            .setIsSampleCode(true)
-            .build());
+    List sampleBody =
+        Arrays.asList(
+            TryCatchStatement.builder()
+                .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
+                .setTryBody(bodyStatements)
+                .setIsSampleCode(true)
+                .build());
+
+    return new ExecutableSample(
+        composeSampleMethodName(clientName, method.name()), new ArrayList<>(), sampleBody);
   }
 
-  public static String composeStreamCallableMethodHeaderSampleCode(
+  public static ExecutableSample composeStreamCallableMethodHeaderSampleCode(
       Method method,
       TypeNode clientType,
       Map resourceNames,
       Map messageTypes) {
+    String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name());
     VariableExpr clientVarExpr =
         VariableExpr.withVariable(
-            Variable.builder()
-                .setName(JavaStyle.toLowerCamelCase(clientType.reference().name()))
-                .setType(clientType)
-                .build());
+            Variable.builder().setName(clientName).setType(clientType).build());
     // Assign method's request variable with the default value.
     VariableExpr requestVarExpr =
         VariableExpr.withVariable(
@@ -652,12 +672,16 @@ public static String composeStreamCallableMethodHeaderSampleCode(
           composeStreamClientBodyStatements(method, clientVarExpr, requestAssignmentExpr));
     }
 
-    return SampleCodeWriter.write(
-        TryCatchStatement.builder()
-            .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
-            .setTryBody(bodyStatements)
-            .setIsSampleCode(true)
-            .build());
+    List sampleBody =
+        Arrays.asList(
+            TryCatchStatement.builder()
+                .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
+                .setTryBody(bodyStatements)
+                .setIsSampleCode(true)
+                .build());
+
+    return new ExecutableSample(
+        composeSampleMethodName(clientName, method.name()), new ArrayList<>(), sampleBody);
   }
 
   private static List composeUnaryRpcMethodBodyStatements(
diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposer.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposer.java
index 9c554b0be0..dba05e10ec 100644
--- a/src/main/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposer.java
+++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposer.java
@@ -27,6 +27,7 @@
 import com.google.api.generator.engine.ast.VariableExpr;
 import com.google.api.generator.gapic.utils.JavaStyle;
 import java.time.Duration;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Optional;
@@ -34,7 +35,7 @@
 
 public final class SettingsSampleCodeComposer {
 
-  public static Optional composeSampleCode(
+  public static Optional composeSampleCode(
       Optional methodNameOpt, String settingsClassName, TypeNode classType) {
     if (!methodNameOpt.isPresent()) {
       return Optional.empty();
@@ -113,14 +114,11 @@ public static Optional composeSampleCode(
             .setArguments(retrySettingsArgExpr)
             .build();
 
+    String name = JavaStyle.toLowerCamelCase(settingsClassName);
     // Initialize clientSetting with builder() method.
     // e.g: FoobarSettings foobarSettings = foobarSettingsBuilder.build();
     VariableExpr settingsVarExpr =
-        VariableExpr.withVariable(
-            Variable.builder()
-                .setType(classType)
-                .setName(JavaStyle.toLowerCamelCase(settingsClassName))
-                .build());
+        VariableExpr.withVariable(Variable.builder().setType(classType).setName(name).build());
     AssignmentExpr settingBuildAssignmentExpr =
         AssignmentExpr.builder()
             .setVariableExpr(settingsVarExpr.toBuilder().setIsDecl(true).build())
@@ -132,7 +130,7 @@ public static Optional composeSampleCode(
                     .build())
             .build();
 
-    List statements =
+    List sampleBody =
         Arrays.asList(
                 initLocalSettingsExpr,
                 settingBuilderMethodInvocationExpr,
@@ -140,6 +138,7 @@ public static Optional composeSampleCode(
             .stream()
             .map(e -> ExprStatement.withExpr(e))
             .collect(Collectors.toList());
-    return Optional.of(SampleCodeWriter.write(statements));
+
+    return Optional.of(new ExecutableSample(name, new ArrayList<>(), sampleBody));
   }
 }
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/BookshopClient.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/BookshopClient.golden
index 069bd7a634..95574a8c57 100644
--- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/BookshopClient.golden
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/BookshopClient.golden
@@ -16,10 +16,26 @@ import javax.annotation.Generated;
  * that map to API methods. Sample code to get started:
  *
  * 
{@code
- * try (BookshopClient bookshopClient = BookshopClient.create()) {
- *   int booksCount = 1618425911;
- *   List books = new ArrayList<>();
- *   Book response = bookshopClient.getBook(booksCount, books);
+ * package com.google.example;
+ *
+ * import com.google.bookshop.v1beta1.Book;
+ * import com.google.bookshop.v1beta1.BookshopClient;
+ * import java.util.ArrayList;
+ * import java.util.List;
+ *
+ * public class BookshopClientGetBook {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     bookshopClientGetBook();
+ *   }
+ *
+ *   public static void bookshopClientGetBook() throws Exception {
+ *     try (BookshopClient bookshopClient = BookshopClient.create()) {
+ *       int booksCount = 1618425911;
+ *       List books = new ArrayList<>();
+ *       Book response = bookshopClient.getBook(booksCount, books);
+ *     }
+ *   }
  * }
  * }
* @@ -52,19 +68,50 @@ import javax.annotation.Generated; *

To customize credentials: * *

{@code
- * BookshopSettings bookshopSettings =
- *     BookshopSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * BookshopClient bookshopClient = BookshopClient.create(bookshopSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.bookshop.v1beta1.BookshopClient;
+ * import com.google.bookshop.v1beta1.BookshopSettings;
+ * import com.google.bookshop.v1beta1.myCredentials;
+ *
+ * public class BookshopClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     bookshopClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void bookshopClientSetCredentialsProvider() throws Exception {
+ *     BookshopSettings bookshopSettings =
+ *         BookshopSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     BookshopClient bookshopClient = BookshopClient.create(bookshopSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * BookshopSettings bookshopSettings =
- *     BookshopSettings.newBuilder().setEndpoint(myEndpoint).build();
- * BookshopClient bookshopClient = BookshopClient.create(bookshopSettings);
+ * package com.google.example;
+ *
+ * import com.google.bookshop.v1beta1.BookshopClient;
+ * import com.google.bookshop.v1beta1.BookshopSettings;
+ * import com.google.bookshop.v1beta1.myEndpoint;
+ *
+ * public class BookshopClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     bookshopClientSetEndpoint();
+ *   }
+ *
+ *   public static void bookshopClientSetEndpoint() throws Exception {
+ *     BookshopSettings bookshopSettings =
+ *         BookshopSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     BookshopClient bookshopClient = BookshopClient.create(bookshopSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -126,10 +173,26 @@ public class BookshopClient implements BackgroundResource { * Sample code: * *

{@code
-   * try (BookshopClient bookshopClient = BookshopClient.create()) {
-   *   int booksCount = 1618425911;
-   *   List books = new ArrayList<>();
-   *   Book response = bookshopClient.getBook(booksCount, books);
+   * package com.google.example;
+   *
+   * import com.google.bookshop.v1beta1.Book;
+   * import com.google.bookshop.v1beta1.BookshopClient;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class BookshopClientGetBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     bookshopClientGetBook();
+   *   }
+   *
+   *   public static void bookshopClientGetBook() throws Exception {
+   *     try (BookshopClient bookshopClient = BookshopClient.create()) {
+   *       int booksCount = 1618425911;
+   *       List books = new ArrayList<>();
+   *       Book response = bookshopClient.getBook(booksCount, books);
+   *     }
+   *   }
    * }
    * }
* @@ -148,10 +211,26 @@ public class BookshopClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (BookshopClient bookshopClient = BookshopClient.create()) {
-   *   String booksList = "booksList2-1119589686";
-   *   List books = new ArrayList<>();
-   *   Book response = bookshopClient.getBook(booksList, books);
+   * package com.google.example;
+   *
+   * import com.google.bookshop.v1beta1.Book;
+   * import com.google.bookshop.v1beta1.BookshopClient;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class BookshopClientGetBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     bookshopClientGetBook();
+   *   }
+   *
+   *   public static void bookshopClientGetBook() throws Exception {
+   *     try (BookshopClient bookshopClient = BookshopClient.create()) {
+   *       String booksList = "booksList2-1119589686";
+   *       List books = new ArrayList<>();
+   *       Book response = bookshopClient.getBook(booksList, books);
+   *     }
+   *   }
    * }
    * }
* @@ -170,14 +249,30 @@ public class BookshopClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (BookshopClient bookshopClient = BookshopClient.create()) {
-   *   GetBookRequest request =
-   *       GetBookRequest.newBuilder()
-   *           .setBooksCount1(1618425911)
-   *           .setBooksList2("booksList2-1119589686")
-   *           .addAllBooks3(new ArrayList())
-   *           .build();
-   *   Book response = bookshopClient.getBook(request);
+   * package com.google.example;
+   *
+   * import com.google.bookshop.v1beta1.Book;
+   * import com.google.bookshop.v1beta1.BookshopClient;
+   * import com.google.bookshop.v1beta1.GetBookRequest;
+   * import java.util.ArrayList;
+   *
+   * public class BookshopClientGetBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     bookshopClientGetBook();
+   *   }
+   *
+   *   public static void bookshopClientGetBook() throws Exception {
+   *     try (BookshopClient bookshopClient = BookshopClient.create()) {
+   *       GetBookRequest request =
+   *           GetBookRequest.newBuilder()
+   *               .setBooksCount1(1618425911)
+   *               .setBooksList2("booksList2-1119589686")
+   *               .addAllBooks3(new ArrayList())
+   *               .build();
+   *       Book response = bookshopClient.getBook(request);
+   *     }
+   *   }
    * }
    * }
* @@ -193,16 +288,33 @@ public class BookshopClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (BookshopClient bookshopClient = BookshopClient.create()) {
-   *   GetBookRequest request =
-   *       GetBookRequest.newBuilder()
-   *           .setBooksCount1(1618425911)
-   *           .setBooksList2("booksList2-1119589686")
-   *           .addAllBooks3(new ArrayList())
-   *           .build();
-   *   ApiFuture future = bookshopClient.getBookCallable().futureCall(request);
-   *   // Do something.
-   *   Book response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.bookshop.v1beta1.Book;
+   * import com.google.bookshop.v1beta1.BookshopClient;
+   * import com.google.bookshop.v1beta1.GetBookRequest;
+   * import java.util.ArrayList;
+   *
+   * public class BookshopClientGetBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     bookshopClientGetBook();
+   *   }
+   *
+   *   public static void bookshopClientGetBook() throws Exception {
+   *     try (BookshopClient bookshopClient = BookshopClient.create()) {
+   *       GetBookRequest request =
+   *           GetBookRequest.newBuilder()
+   *               .setBooksCount1(1618425911)
+   *               .setBooksList2("booksList2-1119589686")
+   *               .addAllBooks3(new ArrayList())
+   *               .build();
+   *       ApiFuture future = bookshopClient.getBookCallable().futureCall(request);
+   *       // Do something.
+   *       Book response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceClient.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceClient.golden index 9af83eb743..d069a3af19 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceClient.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceClient.golden @@ -16,9 +16,24 @@ import javax.annotation.Generated; * that map to API methods. Sample code to get started: * *
{@code
- * try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
- *   FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
- *   deprecatedServiceClient.fastFibonacci(request);
+ * package com.google.example;
+ *
+ * import com.google.protobuf.Empty;
+ * import com.google.testdata.v1.DeprecatedServiceClient;
+ * import com.google.testdata.v1.FibonacciRequest;
+ *
+ * public class DeprecatedServiceClientFastFibonacci {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     deprecatedServiceClientFastFibonacci();
+ *   }
+ *
+ *   public static void deprecatedServiceClientFastFibonacci() throws Exception {
+ *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+ *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+ *       deprecatedServiceClient.fastFibonacci(request);
+ *     }
+ *   }
  * }
  * }
* @@ -52,21 +67,52 @@ import javax.annotation.Generated; *

To customize credentials: * *

{@code
- * DeprecatedServiceSettings deprecatedServiceSettings =
- *     DeprecatedServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * DeprecatedServiceClient deprecatedServiceClient =
- *     DeprecatedServiceClient.create(deprecatedServiceSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.testdata.v1.DeprecatedServiceClient;
+ * import com.google.testdata.v1.DeprecatedServiceSettings;
+ * import com.google.testdata.v1.myCredentials;
+ *
+ * public class DeprecatedServiceClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     deprecatedServiceClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void deprecatedServiceClientSetCredentialsProvider() throws Exception {
+ *     DeprecatedServiceSettings deprecatedServiceSettings =
+ *         DeprecatedServiceSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     DeprecatedServiceClient deprecatedServiceClient =
+ *         DeprecatedServiceClient.create(deprecatedServiceSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * DeprecatedServiceSettings deprecatedServiceSettings =
- *     DeprecatedServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * DeprecatedServiceClient deprecatedServiceClient =
- *     DeprecatedServiceClient.create(deprecatedServiceSettings);
+ * package com.google.example;
+ *
+ * import com.google.testdata.v1.DeprecatedServiceClient;
+ * import com.google.testdata.v1.DeprecatedServiceSettings;
+ * import com.google.testdata.v1.myEndpoint;
+ *
+ * public class DeprecatedServiceClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     deprecatedServiceClientSetEndpoint();
+ *   }
+ *
+ *   public static void deprecatedServiceClientSetEndpoint() throws Exception {
+ *     DeprecatedServiceSettings deprecatedServiceSettings =
+ *         DeprecatedServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     DeprecatedServiceClient deprecatedServiceClient =
+ *         DeprecatedServiceClient.create(deprecatedServiceSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -132,9 +178,24 @@ public class DeprecatedServiceClient implements BackgroundResource { * Sample code: * *

{@code
-   * try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
-   *   FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
-   *   deprecatedServiceClient.fastFibonacci(request);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Empty;
+   * import com.google.testdata.v1.DeprecatedServiceClient;
+   * import com.google.testdata.v1.FibonacciRequest;
+   *
+   * public class DeprecatedServiceClientFastFibonacci {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     deprecatedServiceClientFastFibonacci();
+   *   }
+   *
+   *   public static void deprecatedServiceClientFastFibonacci() throws Exception {
+   *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+   *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+   *       deprecatedServiceClient.fastFibonacci(request);
+   *     }
+   *   }
    * }
    * }
* @@ -150,11 +211,27 @@ public class DeprecatedServiceClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
-   *   FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
-   *   ApiFuture future = deprecatedServiceClient.fastFibonacciCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.protobuf.Empty;
+   * import com.google.testdata.v1.DeprecatedServiceClient;
+   * import com.google.testdata.v1.FibonacciRequest;
+   *
+   * public class DeprecatedServiceClientFastFibonacci {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     deprecatedServiceClientFastFibonacci();
+   *   }
+   *
+   *   public static void deprecatedServiceClientFastFibonacci() throws Exception {
+   *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+   *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+   *       ApiFuture future = deprecatedServiceClient.fastFibonacciCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -167,9 +244,24 @@ public class DeprecatedServiceClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
-   *   FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
-   *   deprecatedServiceClient.slowFibonacci(request);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Empty;
+   * import com.google.testdata.v1.DeprecatedServiceClient;
+   * import com.google.testdata.v1.FibonacciRequest;
+   *
+   * public class DeprecatedServiceClientSlowFibonacci {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     deprecatedServiceClientSlowFibonacci();
+   *   }
+   *
+   *   public static void deprecatedServiceClientSlowFibonacci() throws Exception {
+   *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+   *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+   *       deprecatedServiceClient.slowFibonacci(request);
+   *     }
+   *   }
    * }
    * }
* @@ -187,11 +279,27 @@ public class DeprecatedServiceClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
-   *   FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
-   *   ApiFuture future = deprecatedServiceClient.slowFibonacciCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.protobuf.Empty;
+   * import com.google.testdata.v1.DeprecatedServiceClient;
+   * import com.google.testdata.v1.FibonacciRequest;
+   *
+   * public class DeprecatedServiceClientSlowFibonacci {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     deprecatedServiceClientSlowFibonacci();
+   *   }
+   *
+   *   public static void deprecatedServiceClientSlowFibonacci() throws Exception {
+   *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+   *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+   *       ApiFuture future = deprecatedServiceClient.slowFibonacciCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
* diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceSettings.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceSettings.golden index 5e61122577..4882214a67 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceSettings.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceSettings.golden @@ -35,18 +35,32 @@ import javax.annotation.Generated; *

For example, to set the total timeout of fastFibonacci to 30 seconds: * *

{@code
- * DeprecatedServiceSettings.Builder deprecatedServiceSettingsBuilder =
- *     DeprecatedServiceSettings.newBuilder();
- * deprecatedServiceSettingsBuilder
- *     .fastFibonacciSettings()
- *     .setRetrySettings(
- *         deprecatedServiceSettingsBuilder
- *             .fastFibonacciSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * DeprecatedServiceSettings deprecatedServiceSettings = deprecatedServiceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.testdata.v1.DeprecatedServiceSettings;
+ * import java.time.Duration;
+ *
+ * public class DeprecatedServiceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     deprecatedServiceSettings();
+ *   }
+ *
+ *   public static void deprecatedServiceSettings() throws Exception {
+ *     DeprecatedServiceSettings.Builder deprecatedServiceSettingsBuilder =
+ *         DeprecatedServiceSettings.newBuilder();
+ *     deprecatedServiceSettingsBuilder
+ *         .fastFibonacciSettings()
+ *         .setRetrySettings(
+ *             deprecatedServiceSettingsBuilder
+ *                 .fastFibonacciSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     DeprecatedServiceSettings deprecatedServiceSettings = deprecatedServiceSettingsBuilder.build();
+ *   }
+ * }
  * }
* * @deprecated This class is deprecated and will be removed in the next major version update. diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceStubSettings.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceStubSettings.golden index 899b03bbce..735111b83b 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceStubSettings.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceStubSettings.golden @@ -44,19 +44,33 @@ import org.threeten.bp.Duration; *

For example, to set the total timeout of fastFibonacci to 30 seconds: * *

{@code
- * DeprecatedServiceStubSettings.Builder deprecatedServiceSettingsBuilder =
- *     DeprecatedServiceStubSettings.newBuilder();
- * deprecatedServiceSettingsBuilder
- *     .fastFibonacciSettings()
- *     .setRetrySettings(
- *         deprecatedServiceSettingsBuilder
- *             .fastFibonacciSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * DeprecatedServiceStubSettings deprecatedServiceSettings =
- *     deprecatedServiceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.testdata.v1.stub.DeprecatedServiceStubSettings;
+ * import java.time.Duration;
+ *
+ * public class DeprecatedServiceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     deprecatedServiceSettings();
+ *   }
+ *
+ *   public static void deprecatedServiceSettings() throws Exception {
+ *     DeprecatedServiceStubSettings.Builder deprecatedServiceSettingsBuilder =
+ *         DeprecatedServiceStubSettings.newBuilder();
+ *     deprecatedServiceSettingsBuilder
+ *         .fastFibonacciSettings()
+ *         .setRetrySettings(
+ *             deprecatedServiceSettingsBuilder
+ *                 .fastFibonacciSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     DeprecatedServiceStubSettings deprecatedServiceSettings =
+ *         deprecatedServiceSettingsBuilder.build();
+ *   }
+ * }
  * }
* * @deprecated This class is deprecated and will be removed in the next major version update. diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoClient.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoClient.golden index 3e6735f6bd..4ad9259816 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoClient.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoClient.golden @@ -34,8 +34,22 @@ import javax.annotation.Generated; * that map to API methods. Sample code to get started: * *
{@code
- * try (EchoClient echoClient = EchoClient.create()) {
- *   EchoResponse response = echoClient.echo();
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.EchoClient;
+ * import com.google.showcase.v1beta1.EchoResponse;
+ *
+ * public class EchoClientEcho {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     echoClientEcho();
+ *   }
+ *
+ *   public static void echoClientEcho() throws Exception {
+ *     try (EchoClient echoClient = EchoClient.create()) {
+ *       EchoResponse response = echoClient.echo();
+ *     }
+ *   }
  * }
  * }
* @@ -68,18 +82,49 @@ import javax.annotation.Generated; *

To customize credentials: * *

{@code
- * EchoSettings echoSettings =
- *     EchoSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * EchoClient echoClient = EchoClient.create(echoSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.showcase.v1beta1.EchoClient;
+ * import com.google.showcase.v1beta1.EchoSettings;
+ * import com.google.showcase.v1beta1.myCredentials;
+ *
+ * public class EchoClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     echoClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void echoClientSetCredentialsProvider() throws Exception {
+ *     EchoSettings echoSettings =
+ *         EchoSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     EchoClient echoClient = EchoClient.create(echoSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();
- * EchoClient echoClient = EchoClient.create(echoSettings);
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.EchoClient;
+ * import com.google.showcase.v1beta1.EchoSettings;
+ * import com.google.showcase.v1beta1.myEndpoint;
+ *
+ * public class EchoClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     echoClientSetEndpoint();
+ *   }
+ *
+ *   public static void echoClientSetEndpoint() throws Exception {
+ *     EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     EchoClient echoClient = EchoClient.create(echoSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -152,8 +197,22 @@ public class EchoClient implements BackgroundResource { * Sample code: * *

{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   EchoResponse response = echoClient.echo();
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       EchoResponse response = echoClient.echo();
+   *     }
+   *   }
    * }
    * }
* @@ -170,9 +229,25 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   ResourceName parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
-   *   EchoResponse response = echoClient.echo(parent);
+   * package com.google.example;
+   *
+   * import com.google.api.resourcenames.ResourceName;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.FoobarName;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       ResourceName parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
+   *       EchoResponse response = echoClient.echo(parent);
+   *     }
+   *   }
    * }
    * }
* @@ -190,9 +265,24 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   Status error = Status.newBuilder().build();
-   *   EchoResponse response = echoClient.echo(error);
+   * package com.google.example;
+   *
+   * import com.google.rpc.Status;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       Status error = Status.newBuilder().build();
+   *       EchoResponse response = echoClient.echo(error);
+   *     }
+   *   }
    * }
    * }
* @@ -209,9 +299,24 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   FoobarName name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
-   *   EchoResponse response = echoClient.echo(name);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.FoobarName;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       FoobarName name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
+   *       EchoResponse response = echoClient.echo(name);
+   *     }
+   *   }
    * }
    * }
* @@ -229,9 +334,23 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   String content = "content951530617";
-   *   EchoResponse response = echoClient.echo(content);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       String content = "content951530617";
+   *       EchoResponse response = echoClient.echo(content);
+   *     }
+   *   }
    * }
    * }
* @@ -248,9 +367,24 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   String name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
-   *   EchoResponse response = echoClient.echo(name);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.FoobarName;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       String name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
+   *       EchoResponse response = echoClient.echo(name);
+   *     }
+   *   }
    * }
    * }
* @@ -267,9 +401,24 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   String parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
-   *   EchoResponse response = echoClient.echo(parent);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.FoobarName;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       String parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
+   *       EchoResponse response = echoClient.echo(parent);
+   *     }
+   *   }
    * }
    * }
* @@ -286,10 +435,25 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   String content = "content951530617";
-   *   Severity severity = Severity.forNumber(0);
-   *   EchoResponse response = echoClient.echo(content, severity);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.Severity;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       String content = "content951530617";
+   *       Severity severity = Severity.forNumber(0);
+   *       EchoResponse response = echoClient.echo(content, severity);
+   *     }
+   *   }
    * }
    * }
* @@ -308,15 +472,33 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   EchoRequest request =
-   *       EchoRequest.newBuilder()
-   *           .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setSeverity(Severity.forNumber(0))
-   *           .setFoobar(Foobar.newBuilder().build())
-   *           .build();
-   *   EchoResponse response = echoClient.echo(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoRequest;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.Foobar;
+   * import com.google.showcase.v1beta1.FoobarName;
+   * import com.google.showcase.v1beta1.Severity;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       EchoRequest request =
+   *           EchoRequest.newBuilder()
+   *               .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setSeverity(Severity.forNumber(0))
+   *               .setFoobar(Foobar.newBuilder().build())
+   *               .build();
+   *       EchoResponse response = echoClient.echo(request);
+   *     }
+   *   }
    * }
    * }
* @@ -332,17 +514,36 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   EchoRequest request =
-   *       EchoRequest.newBuilder()
-   *           .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setSeverity(Severity.forNumber(0))
-   *           .setFoobar(Foobar.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = echoClient.echoCallable().futureCall(request);
-   *   // Do something.
-   *   EchoResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoRequest;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.Foobar;
+   * import com.google.showcase.v1beta1.FoobarName;
+   * import com.google.showcase.v1beta1.Severity;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       EchoRequest request =
+   *           EchoRequest.newBuilder()
+   *               .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setSeverity(Severity.forNumber(0))
+   *               .setFoobar(Foobar.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = echoClient.echoCallable().futureCall(request);
+   *       // Do something.
+   *       EchoResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -355,12 +556,28 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   ExpandRequest request =
-   *       ExpandRequest.newBuilder().setContent("content951530617").setInfo("info3237038").build();
-   *   ServerStream stream = echoClient.expandCallable().call(request);
-   *   for (EchoResponse response : stream) {
-   *     // Do something when a response is received.
+   * package com.google.example;
+   *
+   * import com.google.api.gax.rpc.ServerStream;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.ExpandRequest;
+   *
+   * public class EchoClientExpand {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientExpand();
+   *   }
+   *
+   *   public static void echoClientExpand() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       ExpandRequest request =
+   *           ExpandRequest.newBuilder().setContent("content951530617").setInfo("info3237038").build();
+   *       ServerStream stream = echoClient.expandCallable().call(request);
+   *       for (EchoResponse response : stream) {
+   *         // Do something when a response is received.
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -374,34 +591,53 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   ApiStreamObserver responseObserver =
-   *       new ApiStreamObserver() {
-   *         {@literal @}Override
-   *         public void onNext(EchoResponse response) {
-   *           // Do something when a response is received.
-   *         }
+   * package com.google.example;
    *
-   *         {@literal @}Override
-   *         public void onError(Throwable t) {
-   *           // Add error-handling
-   *         }
+   * import com.google.api.gax.rpc.ApiStreamObserver;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoRequest;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.Foobar;
+   * import com.google.showcase.v1beta1.FoobarName;
+   * import com.google.showcase.v1beta1.Severity;
    *
-   *         {@literal @}Override
-   *         public void onCompleted() {
-   *           // Do something when complete.
-   *         }
-   *       };
-   *   ApiStreamObserver requestObserver =
-   *       echoClient.collect().clientStreamingCall(responseObserver);
-   *   EchoRequest request =
-   *       EchoRequest.newBuilder()
-   *           .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setSeverity(Severity.forNumber(0))
-   *           .setFoobar(Foobar.newBuilder().build())
-   *           .build();
-   *   requestObserver.onNext(request);
+   * public class EchoClientCollect {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientCollect();
+   *   }
+   *
+   *   public static void echoClientCollect() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       ApiStreamObserver responseObserver =
+   *           new ApiStreamObserver() {
+   *             {@literal @}Override
+   *             public void onNext(EchoResponse response) {
+   *               // Do something when a response is received.
+   *             }
+   *
+   *             {@literal @}Override
+   *             public void onError(Throwable t) {
+   *               // Add error-handling
+   *             }
+   *
+   *             {@literal @}Override
+   *             public void onCompleted() {
+   *               // Do something when complete.
+   *             }
+   *           };
+   *       ApiStreamObserver requestObserver =
+   *           echoClient.collect().clientStreamingCall(responseObserver);
+   *       EchoRequest request =
+   *           EchoRequest.newBuilder()
+   *               .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setSeverity(Severity.forNumber(0))
+   *               .setFoobar(Foobar.newBuilder().build())
+   *               .build();
+   *       requestObserver.onNext(request);
+   *     }
+   *   }
    * }
    * }
*/ @@ -414,18 +650,37 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   BidiStream bidiStream = echoClient.chatCallable().call();
-   *   EchoRequest request =
-   *       EchoRequest.newBuilder()
-   *           .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setSeverity(Severity.forNumber(0))
-   *           .setFoobar(Foobar.newBuilder().build())
-   *           .build();
-   *   bidiStream.send(request);
-   *   for (EchoResponse response : bidiStream) {
-   *     // Do something when a response is received.
+   * package com.google.example;
+   *
+   * import com.google.api.gax.rpc.BidiStream;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoRequest;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.Foobar;
+   * import com.google.showcase.v1beta1.FoobarName;
+   * import com.google.showcase.v1beta1.Severity;
+   *
+   * public class EchoClientChat {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientChat();
+   *   }
+   *
+   *   public static void echoClientChat() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       BidiStream bidiStream = echoClient.chatCallable().call();
+   *       EchoRequest request =
+   *           EchoRequest.newBuilder()
+   *               .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setSeverity(Severity.forNumber(0))
+   *               .setFoobar(Foobar.newBuilder().build())
+   *               .build();
+   *       bidiStream.send(request);
+   *       for (EchoResponse response : bidiStream) {
+   *         // Do something when a response is received.
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -439,18 +694,37 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   BidiStream bidiStream = echoClient.chatAgainCallable().call();
-   *   EchoRequest request =
-   *       EchoRequest.newBuilder()
-   *           .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setSeverity(Severity.forNumber(0))
-   *           .setFoobar(Foobar.newBuilder().build())
-   *           .build();
-   *   bidiStream.send(request);
-   *   for (EchoResponse response : bidiStream) {
-   *     // Do something when a response is received.
+   * package com.google.example;
+   *
+   * import com.google.api.gax.rpc.BidiStream;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoRequest;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.Foobar;
+   * import com.google.showcase.v1beta1.FoobarName;
+   * import com.google.showcase.v1beta1.Severity;
+   *
+   * public class EchoClientChatAgain {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientChatAgain();
+   *   }
+   *
+   *   public static void echoClientChatAgain() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       BidiStream bidiStream = echoClient.chatAgainCallable().call();
+   *       EchoRequest request =
+   *           EchoRequest.newBuilder()
+   *               .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setSeverity(Severity.forNumber(0))
+   *               .setFoobar(Foobar.newBuilder().build())
+   *               .build();
+   *       bidiStream.send(request);
+   *       for (EchoResponse response : bidiStream) {
+   *         // Do something when a response is received.
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -464,15 +738,30 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   PagedExpandRequest request =
-   *       PagedExpandRequest.newBuilder()
-   *           .setContent("content951530617")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (EchoResponse element : echoClient.pagedExpand(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.PagedExpandRequest;
+   *
+   * public class EchoClientPagedExpand {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientPagedExpand();
+   *   }
+   *
+   *   public static void echoClientPagedExpand() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       PagedExpandRequest request =
+   *           PagedExpandRequest.newBuilder()
+   *               .setContent("content951530617")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (EchoResponse element : echoClient.pagedExpand(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -489,17 +778,33 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   PagedExpandRequest request =
-   *       PagedExpandRequest.newBuilder()
-   *           .setContent("content951530617")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = echoClient.pagedExpandPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (EchoResponse element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.PagedExpandRequest;
+   *
+   * public class EchoClientPagedExpand {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientPagedExpand();
+   *   }
+   *
+   *   public static void echoClientPagedExpand() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       PagedExpandRequest request =
+   *           PagedExpandRequest.newBuilder()
+   *               .setContent("content951530617")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future = echoClient.pagedExpandPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (EchoResponse element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -514,23 +819,40 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   PagedExpandRequest request =
-   *       PagedExpandRequest.newBuilder()
-   *           .setContent("content951530617")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     PagedExpandResponse response = echoClient.pagedExpandCallable().call(request);
-   *     for (EchoResponse element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.common.base.Strings;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.PagedExpandRequest;
+   * import com.google.showcase.v1beta1.PagedExpandResponse;
+   *
+   * public class EchoClientPagedExpand {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientPagedExpand();
+   *   }
+   *
+   *   public static void echoClientPagedExpand() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       PagedExpandRequest request =
+   *           PagedExpandRequest.newBuilder()
+   *               .setContent("content951530617")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         PagedExpandResponse response = echoClient.pagedExpandCallable().call(request);
+   *         for (EchoResponse element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -545,9 +867,23 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   for (EchoResponse element : echoClient.simplePagedExpand().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   *
+   * public class EchoClientSimplePagedExpand {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientSimplePagedExpand();
+   *   }
+   *
+   *   public static void echoClientSimplePagedExpand() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       for (EchoResponse element : echoClient.simplePagedExpand().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -565,15 +901,30 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   PagedExpandRequest request =
-   *       PagedExpandRequest.newBuilder()
-   *           .setContent("content951530617")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (EchoResponse element : echoClient.simplePagedExpand(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.PagedExpandRequest;
+   *
+   * public class EchoClientSimplePagedExpand {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientSimplePagedExpand();
+   *   }
+   *
+   *   public static void echoClientSimplePagedExpand() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       PagedExpandRequest request =
+   *           PagedExpandRequest.newBuilder()
+   *               .setContent("content951530617")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (EchoResponse element : echoClient.simplePagedExpand(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -590,18 +941,34 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   PagedExpandRequest request =
-   *       PagedExpandRequest.newBuilder()
-   *           .setContent("content951530617")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future =
-   *       echoClient.simplePagedExpandPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (EchoResponse element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.PagedExpandRequest;
+   *
+   * public class EchoClientSimplePagedExpand {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientSimplePagedExpand();
+   *   }
+   *
+   *   public static void echoClientSimplePagedExpand() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       PagedExpandRequest request =
+   *           PagedExpandRequest.newBuilder()
+   *               .setContent("content951530617")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future =
+   *           echoClient.simplePagedExpandPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (EchoResponse element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -616,23 +983,40 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   PagedExpandRequest request =
-   *       PagedExpandRequest.newBuilder()
-   *           .setContent("content951530617")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     PagedExpandResponse response = echoClient.simplePagedExpandCallable().call(request);
-   *     for (EchoResponse element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.common.base.Strings;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
+   * import com.google.showcase.v1beta1.PagedExpandRequest;
+   * import com.google.showcase.v1beta1.PagedExpandResponse;
+   *
+   * public class EchoClientSimplePagedExpand {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientSimplePagedExpand();
+   *   }
+   *
+   *   public static void echoClientSimplePagedExpand() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       PagedExpandRequest request =
+   *           PagedExpandRequest.newBuilder()
+   *               .setContent("content951530617")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         PagedExpandResponse response = echoClient.simplePagedExpandCallable().call(request);
+   *         for (EchoResponse element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -647,9 +1031,24 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   Duration ttl = Duration.newBuilder().build();
-   *   WaitResponse response = echoClient.waitAsync(ttl).get();
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Duration;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.WaitResponse;
+   *
+   * public class EchoClientWait {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientWait();
+   *   }
+   *
+   *   public static void echoClientWait() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       Duration ttl = Duration.newBuilder().build();
+   *       WaitResponse response = echoClient.waitAsync(ttl).get();
+   *     }
+   *   }
    * }
    * }
* @@ -666,9 +1065,24 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   Timestamp endTime = Timestamp.newBuilder().build();
-   *   WaitResponse response = echoClient.waitAsync(endTime).get();
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Timestamp;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.WaitResponse;
+   *
+   * public class EchoClientWait {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientWait();
+   *   }
+   *
+   *   public static void echoClientWait() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       Timestamp endTime = Timestamp.newBuilder().build();
+   *       WaitResponse response = echoClient.waitAsync(endTime).get();
+   *     }
+   *   }
    * }
    * }
* @@ -685,9 +1099,24 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   WaitRequest request = WaitRequest.newBuilder().build();
-   *   WaitResponse response = echoClient.waitAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.WaitRequest;
+   * import com.google.showcase.v1beta1.WaitResponse;
+   *
+   * public class EchoClientWait {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientWait();
+   *   }
+   *
+   *   public static void echoClientWait() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       WaitRequest request = WaitRequest.newBuilder().build();
+   *       WaitResponse response = echoClient.waitAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -703,12 +1132,29 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   WaitRequest request = WaitRequest.newBuilder().build();
-   *   OperationFuture future =
-   *       echoClient.waitOperationCallable().futureCall(request);
-   *   // Do something.
-   *   WaitResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.WaitMetadata;
+   * import com.google.showcase.v1beta1.WaitRequest;
+   * import com.google.showcase.v1beta1.WaitResponse;
+   *
+   * public class EchoClientWait {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientWait();
+   *   }
+   *
+   *   public static void echoClientWait() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       WaitRequest request = WaitRequest.newBuilder().build();
+   *       OperationFuture future =
+   *           echoClient.waitOperationCallable().futureCall(request);
+   *       // Do something.
+   *       WaitResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -721,11 +1167,27 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   WaitRequest request = WaitRequest.newBuilder().build();
-   *   ApiFuture future = echoClient.waitCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.longrunning.Operation;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.WaitRequest;
+   *
+   * public class EchoClientWait {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientWait();
+   *   }
+   *
+   *   public static void echoClientWait() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       WaitRequest request = WaitRequest.newBuilder().build();
+   *       ApiFuture future = echoClient.waitCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -738,9 +1200,24 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   BlockRequest request = BlockRequest.newBuilder().build();
-   *   BlockResponse response = echoClient.block(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.BlockRequest;
+   * import com.google.showcase.v1beta1.BlockResponse;
+   * import com.google.showcase.v1beta1.EchoClient;
+   *
+   * public class EchoClientBlock {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientBlock();
+   *   }
+   *
+   *   public static void echoClientBlock() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       BlockRequest request = BlockRequest.newBuilder().build();
+   *       BlockResponse response = echoClient.block(request);
+   *     }
+   *   }
    * }
    * }
* @@ -756,11 +1233,27 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   BlockRequest request = BlockRequest.newBuilder().build();
-   *   ApiFuture future = echoClient.blockCallable().futureCall(request);
-   *   // Do something.
-   *   BlockResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.BlockRequest;
+   * import com.google.showcase.v1beta1.BlockResponse;
+   * import com.google.showcase.v1beta1.EchoClient;
+   *
+   * public class EchoClientBlock {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientBlock();
+   *   }
+   *
+   *   public static void echoClientBlock() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       BlockRequest request = BlockRequest.newBuilder().build();
+   *       ApiFuture future = echoClient.blockCallable().futureCall(request);
+   *       // Do something.
+   *       BlockResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -773,15 +1266,33 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   EchoRequest request =
-   *       EchoRequest.newBuilder()
-   *           .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setSeverity(Severity.forNumber(0))
-   *           .setFoobar(Foobar.newBuilder().build())
-   *           .build();
-   *   Object response = echoClient.collideName(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoRequest;
+   * import com.google.showcase.v1beta1.Foobar;
+   * import com.google.showcase.v1beta1.FoobarName;
+   * import com.google.showcase.v1beta1.Object;
+   * import com.google.showcase.v1beta1.Severity;
+   *
+   * public class EchoClientCollideName {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientCollideName();
+   *   }
+   *
+   *   public static void echoClientCollideName() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       EchoRequest request =
+   *           EchoRequest.newBuilder()
+   *               .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setSeverity(Severity.forNumber(0))
+   *               .setFoobar(Foobar.newBuilder().build())
+   *               .build();
+   *       Object response = echoClient.collideName(request);
+   *     }
+   *   }
    * }
    * }
* @@ -797,17 +1308,36 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   EchoRequest request =
-   *       EchoRequest.newBuilder()
-   *           .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
-   *           .setSeverity(Severity.forNumber(0))
-   *           .setFoobar(Foobar.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = echoClient.collideNameCallable().futureCall(request);
-   *   // Do something.
-   *   Object response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoRequest;
+   * import com.google.showcase.v1beta1.Foobar;
+   * import com.google.showcase.v1beta1.FoobarName;
+   * import com.google.showcase.v1beta1.Object;
+   * import com.google.showcase.v1beta1.Severity;
+   *
+   * public class EchoClientCollideName {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     echoClientCollideName();
+   *   }
+   *
+   *   public static void echoClientCollideName() throws Exception {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       EchoRequest request =
+   *           EchoRequest.newBuilder()
+   *               .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
+   *               .setSeverity(Severity.forNumber(0))
+   *               .setFoobar(Foobar.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = echoClient.collideNameCallable().futureCall(request);
+   *       // Do something.
+   *       Object response = future.get();
+   *     }
+   *   }
    * }
    * }
    */
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoSettings.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoSettings.golden
index e88ba04676..6088e72edc 100644
--- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoSettings.golden
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoSettings.golden
@@ -42,17 +42,31 @@ import javax.annotation.Generated;
  * 

For example, to set the total timeout of echo to 30 seconds: * *

{@code
- * EchoSettings.Builder echoSettingsBuilder = EchoSettings.newBuilder();
- * echoSettingsBuilder
- *     .echoSettings()
- *     .setRetrySettings(
- *         echoSettingsBuilder
- *             .echoSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * EchoSettings echoSettings = echoSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.EchoSettings;
+ * import java.time.Duration;
+ *
+ * public class EchoSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     echoSettings();
+ *   }
+ *
+ *   public static void echoSettings() throws Exception {
+ *     EchoSettings.Builder echoSettingsBuilder = EchoSettings.newBuilder();
+ *     echoSettingsBuilder
+ *         .echoSettings()
+ *         .setRetrySettings(
+ *             echoSettingsBuilder
+ *                 .echoSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     EchoSettings echoSettings = echoSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @BetaApi diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoStubSettings.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoStubSettings.golden index 2006b2a30d..a182fa3214 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoStubSettings.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoStubSettings.golden @@ -70,17 +70,31 @@ import org.threeten.bp.Duration; *

For example, to set the total timeout of echo to 30 seconds: * *

{@code
- * EchoStubSettings.Builder echoSettingsBuilder = EchoStubSettings.newBuilder();
- * echoSettingsBuilder
- *     .echoSettings()
- *     .setRetrySettings(
- *         echoSettingsBuilder
- *             .echoSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * EchoStubSettings echoSettings = echoSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.stub.EchoStubSettings;
+ * import java.time.Duration;
+ *
+ * public class EchoSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     echoSettings();
+ *   }
+ *
+ *   public static void echoSettings() throws Exception {
+ *     EchoStubSettings.Builder echoSettingsBuilder = EchoStubSettings.newBuilder();
+ *     echoSettingsBuilder
+ *         .echoSettings()
+ *         .setRetrySettings(
+ *             echoSettingsBuilder
+ *                 .echoSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     EchoStubSettings echoSettings = echoSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @BetaApi diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/IdentityClient.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/IdentityClient.golden index 235c0055b6..5b20116d18 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/IdentityClient.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/IdentityClient.golden @@ -24,11 +24,26 @@ import javax.annotation.Generated; * that map to API methods. Sample code to get started: * *
{@code
- * try (IdentityClient identityClient = IdentityClient.create()) {
- *   String parent = UserName.of("[USER]").toString();
- *   String displayName = "displayName1714148973";
- *   String email = "email96619420";
- *   User response = identityClient.createUser(parent, displayName, email);
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.IdentityClient;
+ * import com.google.showcase.v1beta1.User;
+ * import com.google.showcase.v1beta1.UserName;
+ *
+ * public class IdentityClientCreateUser {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     identityClientCreateUser();
+ *   }
+ *
+ *   public static void identityClientCreateUser() throws Exception {
+ *     try (IdentityClient identityClient = IdentityClient.create()) {
+ *       String parent = UserName.of("[USER]").toString();
+ *       String displayName = "displayName1714148973";
+ *       String email = "email96619420";
+ *       User response = identityClient.createUser(parent, displayName, email);
+ *     }
+ *   }
  * }
  * }
* @@ -61,19 +76,50 @@ import javax.annotation.Generated; *

To customize credentials: * *

{@code
- * IdentitySettings identitySettings =
- *     IdentitySettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * IdentityClient identityClient = IdentityClient.create(identitySettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.showcase.v1beta1.IdentityClient;
+ * import com.google.showcase.v1beta1.IdentitySettings;
+ * import com.google.showcase.v1beta1.myCredentials;
+ *
+ * public class IdentityClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     identityClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void identityClientSetCredentialsProvider() throws Exception {
+ *     IdentitySettings identitySettings =
+ *         IdentitySettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     IdentityClient identityClient = IdentityClient.create(identitySettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * IdentitySettings identitySettings =
- *     IdentitySettings.newBuilder().setEndpoint(myEndpoint).build();
- * IdentityClient identityClient = IdentityClient.create(identitySettings);
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.IdentityClient;
+ * import com.google.showcase.v1beta1.IdentitySettings;
+ * import com.google.showcase.v1beta1.myEndpoint;
+ *
+ * public class IdentityClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     identityClientSetEndpoint();
+ *   }
+ *
+ *   public static void identityClientSetEndpoint() throws Exception {
+ *     IdentitySettings identitySettings =
+ *         IdentitySettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     IdentityClient identityClient = IdentityClient.create(identitySettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -135,11 +181,26 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *

{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   String parent = UserName.of("[USER]").toString();
-   *   String displayName = "displayName1714148973";
-   *   String email = "email96619420";
-   *   User response = identityClient.createUser(parent, displayName, email);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.User;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientCreateUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientCreateUser();
+   *   }
+   *
+   *   public static void identityClientCreateUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       String parent = UserName.of("[USER]").toString();
+   *       String displayName = "displayName1714148973";
+   *       String email = "email96619420";
+   *       User response = identityClient.createUser(parent, displayName, email);
+   *     }
+   *   }
    * }
    * }
* @@ -162,17 +223,32 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   String parent = UserName.of("[USER]").toString();
-   *   String displayName = "displayName1714148973";
-   *   String email = "email96619420";
-   *   int age = 96511;
-   *   String nickname = "nickname70690926";
-   *   boolean enableNotifications = true;
-   *   double heightFeet = -1032737338;
-   *   User response =
-   *       identityClient.createUser(
-   *           parent, displayName, email, age, nickname, enableNotifications, heightFeet);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.User;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientCreateUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientCreateUser();
+   *   }
+   *
+   *   public static void identityClientCreateUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       String parent = UserName.of("[USER]").toString();
+   *       String displayName = "displayName1714148973";
+   *       String email = "email96619420";
+   *       int age = 96511;
+   *       String nickname = "nickname70690926";
+   *       boolean enableNotifications = true;
+   *       double heightFeet = -1032737338;
+   *       User response =
+   *           identityClient.createUser(
+   *               parent, displayName, email, age, nickname, enableNotifications, heightFeet);
+   *     }
+   *   }
    * }
    * }
* @@ -214,29 +290,44 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   String parent = UserName.of("[USER]").toString();
-   *   String displayName = "displayName1714148973";
-   *   String email = "email96619420";
-   *   String hobbyName = "hobbyName882586493";
-   *   String songName = "songName1535136064";
-   *   int weeklyFrequency = 1572999966;
-   *   String companyName = "companyName-508582744";
-   *   String title = "title110371416";
-   *   String subject = "subject-1867885268";
-   *   String artistName = "artistName629723762";
-   *   User response =
-   *       identityClient.createUser(
-   *           parent,
-   *           displayName,
-   *           email,
-   *           hobbyName,
-   *           songName,
-   *           weeklyFrequency,
-   *           companyName,
-   *           title,
-   *           subject,
-   *           artistName);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.User;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientCreateUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientCreateUser();
+   *   }
+   *
+   *   public static void identityClientCreateUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       String parent = UserName.of("[USER]").toString();
+   *       String displayName = "displayName1714148973";
+   *       String email = "email96619420";
+   *       String hobbyName = "hobbyName882586493";
+   *       String songName = "songName1535136064";
+   *       int weeklyFrequency = 1572999966;
+   *       String companyName = "companyName-508582744";
+   *       String title = "title110371416";
+   *       String subject = "subject-1867885268";
+   *       String artistName = "artistName629723762";
+   *       User response =
+   *           identityClient.createUser(
+   *               parent,
+   *               displayName,
+   *               email,
+   *               hobbyName,
+   *               songName,
+   *               weeklyFrequency,
+   *               companyName,
+   *               title,
+   *               subject,
+   *               artistName);
+   *     }
+   *   }
    * }
    * }
* @@ -299,13 +390,29 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   CreateUserRequest request =
-   *       CreateUserRequest.newBuilder()
-   *           .setParent(UserName.of("[USER]").toString())
-   *           .setUser(User.newBuilder().build())
-   *           .build();
-   *   User response = identityClient.createUser(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.CreateUserRequest;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.User;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientCreateUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientCreateUser();
+   *   }
+   *
+   *   public static void identityClientCreateUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       CreateUserRequest request =
+   *           CreateUserRequest.newBuilder()
+   *               .setParent(UserName.of("[USER]").toString())
+   *               .setUser(User.newBuilder().build())
+   *               .build();
+   *       User response = identityClient.createUser(request);
+   *     }
+   *   }
    * }
    * }
* @@ -321,15 +428,32 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   CreateUserRequest request =
-   *       CreateUserRequest.newBuilder()
-   *           .setParent(UserName.of("[USER]").toString())
-   *           .setUser(User.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = identityClient.createUserCallable().futureCall(request);
-   *   // Do something.
-   *   User response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.CreateUserRequest;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.User;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientCreateUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientCreateUser();
+   *   }
+   *
+   *   public static void identityClientCreateUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       CreateUserRequest request =
+   *           CreateUserRequest.newBuilder()
+   *               .setParent(UserName.of("[USER]").toString())
+   *               .setUser(User.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = identityClient.createUserCallable().futureCall(request);
+   *       // Do something.
+   *       User response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -342,9 +466,24 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   UserName name = UserName.of("[USER]");
-   *   User response = identityClient.getUser(name);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.User;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientGetUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientGetUser();
+   *   }
+   *
+   *   public static void identityClientGetUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       UserName name = UserName.of("[USER]");
+   *       User response = identityClient.getUser(name);
+   *     }
+   *   }
    * }
    * }
* @@ -362,9 +501,24 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   String name = UserName.of("[USER]").toString();
-   *   User response = identityClient.getUser(name);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.User;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientGetUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientGetUser();
+   *   }
+   *
+   *   public static void identityClientGetUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       String name = UserName.of("[USER]").toString();
+   *       User response = identityClient.getUser(name);
+   *     }
+   *   }
    * }
    * }
* @@ -381,10 +535,26 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   GetUserRequest request =
-   *       GetUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
-   *   User response = identityClient.getUser(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.GetUserRequest;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.User;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientGetUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientGetUser();
+   *   }
+   *
+   *   public static void identityClientGetUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       GetUserRequest request =
+   *           GetUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
+   *       User response = identityClient.getUser(request);
+   *     }
+   *   }
    * }
    * }
* @@ -400,12 +570,29 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   GetUserRequest request =
-   *       GetUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
-   *   ApiFuture future = identityClient.getUserCallable().futureCall(request);
-   *   // Do something.
-   *   User response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.GetUserRequest;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.User;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientGetUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientGetUser();
+   *   }
+   *
+   *   public static void identityClientGetUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       GetUserRequest request =
+   *           GetUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
+   *       ApiFuture future = identityClient.getUserCallable().futureCall(request);
+   *       // Do something.
+   *       User response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -418,10 +605,25 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   UpdateUserRequest request =
-   *       UpdateUserRequest.newBuilder().setUser(User.newBuilder().build()).build();
-   *   User response = identityClient.updateUser(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.UpdateUserRequest;
+   * import com.google.showcase.v1beta1.User;
+   *
+   * public class IdentityClientUpdateUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientUpdateUser();
+   *   }
+   *
+   *   public static void identityClientUpdateUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       UpdateUserRequest request =
+   *           UpdateUserRequest.newBuilder().setUser(User.newBuilder().build()).build();
+   *       User response = identityClient.updateUser(request);
+   *     }
+   *   }
    * }
    * }
* @@ -437,12 +639,28 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   UpdateUserRequest request =
-   *       UpdateUserRequest.newBuilder().setUser(User.newBuilder().build()).build();
-   *   ApiFuture future = identityClient.updateUserCallable().futureCall(request);
-   *   // Do something.
-   *   User response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.UpdateUserRequest;
+   * import com.google.showcase.v1beta1.User;
+   *
+   * public class IdentityClientUpdateUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientUpdateUser();
+   *   }
+   *
+   *   public static void identityClientUpdateUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       UpdateUserRequest request =
+   *           UpdateUserRequest.newBuilder().setUser(User.newBuilder().build()).build();
+   *       ApiFuture future = identityClient.updateUserCallable().futureCall(request);
+   *       // Do something.
+   *       User response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -455,9 +673,24 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   UserName name = UserName.of("[USER]");
-   *   identityClient.deleteUser(name);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientDeleteUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientDeleteUser();
+   *   }
+   *
+   *   public static void identityClientDeleteUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       UserName name = UserName.of("[USER]");
+   *       identityClient.deleteUser(name);
+   *     }
+   *   }
    * }
    * }
* @@ -475,9 +708,24 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   String name = UserName.of("[USER]").toString();
-   *   identityClient.deleteUser(name);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientDeleteUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientDeleteUser();
+   *   }
+   *
+   *   public static void identityClientDeleteUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       String name = UserName.of("[USER]").toString();
+   *       identityClient.deleteUser(name);
+   *     }
+   *   }
    * }
    * }
* @@ -494,10 +742,26 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   DeleteUserRequest request =
-   *       DeleteUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
-   *   identityClient.deleteUser(request);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.DeleteUserRequest;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientDeleteUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientDeleteUser();
+   *   }
+   *
+   *   public static void identityClientDeleteUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       DeleteUserRequest request =
+   *           DeleteUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
+   *       identityClient.deleteUser(request);
+   *     }
+   *   }
    * }
    * }
* @@ -513,12 +777,29 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   DeleteUserRequest request =
-   *       DeleteUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
-   *   ApiFuture future = identityClient.deleteUserCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.DeleteUserRequest;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.UserName;
+   *
+   * public class IdentityClientDeleteUser {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientDeleteUser();
+   *   }
+   *
+   *   public static void identityClientDeleteUser() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       DeleteUserRequest request =
+   *           DeleteUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
+   *       ApiFuture future = identityClient.deleteUserCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -531,14 +812,29 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   ListUsersRequest request =
-   *       ListUsersRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (User element : identityClient.listUsers(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.ListUsersRequest;
+   * import com.google.showcase.v1beta1.User;
+   *
+   * public class IdentityClientListUsers {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientListUsers();
+   *   }
+   *
+   *   public static void identityClientListUsers() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       ListUsersRequest request =
+   *           ListUsersRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (User element : identityClient.listUsers(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -555,16 +851,32 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   ListUsersRequest request =
-   *       ListUsersRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = identityClient.listUsersPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (User element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.ListUsersRequest;
+   * import com.google.showcase.v1beta1.User;
+   *
+   * public class IdentityClientListUsers {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientListUsers();
+   *   }
+   *
+   *   public static void identityClientListUsers() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       ListUsersRequest request =
+   *           ListUsersRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future = identityClient.listUsersPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (User element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -578,22 +890,39 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   ListUsersRequest request =
-   *       ListUsersRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListUsersResponse response = identityClient.listUsersCallable().call(request);
-   *     for (User element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.common.base.Strings;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.ListUsersRequest;
+   * import com.google.showcase.v1beta1.ListUsersResponse;
+   * import com.google.showcase.v1beta1.User;
+   *
+   * public class IdentityClientListUsers {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     identityClientListUsers();
+   *   }
+   *
+   *   public static void identityClientListUsers() throws Exception {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       ListUsersRequest request =
+   *           ListUsersRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListUsersResponse response = identityClient.listUsersCallable().call(request);
+   *         for (User element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/LoggingServiceV2StubSettings.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/LoggingServiceV2StubSettings.golden
index cc308eb5de..49868785b6 100644
--- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/LoggingServiceV2StubSettings.golden
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/LoggingServiceV2StubSettings.golden
@@ -77,18 +77,32 @@ import org.threeten.bp.Duration;
  * 

For example, to set the total timeout of deleteLog to 30 seconds: * *

{@code
- * LoggingServiceV2StubSettings.Builder loggingServiceV2SettingsBuilder =
- *     LoggingServiceV2StubSettings.newBuilder();
- * loggingServiceV2SettingsBuilder
- *     .deleteLogSettings()
- *     .setRetrySettings(
- *         loggingServiceV2SettingsBuilder
- *             .deleteLogSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * LoggingServiceV2StubSettings loggingServiceV2Settings = loggingServiceV2SettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.logging.v2.stub.LoggingServiceV2StubSettings;
+ * import java.time.Duration;
+ *
+ * public class LoggingServiceV2Settings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     loggingServiceV2Settings();
+ *   }
+ *
+ *   public static void loggingServiceV2Settings() throws Exception {
+ *     LoggingServiceV2StubSettings.Builder loggingServiceV2SettingsBuilder =
+ *         LoggingServiceV2StubSettings.newBuilder();
+ *     loggingServiceV2SettingsBuilder
+ *         .deleteLogSettings()
+ *         .setRetrySettings(
+ *             loggingServiceV2SettingsBuilder
+ *                 .deleteLogSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     LoggingServiceV2StubSettings loggingServiceV2Settings = loggingServiceV2SettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/MessagingClient.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/MessagingClient.golden index e881597fde..93708e3b1e 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/MessagingClient.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/MessagingClient.golden @@ -32,10 +32,24 @@ import javax.annotation.Generated; * that map to API methods. Sample code to get started: * *
{@code
- * try (MessagingClient messagingClient = MessagingClient.create()) {
- *   String displayName = "displayName1714148973";
- *   String description = "description-1724546052";
- *   Room response = messagingClient.createRoom(displayName, description);
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.MessagingClient;
+ * import com.google.showcase.v1beta1.Room;
+ *
+ * public class MessagingClientCreateRoom {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     messagingClientCreateRoom();
+ *   }
+ *
+ *   public static void messagingClientCreateRoom() throws Exception {
+ *     try (MessagingClient messagingClient = MessagingClient.create()) {
+ *       String displayName = "displayName1714148973";
+ *       String description = "description-1724546052";
+ *       Room response = messagingClient.createRoom(displayName, description);
+ *     }
+ *   }
  * }
  * }
* @@ -68,19 +82,50 @@ import javax.annotation.Generated; *

To customize credentials: * *

{@code
- * MessagingSettings messagingSettings =
- *     MessagingSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * MessagingClient messagingClient = MessagingClient.create(messagingSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.showcase.v1beta1.MessagingClient;
+ * import com.google.showcase.v1beta1.MessagingSettings;
+ * import com.google.showcase.v1beta1.myCredentials;
+ *
+ * public class MessagingClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     messagingClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void messagingClientSetCredentialsProvider() throws Exception {
+ *     MessagingSettings messagingSettings =
+ *         MessagingSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     MessagingClient messagingClient = MessagingClient.create(messagingSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * MessagingSettings messagingSettings =
- *     MessagingSettings.newBuilder().setEndpoint(myEndpoint).build();
- * MessagingClient messagingClient = MessagingClient.create(messagingSettings);
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.MessagingClient;
+ * import com.google.showcase.v1beta1.MessagingSettings;
+ * import com.google.showcase.v1beta1.myEndpoint;
+ *
+ * public class MessagingClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     messagingClientSetEndpoint();
+ *   }
+ *
+ *   public static void messagingClientSetEndpoint() throws Exception {
+ *     MessagingSettings messagingSettings =
+ *         MessagingSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     MessagingClient messagingClient = MessagingClient.create(messagingSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -153,10 +198,24 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *

{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   String displayName = "displayName1714148973";
-   *   String description = "description-1724546052";
-   *   Room response = messagingClient.createRoom(displayName, description);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   *
+   * public class MessagingClientCreateRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientCreateRoom();
+   *   }
+   *
+   *   public static void messagingClientCreateRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String displayName = "displayName1714148973";
+   *       String description = "description-1724546052";
+   *       Room response = messagingClient.createRoom(displayName, description);
+   *     }
+   *   }
    * }
    * }
* @@ -178,10 +237,25 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   CreateRoomRequest request =
-   *       CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
-   *   Room response = messagingClient.createRoom(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.CreateRoomRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   *
+   * public class MessagingClientCreateRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientCreateRoom();
+   *   }
+   *
+   *   public static void messagingClientCreateRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       CreateRoomRequest request =
+   *           CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
+   *       Room response = messagingClient.createRoom(request);
+   *     }
+   *   }
    * }
    * }
* @@ -197,12 +271,28 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   CreateRoomRequest request =
-   *       CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
-   *   ApiFuture future = messagingClient.createRoomCallable().futureCall(request);
-   *   // Do something.
-   *   Room response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.CreateRoomRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   *
+   * public class MessagingClientCreateRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientCreateRoom();
+   *   }
+   *
+   *   public static void messagingClientCreateRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       CreateRoomRequest request =
+   *           CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
+   *       ApiFuture future = messagingClient.createRoomCallable().futureCall(request);
+   *       // Do something.
+   *       Room response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -215,9 +305,24 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   RoomName name = RoomName.of("[ROOM]");
-   *   Room response = messagingClient.getRoom(name);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   * import com.google.showcase.v1beta1.RoomName;
+   *
+   * public class MessagingClientGetRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientGetRoom();
+   *   }
+   *
+   *   public static void messagingClientGetRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       RoomName name = RoomName.of("[ROOM]");
+   *       Room response = messagingClient.getRoom(name);
+   *     }
+   *   }
    * }
    * }
* @@ -235,9 +340,24 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   String name = RoomName.of("[ROOM]").toString();
-   *   Room response = messagingClient.getRoom(name);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   * import com.google.showcase.v1beta1.RoomName;
+   *
+   * public class MessagingClientGetRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientGetRoom();
+   *   }
+   *
+   *   public static void messagingClientGetRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String name = RoomName.of("[ROOM]").toString();
+   *       Room response = messagingClient.getRoom(name);
+   *     }
+   *   }
    * }
    * }
* @@ -254,10 +374,26 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   GetRoomRequest request =
-   *       GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
-   *   Room response = messagingClient.getRoom(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.GetRoomRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   * import com.google.showcase.v1beta1.RoomName;
+   *
+   * public class MessagingClientGetRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientGetRoom();
+   *   }
+   *
+   *   public static void messagingClientGetRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       GetRoomRequest request =
+   *           GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
+   *       Room response = messagingClient.getRoom(request);
+   *     }
+   *   }
    * }
    * }
* @@ -273,12 +409,29 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   GetRoomRequest request =
-   *       GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
-   *   ApiFuture future = messagingClient.getRoomCallable().futureCall(request);
-   *   // Do something.
-   *   Room response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.GetRoomRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   * import com.google.showcase.v1beta1.RoomName;
+   *
+   * public class MessagingClientGetRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientGetRoom();
+   *   }
+   *
+   *   public static void messagingClientGetRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       GetRoomRequest request =
+   *           GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
+   *       ApiFuture future = messagingClient.getRoomCallable().futureCall(request);
+   *       // Do something.
+   *       Room response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -291,10 +444,25 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   UpdateRoomRequest request =
-   *       UpdateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
-   *   Room response = messagingClient.updateRoom(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   * import com.google.showcase.v1beta1.UpdateRoomRequest;
+   *
+   * public class MessagingClientUpdateRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientUpdateRoom();
+   *   }
+   *
+   *   public static void messagingClientUpdateRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       UpdateRoomRequest request =
+   *           UpdateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
+   *       Room response = messagingClient.updateRoom(request);
+   *     }
+   *   }
    * }
    * }
* @@ -310,12 +478,28 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   UpdateRoomRequest request =
-   *       UpdateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
-   *   ApiFuture future = messagingClient.updateRoomCallable().futureCall(request);
-   *   // Do something.
-   *   Room response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   * import com.google.showcase.v1beta1.UpdateRoomRequest;
+   *
+   * public class MessagingClientUpdateRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientUpdateRoom();
+   *   }
+   *
+   *   public static void messagingClientUpdateRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       UpdateRoomRequest request =
+   *           UpdateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
+   *       ApiFuture future = messagingClient.updateRoomCallable().futureCall(request);
+   *       // Do something.
+   *       Room response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -328,9 +512,24 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   RoomName name = RoomName.of("[ROOM]");
-   *   messagingClient.deleteRoom(name);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.RoomName;
+   *
+   * public class MessagingClientDeleteRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientDeleteRoom();
+   *   }
+   *
+   *   public static void messagingClientDeleteRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       RoomName name = RoomName.of("[ROOM]");
+   *       messagingClient.deleteRoom(name);
+   *     }
+   *   }
    * }
    * }
* @@ -348,9 +547,24 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   String name = RoomName.of("[ROOM]").toString();
-   *   messagingClient.deleteRoom(name);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.RoomName;
+   *
+   * public class MessagingClientDeleteRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientDeleteRoom();
+   *   }
+   *
+   *   public static void messagingClientDeleteRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String name = RoomName.of("[ROOM]").toString();
+   *       messagingClient.deleteRoom(name);
+   *     }
+   *   }
    * }
    * }
* @@ -367,10 +581,26 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   DeleteRoomRequest request =
-   *       DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
-   *   messagingClient.deleteRoom(request);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.DeleteRoomRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.RoomName;
+   *
+   * public class MessagingClientDeleteRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientDeleteRoom();
+   *   }
+   *
+   *   public static void messagingClientDeleteRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       DeleteRoomRequest request =
+   *           DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
+   *       messagingClient.deleteRoom(request);
+   *     }
+   *   }
    * }
    * }
* @@ -386,12 +616,29 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   DeleteRoomRequest request =
-   *       DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
-   *   ApiFuture future = messagingClient.deleteRoomCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.DeleteRoomRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.RoomName;
+   *
+   * public class MessagingClientDeleteRoom {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientDeleteRoom();
+   *   }
+   *
+   *   public static void messagingClientDeleteRoom() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       DeleteRoomRequest request =
+   *           DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
+   *       ApiFuture future = messagingClient.deleteRoomCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -404,14 +651,29 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   ListRoomsRequest request =
-   *       ListRoomsRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Room element : messagingClient.listRooms(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.ListRoomsRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   *
+   * public class MessagingClientListRooms {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientListRooms();
+   *   }
+   *
+   *   public static void messagingClientListRooms() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ListRoomsRequest request =
+   *           ListRoomsRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (Room element : messagingClient.listRooms(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -428,16 +690,32 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   ListRoomsRequest request =
-   *       ListRoomsRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = messagingClient.listRoomsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Room element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.ListRoomsRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   *
+   * public class MessagingClientListRooms {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientListRooms();
+   *   }
+   *
+   *   public static void messagingClientListRooms() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ListRoomsRequest request =
+   *           ListRoomsRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future = messagingClient.listRoomsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Room element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -451,22 +729,39 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   ListRoomsRequest request =
-   *       ListRoomsRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListRoomsResponse response = messagingClient.listRoomsCallable().call(request);
-   *     for (Room element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.common.base.Strings;
+   * import com.google.showcase.v1beta1.ListRoomsRequest;
+   * import com.google.showcase.v1beta1.ListRoomsResponse;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
+   *
+   * public class MessagingClientListRooms {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientListRooms();
+   *   }
+   *
+   *   public static void messagingClientListRooms() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ListRoomsRequest request =
+   *           ListRoomsRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListRoomsResponse response = messagingClient.listRoomsCallable().call(request);
+   *         for (Room element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -481,10 +776,26 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   ProfileName parent = ProfileName.of("[USER]");
-   *   ByteString image = ByteString.EMPTY;
-   *   Blurb response = messagingClient.createBlurb(parent, image);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.ByteString;
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ProfileName parent = ProfileName.of("[USER]");
+   *       ByteString image = ByteString.EMPTY;
+   *       Blurb response = messagingClient.createBlurb(parent, image);
+   *     }
+   *   }
    * }
    * }
* @@ -506,10 +817,25 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   ProfileName parent = ProfileName.of("[USER]");
-   *   String text = "text3556653";
-   *   Blurb response = messagingClient.createBlurb(parent, text);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ProfileName parent = ProfileName.of("[USER]");
+   *       String text = "text3556653";
+   *       Blurb response = messagingClient.createBlurb(parent, text);
+   *     }
+   *   }
    * }
    * }
* @@ -531,10 +857,26 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   RoomName parent = RoomName.of("[ROOM]");
-   *   ByteString image = ByteString.EMPTY;
-   *   Blurb response = messagingClient.createBlurb(parent, image);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.ByteString;
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.RoomName;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       RoomName parent = RoomName.of("[ROOM]");
+   *       ByteString image = ByteString.EMPTY;
+   *       Blurb response = messagingClient.createBlurb(parent, image);
+   *     }
+   *   }
    * }
    * }
* @@ -556,10 +898,25 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   RoomName parent = RoomName.of("[ROOM]");
-   *   String text = "text3556653";
-   *   Blurb response = messagingClient.createBlurb(parent, text);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.RoomName;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       RoomName parent = RoomName.of("[ROOM]");
+   *       String text = "text3556653";
+   *       Blurb response = messagingClient.createBlurb(parent, text);
+   *     }
+   *   }
    * }
    * }
* @@ -581,10 +938,26 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   String parent = ProfileName.of("[USER]").toString();
-   *   ByteString image = ByteString.EMPTY;
-   *   Blurb response = messagingClient.createBlurb(parent, image);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.ByteString;
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String parent = ProfileName.of("[USER]").toString();
+   *       ByteString image = ByteString.EMPTY;
+   *       Blurb response = messagingClient.createBlurb(parent, image);
+   *     }
+   *   }
    * }
    * }
* @@ -606,10 +979,25 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   String parent = ProfileName.of("[USER]").toString();
-   *   String text = "text3556653";
-   *   Blurb response = messagingClient.createBlurb(parent, text);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String parent = ProfileName.of("[USER]").toString();
+   *       String text = "text3556653";
+   *       Blurb response = messagingClient.createBlurb(parent, text);
+   *     }
+   *   }
    * }
    * }
* @@ -631,13 +1019,29 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   CreateBlurbRequest request =
-   *       CreateBlurbRequest.newBuilder()
-   *           .setParent(ProfileName.of("[USER]").toString())
-   *           .setBlurb(Blurb.newBuilder().build())
-   *           .build();
-   *   Blurb response = messagingClient.createBlurb(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.CreateBlurbRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       CreateBlurbRequest request =
+   *           CreateBlurbRequest.newBuilder()
+   *               .setParent(ProfileName.of("[USER]").toString())
+   *               .setBlurb(Blurb.newBuilder().build())
+   *               .build();
+   *       Blurb response = messagingClient.createBlurb(request);
+   *     }
+   *   }
    * }
    * }
* @@ -653,15 +1057,32 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   CreateBlurbRequest request =
-   *       CreateBlurbRequest.newBuilder()
-   *           .setParent(ProfileName.of("[USER]").toString())
-   *           .setBlurb(Blurb.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = messagingClient.createBlurbCallable().futureCall(request);
-   *   // Do something.
-   *   Blurb response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.CreateBlurbRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       CreateBlurbRequest request =
+   *           CreateBlurbRequest.newBuilder()
+   *               .setParent(ProfileName.of("[USER]").toString())
+   *               .setBlurb(Blurb.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = messagingClient.createBlurbCallable().futureCall(request);
+   *       // Do something.
+   *       Blurb response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -674,9 +1095,24 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   BlurbName name = BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]");
-   *   Blurb response = messagingClient.getBlurb(name);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.BlurbName;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   *
+   * public class MessagingClientGetBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientGetBlurb();
+   *   }
+   *
+   *   public static void messagingClientGetBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       BlurbName name = BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]");
+   *       Blurb response = messagingClient.getBlurb(name);
+   *     }
+   *   }
    * }
    * }
* @@ -694,10 +1130,25 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   String name =
-   *       BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
-   *   Blurb response = messagingClient.getBlurb(name);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.BlurbName;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   *
+   * public class MessagingClientGetBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientGetBlurb();
+   *   }
+   *
+   *   public static void messagingClientGetBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String name =
+   *           BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
+   *       Blurb response = messagingClient.getBlurb(name);
+   *     }
+   *   }
    * }
    * }
* @@ -714,14 +1165,30 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   GetBlurbRequest request =
-   *       GetBlurbRequest.newBuilder()
-   *           .setName(
-   *               BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
-   *                   .toString())
-   *           .build();
-   *   Blurb response = messagingClient.getBlurb(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.BlurbName;
+   * import com.google.showcase.v1beta1.GetBlurbRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   *
+   * public class MessagingClientGetBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientGetBlurb();
+   *   }
+   *
+   *   public static void messagingClientGetBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       GetBlurbRequest request =
+   *           GetBlurbRequest.newBuilder()
+   *               .setName(
+   *                   BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
+   *                       .toString())
+   *               .build();
+   *       Blurb response = messagingClient.getBlurb(request);
+   *     }
+   *   }
    * }
    * }
* @@ -737,16 +1204,33 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   GetBlurbRequest request =
-   *       GetBlurbRequest.newBuilder()
-   *           .setName(
-   *               BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future = messagingClient.getBlurbCallable().futureCall(request);
-   *   // Do something.
-   *   Blurb response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.BlurbName;
+   * import com.google.showcase.v1beta1.GetBlurbRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   *
+   * public class MessagingClientGetBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientGetBlurb();
+   *   }
+   *
+   *   public static void messagingClientGetBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       GetBlurbRequest request =
+   *           GetBlurbRequest.newBuilder()
+   *               .setName(
+   *                   BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future = messagingClient.getBlurbCallable().futureCall(request);
+   *       // Do something.
+   *       Blurb response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -759,10 +1243,25 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   UpdateBlurbRequest request =
-   *       UpdateBlurbRequest.newBuilder().setBlurb(Blurb.newBuilder().build()).build();
-   *   Blurb response = messagingClient.updateBlurb(request);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.UpdateBlurbRequest;
+   *
+   * public class MessagingClientUpdateBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientUpdateBlurb();
+   *   }
+   *
+   *   public static void messagingClientUpdateBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       UpdateBlurbRequest request =
+   *           UpdateBlurbRequest.newBuilder().setBlurb(Blurb.newBuilder().build()).build();
+   *       Blurb response = messagingClient.updateBlurb(request);
+   *     }
+   *   }
    * }
    * }
* @@ -778,12 +1277,28 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   UpdateBlurbRequest request =
-   *       UpdateBlurbRequest.newBuilder().setBlurb(Blurb.newBuilder().build()).build();
-   *   ApiFuture future = messagingClient.updateBlurbCallable().futureCall(request);
-   *   // Do something.
-   *   Blurb response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.UpdateBlurbRequest;
+   *
+   * public class MessagingClientUpdateBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientUpdateBlurb();
+   *   }
+   *
+   *   public static void messagingClientUpdateBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       UpdateBlurbRequest request =
+   *           UpdateBlurbRequest.newBuilder().setBlurb(Blurb.newBuilder().build()).build();
+   *       ApiFuture future = messagingClient.updateBlurbCallable().futureCall(request);
+   *       // Do something.
+   *       Blurb response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -796,9 +1311,24 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   BlurbName name = BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]");
-   *   messagingClient.deleteBlurb(name);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.BlurbName;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   *
+   * public class MessagingClientDeleteBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientDeleteBlurb();
+   *   }
+   *
+   *   public static void messagingClientDeleteBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       BlurbName name = BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]");
+   *       messagingClient.deleteBlurb(name);
+   *     }
+   *   }
    * }
    * }
* @@ -816,10 +1346,25 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   String name =
-   *       BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
-   *   messagingClient.deleteBlurb(name);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.BlurbName;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   *
+   * public class MessagingClientDeleteBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientDeleteBlurb();
+   *   }
+   *
+   *   public static void messagingClientDeleteBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String name =
+   *           BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
+   *       messagingClient.deleteBlurb(name);
+   *     }
+   *   }
    * }
    * }
* @@ -836,14 +1381,30 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   DeleteBlurbRequest request =
-   *       DeleteBlurbRequest.newBuilder()
-   *           .setName(
-   *               BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
-   *                   .toString())
-   *           .build();
-   *   messagingClient.deleteBlurb(request);
+   * package com.google.example;
+   *
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.BlurbName;
+   * import com.google.showcase.v1beta1.DeleteBlurbRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   *
+   * public class MessagingClientDeleteBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientDeleteBlurb();
+   *   }
+   *
+   *   public static void messagingClientDeleteBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       DeleteBlurbRequest request =
+   *           DeleteBlurbRequest.newBuilder()
+   *               .setName(
+   *                   BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
+   *                       .toString())
+   *               .build();
+   *       messagingClient.deleteBlurb(request);
+   *     }
+   *   }
    * }
    * }
* @@ -859,16 +1420,33 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   DeleteBlurbRequest request =
-   *       DeleteBlurbRequest.newBuilder()
-   *           .setName(
-   *               BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future = messagingClient.deleteBlurbCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.BlurbName;
+   * import com.google.showcase.v1beta1.DeleteBlurbRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   *
+   * public class MessagingClientDeleteBlurb {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientDeleteBlurb();
+   *   }
+   *
+   *   public static void messagingClientDeleteBlurb() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       DeleteBlurbRequest request =
+   *           DeleteBlurbRequest.newBuilder()
+   *               .setName(
+   *                   BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future = messagingClient.deleteBlurbCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -881,10 +1459,25 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   ProfileName parent = ProfileName.of("[USER]");
-   *   for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ProfileName parent = ProfileName.of("[USER]");
+   *       for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -903,10 +1496,25 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   RoomName parent = RoomName.of("[ROOM]");
-   *   for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.RoomName;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       RoomName parent = RoomName.of("[ROOM]");
+   *       for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -925,10 +1533,25 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   String parent = ProfileName.of("[USER]").toString();
-   *   for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String parent = ProfileName.of("[USER]").toString();
+   *       for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -946,15 +1569,31 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   ListBlurbsRequest request =
-   *       ListBlurbsRequest.newBuilder()
-   *           .setParent(ProfileName.of("[USER]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Blurb element : messagingClient.listBlurbs(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.ListBlurbsRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ListBlurbsRequest request =
+   *           ListBlurbsRequest.newBuilder()
+   *               .setParent(ProfileName.of("[USER]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (Blurb element : messagingClient.listBlurbs(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -971,17 +1610,34 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   ListBlurbsRequest request =
-   *       ListBlurbsRequest.newBuilder()
-   *           .setParent(ProfileName.of("[USER]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = messagingClient.listBlurbsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Blurb element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.ListBlurbsRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ListBlurbsRequest request =
+   *           ListBlurbsRequest.newBuilder()
+   *               .setParent(ProfileName.of("[USER]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future = messagingClient.listBlurbsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Blurb element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -995,23 +1651,41 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   ListBlurbsRequest request =
-   *       ListBlurbsRequest.newBuilder()
-   *           .setParent(ProfileName.of("[USER]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListBlurbsResponse response = messagingClient.listBlurbsCallable().call(request);
-   *     for (Blurb element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.common.base.Strings;
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.ListBlurbsRequest;
+   * import com.google.showcase.v1beta1.ListBlurbsResponse;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ListBlurbsRequest request =
+   *           ListBlurbsRequest.newBuilder()
+   *               .setParent(ProfileName.of("[USER]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListBlurbsResponse response = messagingClient.listBlurbsCallable().call(request);
+   *         for (Blurb element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -1026,9 +1700,23 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   String query = "query107944136";
-   *   SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(query).get();
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.SearchBlurbsResponse;
+   *
+   * public class MessagingClientSearchBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientSearchBlurbs();
+   *   }
+   *
+   *   public static void messagingClientSearchBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String query = "query107944136";
+   *       SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(query).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1046,15 +1734,31 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   SearchBlurbsRequest request =
-   *       SearchBlurbsRequest.newBuilder()
-   *           .setQuery("query107944136")
-   *           .setParent(ProfileName.of("[USER]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   * import com.google.showcase.v1beta1.SearchBlurbsRequest;
+   * import com.google.showcase.v1beta1.SearchBlurbsResponse;
+   *
+   * public class MessagingClientSearchBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientSearchBlurbs();
+   *   }
+   *
+   *   public static void messagingClientSearchBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       SearchBlurbsRequest request =
+   *           SearchBlurbsRequest.newBuilder()
+   *               .setQuery("query107944136")
+   *               .setParent(ProfileName.of("[USER]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1071,18 +1775,36 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   SearchBlurbsRequest request =
-   *       SearchBlurbsRequest.newBuilder()
-   *           .setQuery("query107944136")
-   *           .setParent(ProfileName.of("[USER]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   OperationFuture future =
-   *       messagingClient.searchBlurbsOperationCallable().futureCall(request);
-   *   // Do something.
-   *   SearchBlurbsResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   * import com.google.showcase.v1beta1.SearchBlurbsMetadata;
+   * import com.google.showcase.v1beta1.SearchBlurbsRequest;
+   * import com.google.showcase.v1beta1.SearchBlurbsResponse;
+   *
+   * public class MessagingClientSearchBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientSearchBlurbs();
+   *   }
+   *
+   *   public static void messagingClientSearchBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       SearchBlurbsRequest request =
+   *           SearchBlurbsRequest.newBuilder()
+   *               .setQuery("query107944136")
+   *               .setParent(ProfileName.of("[USER]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       OperationFuture future =
+   *           messagingClient.searchBlurbsOperationCallable().futureCall(request);
+   *       // Do something.
+   *       SearchBlurbsResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1096,17 +1818,34 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   SearchBlurbsRequest request =
-   *       SearchBlurbsRequest.newBuilder()
-   *           .setQuery("query107944136")
-   *           .setParent(ProfileName.of("[USER]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = messagingClient.searchBlurbsCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.longrunning.Operation;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   * import com.google.showcase.v1beta1.SearchBlurbsRequest;
+   *
+   * public class MessagingClientSearchBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientSearchBlurbs();
+   *   }
+   *
+   *   public static void messagingClientSearchBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       SearchBlurbsRequest request =
+   *           SearchBlurbsRequest.newBuilder()
+   *               .setQuery("query107944136")
+   *               .setParent(ProfileName.of("[USER]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future = messagingClient.searchBlurbsCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1119,13 +1858,30 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   StreamBlurbsRequest request =
-   *       StreamBlurbsRequest.newBuilder().setName(ProfileName.of("[USER]").toString()).build();
-   *   ServerStream stream =
-   *       messagingClient.streamBlurbsCallable().call(request);
-   *   for (StreamBlurbsResponse response : stream) {
-   *     // Do something when a response is received.
+   * package com.google.example;
+   *
+   * import com.google.api.gax.rpc.ServerStream;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   * import com.google.showcase.v1beta1.StreamBlurbsRequest;
+   * import com.google.showcase.v1beta1.StreamBlurbsResponse;
+   *
+   * public class MessagingClientStreamBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientStreamBlurbs();
+   *   }
+   *
+   *   public static void messagingClientStreamBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       StreamBlurbsRequest request =
+   *           StreamBlurbsRequest.newBuilder().setName(ProfileName.of("[USER]").toString()).build();
+   *       ServerStream stream =
+   *           messagingClient.streamBlurbsCallable().call(request);
+   *       for (StreamBlurbsResponse response : stream) {
+   *         // Do something when a response is received.
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1140,32 +1896,50 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   ApiStreamObserver responseObserver =
-   *       new ApiStreamObserver() {
-   *         {@literal @}Override
-   *         public void onNext(SendBlurbsResponse response) {
-   *           // Do something when a response is received.
-   *         }
+   * package com.google.example;
    *
-   *         {@literal @}Override
-   *         public void onError(Throwable t) {
-   *           // Add error-handling
-   *         }
+   * import com.google.api.gax.rpc.ApiStreamObserver;
+   * import com.google.showcase.v1beta1.Blurb;
+   * import com.google.showcase.v1beta1.CreateBlurbRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.ProfileName;
+   * import com.google.showcase.v1beta1.SendBlurbsResponse;
    *
-   *         {@literal @}Override
-   *         public void onCompleted() {
-   *           // Do something when complete.
-   *         }
-   *       };
-   *   ApiStreamObserver requestObserver =
-   *       messagingClient.sendBlurbs().clientStreamingCall(responseObserver);
-   *   CreateBlurbRequest request =
-   *       CreateBlurbRequest.newBuilder()
-   *           .setParent(ProfileName.of("[USER]").toString())
-   *           .setBlurb(Blurb.newBuilder().build())
-   *           .build();
-   *   requestObserver.onNext(request);
+   * public class MessagingClientSendBlurbs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientSendBlurbs();
+   *   }
+   *
+   *   public static void messagingClientSendBlurbs() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ApiStreamObserver responseObserver =
+   *           new ApiStreamObserver() {
+   *             {@literal @}Override
+   *             public void onNext(SendBlurbsResponse response) {
+   *               // Do something when a response is received.
+   *             }
+   *
+   *             {@literal @}Override
+   *             public void onError(Throwable t) {
+   *               // Add error-handling
+   *             }
+   *
+   *             {@literal @}Override
+   *             public void onCompleted() {
+   *               // Do something when complete.
+   *             }
+   *           };
+   *       ApiStreamObserver requestObserver =
+   *           messagingClient.sendBlurbs().clientStreamingCall(responseObserver);
+   *       CreateBlurbRequest request =
+   *           CreateBlurbRequest.newBuilder()
+   *               .setParent(ProfileName.of("[USER]").toString())
+   *               .setBlurb(Blurb.newBuilder().build())
+   *               .build();
+   *       requestObserver.onNext(request);
+   *     }
+   *   }
    * }
    * }
*/ @@ -1179,13 +1953,29 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   BidiStream bidiStream =
-   *       messagingClient.connectCallable().call();
-   *   ConnectRequest request = ConnectRequest.newBuilder().build();
-   *   bidiStream.send(request);
-   *   for (StreamBlurbsResponse response : bidiStream) {
-   *     // Do something when a response is received.
+   * package com.google.example;
+   *
+   * import com.google.api.gax.rpc.BidiStream;
+   * import com.google.showcase.v1beta1.ConnectRequest;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.StreamBlurbsResponse;
+   *
+   * public class MessagingClientConnect {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     messagingClientConnect();
+   *   }
+   *
+   *   public static void messagingClientConnect() throws Exception {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       BidiStream bidiStream =
+   *           messagingClient.connectCallable().call();
+   *       ConnectRequest request = ConnectRequest.newBuilder().build();
+   *       bidiStream.send(request);
+   *       for (StreamBlurbsResponse response : bidiStream) {
+   *         // Do something when a response is received.
+   *       }
+   *     }
    *   }
    * }
    * }
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/PublisherStubSettings.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/PublisherStubSettings.golden index d050f8a921..63b8aea2b9 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/PublisherStubSettings.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/PublisherStubSettings.golden @@ -78,17 +78,31 @@ import org.threeten.bp.Duration; *

For example, to set the total timeout of createTopic to 30 seconds: * *

{@code
- * PublisherStubSettings.Builder publisherSettingsBuilder = PublisherStubSettings.newBuilder();
- * publisherSettingsBuilder
- *     .createTopicSettings()
- *     .setRetrySettings(
- *         publisherSettingsBuilder
- *             .createTopicSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * PublisherStubSettings publisherSettings = publisherSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.pubsub.v1.stub.PublisherStubSettings;
+ * import java.time.Duration;
+ *
+ * public class PublisherSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     publisherSettings();
+ *   }
+ *
+ *   public static void publisherSettings() throws Exception {
+ *     PublisherStubSettings.Builder publisherSettingsBuilder = PublisherStubSettings.newBuilder();
+ *     publisherSettingsBuilder
+ *         .createTopicSettings()
+ *         .setRetrySettings(
+ *             publisherSettingsBuilder
+ *                 .createTopicSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     PublisherStubSettings publisherSettings = publisherSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceSettings.golden b/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceSettings.golden index 11af8d46ae..3392858161 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceSettings.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceSettings.golden @@ -34,17 +34,31 @@ import javax.annotation.Generated; *

For example, to set the total timeout of repeatDataBody to 30 seconds: * *

{@code
- * ComplianceSettings.Builder complianceSettingsBuilder = ComplianceSettings.newBuilder();
- * complianceSettingsBuilder
- *     .repeatDataBodySettings()
- *     .setRetrySettings(
- *         complianceSettingsBuilder
- *             .repeatDataBodySettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * ComplianceSettings complianceSettings = complianceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.ComplianceSettings;
+ * import java.time.Duration;
+ *
+ * public class ComplianceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     complianceSettings();
+ *   }
+ *
+ *   public static void complianceSettings() throws Exception {
+ *     ComplianceSettings.Builder complianceSettingsBuilder = ComplianceSettings.newBuilder();
+ *     complianceSettingsBuilder
+ *         .repeatDataBodySettings()
+ *         .setRetrySettings(
+ *             complianceSettingsBuilder
+ *                 .repeatDataBodySettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     ComplianceSettings complianceSettings = complianceSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @BetaApi diff --git a/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceStubSettings.golden b/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceStubSettings.golden index fe74c48c98..3c261fa2d2 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceStubSettings.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceStubSettings.golden @@ -43,17 +43,31 @@ import javax.annotation.Generated; *

For example, to set the total timeout of repeatDataBody to 30 seconds: * *

{@code
- * ComplianceStubSettings.Builder complianceSettingsBuilder = ComplianceStubSettings.newBuilder();
- * complianceSettingsBuilder
- *     .repeatDataBodySettings()
- *     .setRetrySettings(
- *         complianceSettingsBuilder
- *             .repeatDataBodySettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * ComplianceStubSettings complianceSettings = complianceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.stub.ComplianceStubSettings;
+ * import java.time.Duration;
+ *
+ * public class ComplianceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     complianceSettings();
+ *   }
+ *
+ *   public static void complianceSettings() throws Exception {
+ *     ComplianceStubSettings.Builder complianceSettingsBuilder = ComplianceStubSettings.newBuilder();
+ *     complianceSettingsBuilder
+ *         .repeatDataBodySettings()
+ *         .setRetrySettings(
+ *             complianceSettingsBuilder
+ *                 .repeatDataBodySettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     ComplianceStubSettings complianceSettings = complianceSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @BetaApi diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/BUILD.bazel b/src/test/java/com/google/api/generator/gapic/composer/samplecode/BUILD.bazel index 7a1cdbb61c..99726bc8ef 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/samplecode/BUILD.bazel +++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/BUILD.bazel @@ -7,6 +7,8 @@ TESTS = [ "SampleCodeWriterTest", "ServiceClientSampleCodeComposerTest", "SettingsSampleCodeComposerTest", + "ExecutableSampleComposerTest", + "SampleUtilTest", ] filegroup( diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposerTest.java new file mode 100644 index 0000000000..653842b147 --- /dev/null +++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposerTest.java @@ -0,0 +1,179 @@ +// Copyright 2021 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 +// +// http://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.api.generator.gapic.composer.samplecode; + +import static org.junit.Assert.assertEquals; + +import com.google.api.generator.engine.ast.AssignmentExpr; +import com.google.api.generator.engine.ast.ExprStatement; +import com.google.api.generator.engine.ast.Statement; +import com.google.api.generator.engine.ast.StringObjectValue; +import com.google.api.generator.engine.ast.TypeNode; +import com.google.api.generator.engine.ast.ValueExpr; +import com.google.api.generator.engine.ast.Variable; +import com.google.api.generator.engine.ast.VariableExpr; +import com.google.api.generator.testutils.LineFormatter; +import com.google.common.collect.ImmutableList; +import java.util.ArrayList; +import org.junit.Test; + +public class ExecutableSampleComposerTest { + + @Test + public void createExecutableSampleEmptySample() { + String sampleMethodName = "echoClientWait"; + + ExecutableSample executableSample = + new ExecutableSample(sampleMethodName, new ArrayList<>(), new ArrayList<>()); + String sampleResult = ExecutableSampleComposer.createExecutableSample(executableSample); + + String expected = + LineFormatter.lines( + "package com.google.example;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {}\n", + "}\n"); + + assertEquals(sampleResult, expected); + } + + @Test + public void createExecutableSampleMethodArgsNoVar() { + String sampleMethodName = "echoClientWait"; + Statement sampleBody = + ExprStatement.withExpr(SampleUtil.systemOutPrint("Testing " + sampleMethodName)); + ExecutableSample executableSample = + new ExecutableSample(sampleMethodName, new ArrayList<>(), ImmutableList.of(sampleBody)); + + String sampleResult = ExecutableSampleComposer.createExecutableSample(executableSample); + String expected = + LineFormatter.lines( + "package com.google.example;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {\n", + " System.out.println(\"Testing echoClientWait\");\n", + " }\n", + "}\n"); + + assertEquals(sampleResult, expected); + } + + @Test + public void createExecutableSampleMethod() { + String sampleMethodName = "echoClientWait"; + VariableExpr variableExpr = + VariableExpr.builder() + .setVariable(Variable.builder().setType(TypeNode.STRING).setName("content").build()) + .setIsDecl(true) + .build(); + AssignmentExpr varAssignment = + AssignmentExpr.builder() + .setVariableExpr(variableExpr) + .setValueExpr( + ValueExpr.withValue(StringObjectValue.withValue("Testing " + sampleMethodName))) + .build(); + Statement sampleBody = ExprStatement.withExpr(SampleUtil.systemOutPrint(variableExpr)); + ExecutableSample executableSample = + new ExecutableSample( + sampleMethodName, ImmutableList.of(varAssignment), ImmutableList.of(sampleBody)); + + String sampleResult = ExecutableSampleComposer.createExecutableSample(executableSample); + String expected = + LineFormatter.lines( + "package com.google.example;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " String content = \"Testing echoClientWait\";\n", + " echoClientWait(content);\n", + " }\n", + "\n", + " public static void echoClientWait(String content) throws Exception {\n", + " System.out.println(content);\n", + " }\n", + "}\n"); + + assertEquals(sampleResult, expected); + } + + @Test + public void createExecutableSampleMethodMultipleStatements() { + String sampleMethodName = "echoClientWait"; + VariableExpr variableExpr = + VariableExpr.builder() + .setVariable(Variable.builder().setType(TypeNode.STRING).setName("content").build()) + .setIsDecl(true) + .build(); + VariableExpr variableExpr2 = + VariableExpr.builder() + .setVariable( + Variable.builder().setType(TypeNode.STRING).setName("otherContent").build()) + .setIsDecl(true) + .build(); + AssignmentExpr varAssignment = + AssignmentExpr.builder() + .setVariableExpr(variableExpr) + .setValueExpr( + ValueExpr.withValue(StringObjectValue.withValue("Testing " + sampleMethodName))) + .build(); + AssignmentExpr varAssignment2 = + AssignmentExpr.builder() + .setVariableExpr(variableExpr2) + .setValueExpr( + ValueExpr.withValue(StringObjectValue.withValue("Samples " + sampleMethodName))) + .build(); + Statement bodyStatement = ExprStatement.withExpr(SampleUtil.systemOutPrint(variableExpr)); + Statement bodyStatement2 = ExprStatement.withExpr(SampleUtil.systemOutPrint(variableExpr2)); + ExecutableSample executableSample = + new ExecutableSample( + sampleMethodName, + ImmutableList.of(varAssignment, varAssignment2), + ImmutableList.of(bodyStatement, bodyStatement2)); + + String sampleResult = ExecutableSampleComposer.createExecutableSample(executableSample); + String expected = + LineFormatter.lines( + "package com.google.example;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " String content = \"Testing echoClientWait\";\n", + " String otherContent = \"Samples echoClientWait\";\n", + " echoClientWait(content, otherContent);\n", + " }\n", + "\n", + " public static void echoClientWait(String content, String otherContent) throws Exception {\n", + " System.out.println(content);\n", + " System.out.println(otherContent);\n", + " }\n", + "}\n"); + + assertEquals(sampleResult, expected); + } +} diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeWriterTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeWriterTest.java index d9456c7dcf..efe211362e 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeWriterTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeWriterTest.java @@ -17,28 +17,27 @@ import static junit.framework.TestCase.assertEquals; import com.google.api.gax.rpc.ClientSettings; -import com.google.api.generator.engine.ast.AssignmentExpr; -import com.google.api.generator.engine.ast.ConcreteReference; -import com.google.api.generator.engine.ast.ExprStatement; -import com.google.api.generator.engine.ast.MethodInvocationExpr; -import com.google.api.generator.engine.ast.PrimitiveValue; -import com.google.api.generator.engine.ast.Statement; -import com.google.api.generator.engine.ast.TryCatchStatement; -import com.google.api.generator.engine.ast.TypeNode; -import com.google.api.generator.engine.ast.ValueExpr; -import com.google.api.generator.engine.ast.Variable; -import com.google.api.generator.engine.ast.VariableExpr; +import com.google.api.generator.engine.ast.*; +import com.google.api.generator.testutils.LineFormatter; import java.util.Arrays; +import org.junit.BeforeClass; import org.junit.Test; public class SampleCodeWriterTest { - @Test - public void writeSampleCode_statements() { + private static String packageName; + private static MethodInvocationExpr methodInvocationExpr; + private static AssignmentExpr assignmentExpr; + private static Statement sampleStatement; + private static ClassDefinition classDefinition; + private static String className; + + @BeforeClass + public static void setup() { TypeNode settingType = TypeNode.withReference(ConcreteReference.withClazz(ClientSettings.class)); Variable aVar = Variable.builder().setName("clientSettings").setType(settingType).build(); VariableExpr aVarExpr = VariableExpr.withVariable(aVar); - MethodInvocationExpr aValueExpr = + methodInvocationExpr = MethodInvocationExpr.builder() .setExprReferenceExpr( MethodInvocationExpr.builder() @@ -48,18 +47,47 @@ public void writeSampleCode_statements() { .setReturnType(settingType) .setMethodName("build") .build(); - AssignmentExpr assignmentExpr = + assignmentExpr = AssignmentExpr.builder() .setVariableExpr(aVarExpr.toBuilder().setIsDecl(true).build()) - .setValueExpr(aValueExpr) + .setValueExpr(methodInvocationExpr) .build(); - Statement sampleStatement = + sampleStatement = TryCatchStatement.builder() .setTryResourceExpr(createAssignmentExpr("aBool", "false", TypeNode.BOOLEAN)) .setTryBody( Arrays.asList(ExprStatement.withExpr(createAssignmentExpr("x", "3", TypeNode.INT)))) .setIsSampleCode(true) .build(); + + MethodDefinition methdod = + MethodDefinition.builder() + .setScope(ScopeNode.PUBLIC) + .setIsStatic(true) + .setReturnType(TypeNode.VOID) + .setName("main") + .setArguments( + VariableExpr.builder() + .setVariable( + Variable.builder().setType(TypeNode.STRING_ARRAY).setName("args").build()) + .setIsDecl(true) + .build()) + .setBody(Arrays.asList(sampleStatement)) + .build(); + + packageName = "com.google.example"; + className = "SampleClassName"; + classDefinition = + ClassDefinition.builder() + .setScope(ScopeNode.PUBLIC) + .setPackageString(packageName) + .setName(className) + .setMethods(Arrays.asList(methdod)) + .build(); + } + + @Test + public void writeSampleCode_statements() { String result = SampleCodeWriter.write(ExprStatement.withExpr(assignmentExpr), sampleStatement); String expected = "ClientSettings clientSettings = ClientSettings.newBuilder().build();\n" @@ -69,7 +97,34 @@ public void writeSampleCode_statements() { assertEquals(expected, result); } - private AssignmentExpr createAssignmentExpr(String varName, String varValue, TypeNode type) { + @Test + public void writeSampleCode_methodInvocation() { + String result = SampleCodeWriter.write(methodInvocationExpr); + String expected = "ClientSettings.newBuilder().build()"; + assertEquals(expected, result); + } + + @Test + public void writeSampleCode_classDefinition() { + String result = SampleCodeWriter.write(classDefinition); + String expected = + LineFormatter.lines( + "package " + packageName + ";\n", + "\n", + "public class " + className + " {\n", + "\n", + " public static void main(String[] args) {\n", + " try (boolean aBool = false) {\n", + " int x = 3;\n", + " }\n", + " }\n", + "}\n"); + + assertEquals(expected, result); + } + + private static AssignmentExpr createAssignmentExpr( + String varName, String varValue, TypeNode type) { Variable variable = Variable.builder().setName(varName).setType(type).build(); VariableExpr variableExpr = VariableExpr.builder().setVariable(variable).setIsDecl(true).build(); diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleUtilTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleUtilTest.java new file mode 100644 index 0000000000..0b647c0b37 --- /dev/null +++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleUtilTest.java @@ -0,0 +1,84 @@ +// Copyright 2021 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 +// +// http://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.api.generator.gapic.composer.samplecode; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; + +import com.google.api.generator.engine.ast.*; +import java.util.UUID; +import org.junit.Test; + +public class SampleUtilTest { + @Test + public void composeSampleMethodName() { + String expected = "echoClientWait"; + + String clientName = "EchoClient"; + String methodName = "wait"; + String result = SampleUtil.composeSampleMethodName(clientName, methodName); + assertEquals(expected, result); + + clientName = "echoClient"; + methodName = "Wait"; + result = SampleUtil.composeSampleMethodName(clientName, methodName); + assertEquals(expected, result); + + clientName = "EchoClient"; + methodName = "Wait"; + result = SampleUtil.composeSampleMethodName(clientName, methodName); + assertEquals(expected, result); + + clientName = "echoClient"; + methodName = "wait"; + result = SampleUtil.composeSampleMethodName(clientName, methodName); + assertEquals(expected, result); + } + + @Test + public void composeSampleMethodNameEmpty() { + String emptyclientName = ""; + String methodName = "wait"; + assertThrows( + IllegalArgumentException.class, + () -> SampleUtil.composeSampleMethodName(emptyclientName, methodName)); + + String clientName = "EchoClient"; + String emptyMethodName = ""; + assertThrows( + IllegalArgumentException.class, + () -> SampleUtil.composeSampleMethodName(clientName, emptyMethodName)); + ; + } + + @Test + public void systemOutPrintVariable() { + String content = "Testing systemOutPrintVariable" + UUID.randomUUID(); + String result = SampleCodeWriter.write(SampleUtil.systemOutPrint(content)); + String expected = "System.out.println(\"" + content + "\")"; + assertEquals(expected, result); + } + + @Test + public void systemOutPrintString() { + String testingVarName = "testingVar"; + VariableExpr testingVar = + VariableExpr.withVariable( + Variable.builder().setType(TypeNode.STRING).setName(testingVarName).build()); + String result = SampleCodeWriter.write(SampleUtil.systemOutPrint(testingVar)); + String expected = "System.out.println(" + testingVarName + ")"; + assertEquals(expected, result); + } +} diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleCodeComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleCodeComposerTest.java index 397e0ec2c2..c420d0a2b6 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleCodeComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleCodeComposerTest.java @@ -14,6 +14,7 @@ package com.google.api.generator.gapic.composer.samplecode; +import static com.google.api.generator.gapic.composer.samplecode.ExecutableSampleComposer.createExecutableSample; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThrows; @@ -70,9 +71,23 @@ public void composeClassHeaderMethodSampleCode_unaryRpc() { echoProtoService, clientType, resourceNames, messageTypes); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " EchoResponse response = echoClient.echo();\n", - "}"); + "package com.google.example;\n", + "\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoResponse;\n", + "\n", + "public class EchoClientEcho {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientEcho();\n", + " }\n", + "\n", + " public static void echoClientEcho() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " EchoResponse response = echoClient.echo();\n", + " }\n", + " }\n", + "}\n"); assertEquals(expected, results); } @@ -152,11 +167,26 @@ public void composeClassHeaderMethodSampleCode_firstMethodIsNotUnaryRpc() { service, clientType, resourceNames, messageTypes); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " Duration ttl = Duration.newBuilder().build();\n", - " WaitResponse response = echoClient.waitAsync(ttl).get();\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.protobuf.Duration;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.WaitResponse;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " Duration ttl = Duration.newBuilder().build();\n", + " WaitResponse response = echoClient.waitAsync(ttl).get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -205,19 +235,35 @@ public void composeClassHeaderMethodSampleCode_firstMethodHasNoSignatures() { service, clientType, resourceNames, messageTypes); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " EchoRequest request =\n", - " EchoRequest.newBuilder()\n", - " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setSeverity(Severity.forNumber(0))\n", - " .setFoobar(Foobar.newBuilder().build())\n", - " .build();\n", - " EchoResponse response = echoClient.echo(request);\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoRequest;\n", + "import com.google.showcase.v1beta1.EchoResponse;\n", + "import com.google.showcase.v1beta1.Foobar;\n", + "import com.google.showcase.v1beta1.FoobarName;\n", + "import com.google.showcase.v1beta1.Severity;\n", + "\n", + "public class EchoClientEcho {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientEcho();\n", + " }\n", + "\n", + " public static void echoClientEcho() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " EchoRequest request =\n", + " EchoRequest.newBuilder()\n", + " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setSeverity(Severity.forNumber(0))\n", + " .setFoobar(Foobar.newBuilder().build())\n", + " .build();\n", + " EchoResponse response = echoClient.echo(request);\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -266,16 +312,31 @@ public void composeClassHeaderMethodSampleCode_firstMethodIsStream() { service, clientType, resourceNames, messageTypes); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " ExpandRequest request =\n", - " " - + " ExpandRequest.newBuilder().setContent(\"content951530617\").setInfo(\"info3237038\").build();\n", - " ServerStream stream = echoClient.expandCallable().call(request);\n", - " for (EchoResponse response : stream) {\n", - " // Do something when a response is received.\n", + "package com.google.example;\n", + "\n", + "import com.google.api.gax.rpc.ServerStream;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoResponse;\n", + "import com.google.showcase.v1beta1.ExpandRequest;\n", + "\n", + "public class EchoClientExpand {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientExpand();\n", " }\n", - "}"); - assertEquals(results, expected); + "\n", + " public static void echoClientExpand() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " ExpandRequest request =\n", + " ExpandRequest.newBuilder().setContent(\"content951530617\").setInfo(\"info3237038\").build();\n", + " ServerStream stream = echoClient.expandCallable().call(request);\n", + " for (EchoResponse response : stream) {\n", + " // Do something when a response is received.\n", + " }\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -293,15 +354,32 @@ public void composeClassHeaderCredentialsSampleCode() { .setPakkage(SHOWCASE_PACKAGE_NAME) .build()); String results = - ServiceClientSampleCodeComposer.composeClassHeaderCredentialsSampleCode( - clientType, settingsType); + createExecutableSample( + ServiceClientSampleCodeComposer.composeClassHeaderCredentialsSampleCode( + clientType, settingsType)); String expected = LineFormatter.lines( - "EchoSettings echoSettings =\n", - " EchoSettings.newBuilder()\n", - " .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))\n", - " .build();\n", - "EchoClient echoClient = EchoClient.create(echoSettings);"); + "package com.google.example;\n", + "\n", + "import com.google.api.gax.core.FixedCredentialsProvider;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoSettings;\n", + "import com.google.showcase.v1beta1.myCredentials;\n", + "\n", + "public class EchoClientSetCredentialsProvider {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientSetCredentialsProvider();\n", + " }\n", + "\n", + " public static void echoClientSetCredentialsProvider() throws Exception {\n", + " EchoSettings echoSettings =\n", + " EchoSettings.newBuilder()\n", + " .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))\n", + " .build();\n", + " EchoClient echoClient = EchoClient.create(echoSettings);\n", + " }\n", + "}\n"); assertEquals(expected, results); } @@ -320,13 +398,28 @@ public void composeClassHeaderEndpointSampleCode() { .setPakkage(SHOWCASE_PACKAGE_NAME) .build()); String results = - ServiceClientSampleCodeComposer.composeClassHeaderEndpointSampleCode( - clientType, settingsType); + createExecutableSample( + ServiceClientSampleCodeComposer.composeClassHeaderEndpointSampleCode( + clientType, settingsType)); String expected = LineFormatter.lines( - "EchoSettings echoSettings =" - + " EchoSettings.newBuilder().setEndpoint(myEndpoint).build();\n", - "EchoClient echoClient = EchoClient.create(echoSettings);"); + "package com.google.example;\n", + "\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoSettings;\n", + "import com.google.showcase.v1beta1.myEndpoint;\n", + "\n", + "public class EchoClientSetEndpoint {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientSetEndpoint();\n", + " }\n", + "\n", + " public static void echoClientSetEndpoint() throws Exception {\n", + " EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();\n", + " EchoClient echoClient = EchoClient.create(echoSettings);\n", + " }\n", + "}\n"); assertEquals(expected, results); } @@ -951,7 +1044,7 @@ public void validComposeRpcMethodHeaderSampleCode_pureUnaryRpcWithMethodReturnVo " String name = \"name3373707\";\n", " echoClient.delete(name);\n", "}"); - assertEquals(results, expected); + assertEquals(expected, results); } */ @@ -1036,19 +1129,35 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithMultipleMethodArgu messageTypes.put("com.google.showcase.v1beta1.ListContentResponse", listContentResponseMessage); String results = - ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( - method, clientType, arguments, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( + method, clientType, arguments, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " List resourceName = new ArrayList<>();\n", - " String filter = \"filter-1274492040\";\n", - " for (Content element : echoClient.listContent(resourceName, filter).iterateAll())" - + " {\n", - " // doThingsWith(element);\n", + "package com.google.example;\n", + "\n", + "import com.google.showcase.v1beta1.Content;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import java.util.ArrayList;\n", + "import java.util.List;\n", + "\n", + "public class EchoClientListContent {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientListContent();\n", " }\n", - "}"); - assertEquals(results, expected); + "\n", + " public static void echoClientListContent() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " List resourceName = new ArrayList<>();\n", + " String filter = \"filter-1274492040\";\n", + " for (Content element : echoClient.listContent(resourceName, filter).iterateAll()) {\n", + " // doThingsWith(element);\n", + " }\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -1109,16 +1218,31 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithNoMethodArguments( messageTypes.put("com.google.showcase.v1beta1.ListContentResponse", listContentResponseMessage); String results = - ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( - method, clientType, arguments, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( + method, clientType, arguments, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " for (Content element : echoClient.listContent().iterateAll()) {\n", - " // doThingsWith(element);\n", + "package com.google.example;\n", + "\n", + "import com.google.showcase.v1beta1.Content;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "\n", + "public class EchoClientListContent {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientListContent();\n", " }\n", - "}"); - assertEquals(results, expected); + "\n", + " public static void echoClientListContent() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " for (Content element : echoClient.listContent().iterateAll()) {\n", + " // doThingsWith(element);\n", + " }\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -1269,14 +1393,29 @@ public void validComposeRpcMethodHeaderSampleCode_lroUnaryRpcWithNoMethodArgumen .build(); String results = - ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( - method, clientType, Collections.emptyList(), resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( + method, clientType, Collections.emptyList(), resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " WaitResponse response = echoClient.waitAsync().get();\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.WaitResponse;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " WaitResponse response = echoClient.waitAsync().get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -1342,15 +1481,31 @@ public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnResponseType() .build(); String results = - ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( - method, clientType, arguments, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( + method, clientType, arguments, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " Duration ttl = Duration.newBuilder().build();\n", - " WaitResponse response = echoClient.waitAsync(ttl).get();\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.protobuf.Duration;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.WaitResponse;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " Duration ttl = Duration.newBuilder().build();\n", + " WaitResponse response = echoClient.waitAsync(ttl).get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -1413,15 +1568,31 @@ public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnVoid() { .build(); String results = - ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( - method, clientType, arguments, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( + method, clientType, arguments, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " Duration ttl = Duration.newBuilder().build();\n", - " echoClient.waitAsync(ttl).get();\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.protobuf.Duration;\n", + "import com.google.protobuf.Empty;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " Duration ttl = Duration.newBuilder().build();\n", + " echoClient.waitAsync(ttl).get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } // ================================Unary RPC Default Method Sample Code ====================// @@ -1457,22 +1628,38 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_isPagedMethod() { .setPageSizeFieldName(PAGINATED_FIELD_NAME) .build(); String results = - ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " PagedExpandRequest request =\n", - " PagedExpandRequest.newBuilder()\n", - " .setContent(\"content951530617\")\n", - " .setPageSize(883849137)\n", - " .setPageToken(\"pageToken873572522\")\n", - " .build();\n", - " for (EchoResponse element : echoClient.pagedExpand(request).iterateAll()) {\n", - " // doThingsWith(element);\n", + "package com.google.example;\n", + "\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoResponse;\n", + "import com.google.showcase.v1beta1.PagedExpandRequest;\n", + "\n", + "public class EchoClientPagedExpand {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientPagedExpand();\n", " }\n", - "}"); - assertEquals(results, expected); + "\n", + " public static void echoClientPagedExpand() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " PagedExpandRequest request =\n", + " PagedExpandRequest.newBuilder()\n", + " .setContent(\"content951530617\")\n", + " .setPageSize(883849137)\n", + " .setPageToken(\"pageToken873572522\")\n", + " .build();\n", + " for (EchoResponse element : echoClient.pagedExpand(request).iterateAll()) {\n", + " // doThingsWith(element);\n", + " }\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -1556,15 +1743,31 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_hasLroMethodWithReturnR .setLro(lro) .build(); String results = - ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " WaitRequest request = WaitRequest.newBuilder().build();\n", - " echoClient.waitAsync(request).get();\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.protobuf.Empty;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.WaitRequest;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " WaitRequest request = WaitRequest.newBuilder().build();\n", + " echoClient.waitAsync(request).get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -1613,15 +1816,31 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_hasLroMethodWithReturnV .setLro(lro) .build(); String results = - ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " WaitRequest request = WaitRequest.newBuilder().build();\n", - " WaitResponse response = echoClient.waitAsync(request).get();\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.WaitRequest;\n", + "import com.google.showcase.v1beta1.WaitResponse;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " WaitRequest request = WaitRequest.newBuilder().build();\n", + " WaitResponse response = echoClient.waitAsync(request).get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -1652,23 +1871,40 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_pureUnaryReturnVoid() { .setMethodSignatures(Collections.emptyList()) .build(); String results = - ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " EchoRequest request =\n", - " EchoRequest.newBuilder()\n", - " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setSeverity(Severity.forNumber(0))\n", - " .setFoobar(Foobar.newBuilder().build())\n", - " .build();\n", - " echoClient.echo(request);\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.protobuf.Empty;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoRequest;\n", + "import com.google.showcase.v1beta1.Foobar;\n", + "import com.google.showcase.v1beta1.FoobarName;\n", + "import com.google.showcase.v1beta1.Severity;\n", + "\n", + "public class EchoClientEcho {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientEcho();\n", + " }\n", + "\n", + " public static void echoClientEcho() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " EchoRequest request =\n", + " EchoRequest.newBuilder()\n", + " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setSeverity(Severity.forNumber(0))\n", + " .setFoobar(Foobar.newBuilder().build())\n", + " .build();\n", + " echoClient.echo(request);\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -1702,23 +1938,40 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_pureUnaryReturnResponse .setMethodSignatures(Collections.emptyList()) .build(); String results = - ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " EchoRequest request =\n", - " EchoRequest.newBuilder()\n", - " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setSeverity(Severity.forNumber(0))\n", - " .setFoobar(Foobar.newBuilder().build())\n", - " .build();\n", - " EchoResponse response = echoClient.echo(request);\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoRequest;\n", + "import com.google.showcase.v1beta1.EchoResponse;\n", + "import com.google.showcase.v1beta1.Foobar;\n", + "import com.google.showcase.v1beta1.FoobarName;\n", + "import com.google.showcase.v1beta1.Severity;\n", + "\n", + "public class EchoClientEcho {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientEcho();\n", + " }\n", + "\n", + " public static void echoClientEcho() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " EchoRequest request =\n", + " EchoRequest.newBuilder()\n", + " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setSeverity(Severity.forNumber(0))\n", + " .setFoobar(Foobar.newBuilder().build())\n", + " .build();\n", + " EchoResponse response = echoClient.echo(request);\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } // ================================LRO Callable Method Sample Code ====================// @@ -1767,18 +2020,36 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnResponse() { .setLro(lro) .build(); String results = - ServiceClientSampleCodeComposer.composeLroCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeLroCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " WaitRequest request = WaitRequest.newBuilder().build();\n", - " OperationFuture future =\n", - " echoClient.waitOperationCallable().futureCall(request);\n", - " // Do something.\n", - " WaitResponse response = future.get();\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.api.gax.longrunning.OperationFuture;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.WaitMetadata;\n", + "import com.google.showcase.v1beta1.WaitRequest;\n", + "import com.google.showcase.v1beta1.WaitResponse;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " WaitRequest request = WaitRequest.newBuilder().build();\n", + " OperationFuture future =\n", + " echoClient.waitOperationCallable().futureCall(request);\n", + " // Do something.\n", + " WaitResponse response = future.get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -1823,18 +2094,36 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnVoid() { .setLro(lro) .build(); String results = - ServiceClientSampleCodeComposer.composeLroCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeLroCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " WaitRequest request = WaitRequest.newBuilder().build();\n", - " OperationFuture future =\n", - " echoClient.waitOperationCallable().futureCall(request);\n", - " // Do something.\n", - " future.get();\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.api.gax.longrunning.OperationFuture;\n", + "import com.google.protobuf.Empty;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.WaitMetadata;\n", + "import com.google.showcase.v1beta1.WaitRequest;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " WaitRequest request = WaitRequest.newBuilder().build();\n", + " OperationFuture future =\n", + " echoClient.waitOperationCallable().futureCall(request);\n", + " // Do something.\n", + " future.get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } // ================================Paged Callable Method Sample Code ====================// @@ -1869,25 +2158,41 @@ public void validComposePagedCallableMethodHeaderSampleCode() { .setPageSizeFieldName(PAGINATED_FIELD_NAME) .build(); String results = - ServiceClientSampleCodeComposer.composePagedCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composePagedCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " PagedExpandRequest request =\n", - " PagedExpandRequest.newBuilder()\n", - " .setContent(\"content951530617\")\n", - " .setPageSize(883849137)\n", - " .setPageToken(\"pageToken873572522\")\n", - " .build();\n", - " ApiFuture future =" - + " echoClient.pagedExpandPagedCallable().futureCall(request);\n", - " // Do something.\n", - " for (EchoResponse element : future.get().iterateAll()) {\n", - " // doThingsWith(element);\n", + "package com.google.example;\n", + "\n", + "import com.google.api.core.ApiFuture;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoResponse;\n", + "import com.google.showcase.v1beta1.PagedExpandRequest;\n", + "\n", + "public class EchoClientPagedExpand {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientPagedExpand();\n", " }\n", - "}"); - assertEquals(results, expected); + "\n", + " public static void echoClientPagedExpand() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " PagedExpandRequest request =\n", + " PagedExpandRequest.newBuilder()\n", + " .setContent(\"content951530617\")\n", + " .setPageSize(883849137)\n", + " .setPageToken(\"pageToken873572522\")\n", + " .build();\n", + " ApiFuture future = echoClient.pagedExpandPagedCallable().futureCall(request);\n", + " // Do something.\n", + " for (EchoResponse element : future.get().iterateAll()) {\n", + " // doThingsWith(element);\n", + " }\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -2047,20 +2352,36 @@ public void validComposeStreamCallableMethodHeaderSampleCode_serverStream() { .setStream(Stream.SERVER) .build(); String results = - ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " ExpandRequest request =\n", - " " - + " ExpandRequest.newBuilder().setContent(\"content951530617\").setInfo(\"info3237038\").build();\n", - " ServerStream stream = echoClient.expandCallable().call(request);\n", - " for (EchoResponse response : stream) {\n", - " // Do something when a response is received.\n", + "package com.google.example;\n", + "\n", + "import com.google.api.gax.rpc.ServerStream;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoResponse;\n", + "import com.google.showcase.v1beta1.ExpandRequest;\n", + "\n", + "public class EchoClientExpand {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientExpand();\n", " }\n", - "}"); - assertEquals(results, expected); + "\n", + " public static void echoClientExpand() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " ExpandRequest request =\n", + " ExpandRequest.newBuilder().setContent(\"content951530617\").setInfo(\"info3237038\").build();\n", + " ServerStream stream = echoClient.expandCallable().call(request);\n", + " for (EchoResponse response : stream) {\n", + " // Do something when a response is received.\n", + " }\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -2131,28 +2452,45 @@ public void validComposeStreamCallableMethodHeaderSampleCode_bidiStream() { .setStream(Stream.BIDI) .build(); String results = - ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " BidiStream bidiStream =" - + " echoClient.chatCallable().call();\n", - " EchoRequest request =\n", - " EchoRequest.newBuilder()\n", - " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setSeverity(Severity.forNumber(0))\n", - " .setFoobar(Foobar.newBuilder().build())\n", - " .build();\n", - " bidiStream.send(request);\n", - " for (EchoResponse response : bidiStream) {\n", - " // Do something when a response is received.\n", + "package com.google.example;\n", + "\n", + "import com.google.api.gax.rpc.BidiStream;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoRequest;\n", + "import com.google.showcase.v1beta1.EchoResponse;\n", + "import com.google.showcase.v1beta1.Foobar;\n", + "import com.google.showcase.v1beta1.FoobarName;\n", + "import com.google.showcase.v1beta1.Severity;\n", + "\n", + "public class EchoClientChat {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientChat();\n", " }\n", - "}"); - assertEquals(results, expected); + "\n", + " public static void echoClientChat() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " BidiStream bidiStream = echoClient.chatCallable().call();\n", + " EchoRequest request =\n", + " EchoRequest.newBuilder()\n", + " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setSeverity(Severity.forNumber(0))\n", + " .setFoobar(Foobar.newBuilder().build())\n", + " .build();\n", + " bidiStream.send(request);\n", + " for (EchoResponse response : bidiStream) {\n", + " // Do something when a response is received.\n", + " }\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -2223,42 +2561,60 @@ public void validComposeStreamCallableMethodHeaderSampleCode_clientStream() { .setStream(Stream.CLIENT) .build(); String results = - ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " ApiStreamObserver responseObserver =\n", - " new ApiStreamObserver() {\n", - " {@literal @}Override\n", - " public void onNext(EchoResponse response) {\n", - " // Do something when a response is received.\n", - " }\n", + "package com.google.example;\n", "\n", - " {@literal @}Override\n", - " public void onError(Throwable t) {\n", - " // Add error-handling\n", - " }\n", + "import com.google.api.gax.rpc.ApiStreamObserver;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoRequest;\n", + "import com.google.showcase.v1beta1.EchoResponse;\n", + "import com.google.showcase.v1beta1.Foobar;\n", + "import com.google.showcase.v1beta1.FoobarName;\n", + "import com.google.showcase.v1beta1.Severity;\n", "\n", - " {@literal @}Override\n", - " public void onCompleted() {\n", - " // Do something when complete.\n", - " }\n", - " };\n", - " ApiStreamObserver requestObserver =\n", - " echoClient.collect().clientStreamingCall(responseObserver);\n", - " EchoRequest request =\n", - " EchoRequest.newBuilder()\n", - " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setSeverity(Severity.forNumber(0))\n", - " .setFoobar(Foobar.newBuilder().build())\n", - " .build();\n", - " requestObserver.onNext(request);\n", - "}"); - assertEquals(results, expected); + "public class EchoClientCollect {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientCollect();\n", + " }\n", + "\n", + " public static void echoClientCollect() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " ApiStreamObserver responseObserver =\n", + " new ApiStreamObserver() {\n", + " {@literal @}Override\n", + " public void onNext(EchoResponse response) {\n", + " // Do something when a response is received.\n", + " }\n", + "\n", + " {@literal @}Override\n", + " public void onError(Throwable t) {\n", + " // Add error-handling\n", + " }\n", + "\n", + " {@literal @}Override\n", + " public void onCompleted() {\n", + " // Do something when complete.\n", + " }\n", + " };\n", + " ApiStreamObserver requestObserver =\n", + " echoClient.collect().clientStreamingCall(responseObserver);\n", + " EchoRequest request =\n", + " EchoRequest.newBuilder()\n", + " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setSeverity(Severity.forNumber(0))\n", + " .setFoobar(Foobar.newBuilder().build())\n", + " .build();\n", + " requestObserver.onNext(request);\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -2325,25 +2681,43 @@ public void validComposeRegularCallableMethodHeaderSampleCode_unaryRpc() { Method method = Method.builder().setName("Echo").setInputType(inputType).setOutputType(outputType).build(); String results = - ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " EchoRequest request =\n", - " EchoRequest.newBuilder()\n", - " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\"," - + " \"[FOOBAR]\").toString())\n", - " .setSeverity(Severity.forNumber(0))\n", - " .setFoobar(Foobar.newBuilder().build())\n", - " .build();\n", - " ApiFuture future = echoClient.echoCallable().futureCall(request);\n", - " // Do something.\n", - " EchoResponse response = future.get();\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.api.core.ApiFuture;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoRequest;\n", + "import com.google.showcase.v1beta1.EchoResponse;\n", + "import com.google.showcase.v1beta1.Foobar;\n", + "import com.google.showcase.v1beta1.FoobarName;\n", + "import com.google.showcase.v1beta1.Severity;\n", + "\n", + "public class EchoClientEcho {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientEcho();\n", + " }\n", + "\n", + " public static void echoClientEcho() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " EchoRequest request =\n", + " EchoRequest.newBuilder()\n", + " .setName(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())\n", + " .setSeverity(Severity.forNumber(0))\n", + " .setFoobar(Foobar.newBuilder().build())\n", + " .build();\n", + " ApiFuture future = echoClient.echoCallable().futureCall(request);\n", + " // Do something.\n", + " EchoResponse response = future.get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -2391,17 +2765,34 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpc() { .setLro(lro) .build(); String results = - ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " WaitRequest request = WaitRequest.newBuilder().build();\n", - " ApiFuture future = echoClient.waitCallable().futureCall(request);\n", - " // Do something.\n", - " Operation response = future.get();\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.api.core.ApiFuture;\n", + "import com.google.longrunning.Operation;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.WaitRequest;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " WaitRequest request = WaitRequest.newBuilder().build();\n", + " ApiFuture future = echoClient.waitCallable().futureCall(request);\n", + " // Do something.\n", + " Operation response = future.get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -2446,17 +2837,34 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpcWithReturnVo .setLro(lro) .build(); String results = - ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " WaitRequest request = WaitRequest.newBuilder().build();\n", - " ApiFuture future = echoClient.waitCallable().futureCall(request);\n", - " // Do something.\n", - " future.get();\n", - "}"); - assertEquals(results, expected); + "package com.google.example;\n", + "\n", + "import com.google.api.core.ApiFuture;\n", + "import com.google.longrunning.Operation;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.WaitRequest;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " WaitRequest request = WaitRequest.newBuilder().build();\n", + " ApiFuture future = echoClient.waitCallable().futureCall(request);\n", + " // Do something.\n", + " future.get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -2491,31 +2899,49 @@ public void validComposeRegularCallableMethodHeaderSampleCode_pageRpc() { .setPageSizeFieldName(PAGINATED_FIELD_NAME) .build(); String results = - ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "try (EchoClient echoClient = EchoClient.create()) {\n", - " PagedExpandRequest request =\n", - " PagedExpandRequest.newBuilder()\n", - " .setContent(\"content951530617\")\n", - " .setPageSize(883849137)\n", - " .setPageToken(\"pageToken873572522\")\n", - " .build();\n", - " while (true) {\n", - " PagedExpandResponse response = echoClient.pagedExpandCallable().call(request);\n", - " for (EchoResponse element : response.getResponsesList()) {\n", - " // doThingsWith(element);\n", - " }\n", - " String nextPageToken = response.getNextPageToken();\n", - " if (!Strings.isNullOrEmpty(nextPageToken)) {\n", - " request = request.toBuilder().setPageToken(nextPageToken).build();\n", - " } else {\n", - " break;\n", + "package com.google.example;\n", + "\n", + "import com.google.common.base.Strings;\n", + "import com.google.showcase.v1beta1.EchoClient;\n", + "import com.google.showcase.v1beta1.EchoResponse;\n", + "import com.google.showcase.v1beta1.PagedExpandRequest;\n", + "import com.google.showcase.v1beta1.PagedExpandResponse;\n", + "\n", + "public class EchoClientPagedExpand {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientPagedExpand();\n", + " }\n", + "\n", + " public static void echoClientPagedExpand() throws Exception {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " PagedExpandRequest request =\n", + " PagedExpandRequest.newBuilder()\n", + " .setContent(\"content951530617\")\n", + " .setPageSize(883849137)\n", + " .setPageToken(\"pageToken873572522\")\n", + " .build();\n", + " while (true) {\n", + " PagedExpandResponse response = echoClient.pagedExpandCallable().call(request);\n", + " for (EchoResponse element : response.getResponsesList()) {\n", + " // doThingsWith(element);\n", + " }\n", + " String nextPageToken = response.getNextPageToken();\n", + " if (!Strings.isNullOrEmpty(nextPageToken)) {\n", + " request = request.toBuilder().setPageToken(nextPageToken).build();\n", + " } else {\n", + " break;\n", + " }\n", + " }\n", " }\n", " }\n", - "}"); - assertEquals(results, expected); + "}\n"); + assertEquals(expected, results); } @Test diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java index a62d57275c..5fbfa4697d 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java @@ -32,7 +32,9 @@ public void composeSettingsSampleCode_noMethods() { .setPakkage("com.google.showcase.v1beta1") .build()); Optional results = - SettingsSampleCodeComposer.composeSampleCode(Optional.empty(), "EchoSettings", classType); + ExecutableSampleComposer.createExecutableSample( + SettingsSampleCodeComposer.composeSampleCode( + Optional.empty(), "EchoSettings", classType)); assertEquals(results, Optional.empty()); } @@ -45,22 +47,37 @@ public void composeSettingsSampleCode_serviceSettingsClass() { .setPakkage("com.google.showcase.v1beta1") .build()); Optional results = - SettingsSampleCodeComposer.composeSampleCode( - Optional.of("Echo"), "EchoSettings", classType); + ExecutableSampleComposer.createExecutableSample( + SettingsSampleCodeComposer.composeSampleCode( + Optional.of("Echo"), "EchoSettings", classType)); String expected = LineFormatter.lines( - "EchoSettings.Builder echoSettingsBuilder = EchoSettings.newBuilder();\n", - "echoSettingsBuilder\n", - " .echoSettings()\n", - " .setRetrySettings(\n", - " echoSettingsBuilder\n", - " .echoSettings()\n", - " .getRetrySettings()\n", - " .toBuilder()\n", - " .setTotalTimeout(Duration.ofSeconds(30))\n", - " .build());\n", - "EchoSettings echoSettings = echoSettingsBuilder.build();"); - assertEquals(results.get(), expected); + "package com.google.example;\n", + "\n", + "import com.google.showcase.v1beta1.EchoSettings;\n", + "import java.time.Duration;\n", + "\n", + "public class EchoSettings {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoSettings();\n", + " }\n", + "\n", + " public static void echoSettings() throws Exception {\n", + " EchoSettings.Builder echoSettingsBuilder = EchoSettings.newBuilder();\n", + " echoSettingsBuilder\n", + " .echoSettings()\n", + " .setRetrySettings(\n", + " echoSettingsBuilder\n", + " .echoSettings()\n", + " .getRetrySettings()\n", + " .toBuilder()\n", + " .setTotalTimeout(Duration.ofSeconds(30))\n", + " .build());\n", + " EchoSettings echoSettings = echoSettingsBuilder.build();\n", + " }\n", + "}\n"); + assertEquals(expected, results.get()); } @Test @@ -72,21 +89,36 @@ public void composeSettingsSampleCode_serviceStubClass() { .setPakkage("com.google.showcase.v1beta1") .build()); Optional results = - SettingsSampleCodeComposer.composeSampleCode( - Optional.of("Echo"), "EchoSettings", classType); + ExecutableSampleComposer.createExecutableSample( + SettingsSampleCodeComposer.composeSampleCode( + Optional.of("Echo"), "EchoSettings", classType)); String expected = LineFormatter.lines( - "EchoStubSettings.Builder echoSettingsBuilder = EchoStubSettings.newBuilder();\n", - "echoSettingsBuilder\n", - " .echoSettings()\n", - " .setRetrySettings(\n", - " echoSettingsBuilder\n", - " .echoSettings()\n", - " .getRetrySettings()\n", - " .toBuilder()\n", - " .setTotalTimeout(Duration.ofSeconds(30))\n", - " .build());\n", - "EchoStubSettings echoSettings = echoSettingsBuilder.build();"); - assertEquals(results.get(), expected); + "package com.google.example;\n", + "\n", + "import com.google.showcase.v1beta1.EchoStubSettings;\n", + "import java.time.Duration;\n", + "\n", + "public class EchoSettings {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoSettings();\n", + " }\n", + "\n", + " public static void echoSettings() throws Exception {\n", + " EchoStubSettings.Builder echoSettingsBuilder = EchoStubSettings.newBuilder();\n", + " echoSettingsBuilder\n", + " .echoSettings()\n", + " .setRetrySettings(\n", + " echoSettingsBuilder\n", + " .echoSettings()\n", + " .getRetrySettings()\n", + " .toBuilder()\n", + " .setTotalTimeout(Duration.ofSeconds(30))\n", + " .build());\n", + " EchoStubSettings echoSettings = echoSettingsBuilder.build();\n", + " }\n", + "}\n"); + assertEquals(expected, results.get()); } } diff --git a/test/integration/goldens/asset/com/google/cloud/asset/v1/AssetServiceClient.java b/test/integration/goldens/asset/com/google/cloud/asset/v1/AssetServiceClient.java index af1cc6dd1f..18b27a4782 100644 --- a/test/integration/goldens/asset/com/google/cloud/asset/v1/AssetServiceClient.java +++ b/test/integration/goldens/asset/com/google/cloud/asset/v1/AssetServiceClient.java @@ -47,16 +47,35 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
- *   BatchGetAssetsHistoryRequest request =
- *       BatchGetAssetsHistoryRequest.newBuilder()
- *           .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
- *           .addAllAssetNames(new ArrayList())
- *           .setContentType(ContentType.forNumber(0))
- *           .setReadTimeWindow(TimeWindow.newBuilder().build())
- *           .addAllRelationshipTypes(new ArrayList())
- *           .build();
- *   BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
+ * package com.google.example;
+ *
+ * import com.google.cloud.asset.v1.AssetServiceClient;
+ * import com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest;
+ * import com.google.cloud.asset.v1.BatchGetAssetsHistoryResponse;
+ * import com.google.cloud.asset.v1.ContentType;
+ * import com.google.cloud.asset.v1.FeedName;
+ * import com.google.cloud.asset.v1.TimeWindow;
+ * import java.util.ArrayList;
+ *
+ * public class AssetServiceClientBatchGetAssetsHistory {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     assetServiceClientBatchGetAssetsHistory();
+ *   }
+ *
+ *   public static void assetServiceClientBatchGetAssetsHistory() throws Exception {
+ *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+ *       BatchGetAssetsHistoryRequest request =
+ *           BatchGetAssetsHistoryRequest.newBuilder()
+ *               .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+ *               .addAllAssetNames(new ArrayList())
+ *               .setContentType(ContentType.forNumber(0))
+ *               .setReadTimeWindow(TimeWindow.newBuilder().build())
+ *               .addAllRelationshipTypes(new ArrayList())
+ *               .build();
+ *       BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
+ *     }
+ *   }
  * }
  * }
* @@ -89,19 +108,50 @@ *

To customize credentials: * *

{@code
- * AssetServiceSettings assetServiceSettings =
- *     AssetServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.asset.v1.AssetServiceClient;
+ * import com.google.cloud.asset.v1.AssetServiceSettings;
+ * import com.google.cloud.asset.v1.myCredentials;
+ *
+ * public class AssetServiceClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     assetServiceClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void assetServiceClientSetCredentialsProvider() throws Exception {
+ *     AssetServiceSettings assetServiceSettings =
+ *         AssetServiceSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * AssetServiceSettings assetServiceSettings =
- *     AssetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.asset.v1.AssetServiceClient;
+ * import com.google.cloud.asset.v1.AssetServiceSettings;
+ * import com.google.cloud.asset.v1.myEndpoint;
+ *
+ * public class AssetServiceClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     assetServiceClientSetEndpoint();
+ *   }
+ *
+ *   public static void assetServiceClientSetEndpoint() throws Exception {
+ *     AssetServiceSettings assetServiceSettings =
+ *         AssetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -183,17 +233,37 @@ public final OperationsClient getOperationsClient() { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   ExportAssetsRequest request =
-   *       ExportAssetsRequest.newBuilder()
-   *           .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .setReadTime(Timestamp.newBuilder().build())
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setContentType(ContentType.forNumber(0))
-   *           .setOutputConfig(OutputConfig.newBuilder().build())
-   *           .addAllRelationshipTypes(new ArrayList())
-   *           .build();
-   *   ExportAssetsResponse response = assetServiceClient.exportAssetsAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ContentType;
+   * import com.google.cloud.asset.v1.ExportAssetsRequest;
+   * import com.google.cloud.asset.v1.ExportAssetsResponse;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.cloud.asset.v1.OutputConfig;
+   * import com.google.protobuf.Timestamp;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientExportAssets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientExportAssets();
+   *   }
+   *
+   *   public static void assetServiceClientExportAssets() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       ExportAssetsRequest request =
+   *           ExportAssetsRequest.newBuilder()
+   *               .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .setReadTime(Timestamp.newBuilder().build())
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setContentType(ContentType.forNumber(0))
+   *               .setOutputConfig(OutputConfig.newBuilder().build())
+   *               .addAllRelationshipTypes(new ArrayList())
+   *               .build();
+   *       ExportAssetsResponse response = assetServiceClient.exportAssetsAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -219,20 +289,41 @@ public final OperationFuture exportAs *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   ExportAssetsRequest request =
-   *       ExportAssetsRequest.newBuilder()
-   *           .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .setReadTime(Timestamp.newBuilder().build())
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setContentType(ContentType.forNumber(0))
-   *           .setOutputConfig(OutputConfig.newBuilder().build())
-   *           .addAllRelationshipTypes(new ArrayList())
-   *           .build();
-   *   OperationFuture future =
-   *       assetServiceClient.exportAssetsOperationCallable().futureCall(request);
-   *   // Do something.
-   *   ExportAssetsResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ContentType;
+   * import com.google.cloud.asset.v1.ExportAssetsRequest;
+   * import com.google.cloud.asset.v1.ExportAssetsResponse;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.cloud.asset.v1.OutputConfig;
+   * import com.google.protobuf.Timestamp;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientExportAssets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientExportAssets();
+   *   }
+   *
+   *   public static void assetServiceClientExportAssets() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       ExportAssetsRequest request =
+   *           ExportAssetsRequest.newBuilder()
+   *               .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .setReadTime(Timestamp.newBuilder().build())
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setContentType(ContentType.forNumber(0))
+   *               .setOutputConfig(OutputConfig.newBuilder().build())
+   *               .addAllRelationshipTypes(new ArrayList())
+   *               .build();
+   *       OperationFuture future =
+   *           assetServiceClient.exportAssetsOperationCallable().futureCall(request);
+   *       // Do something.
+   *       ExportAssetsResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -255,19 +346,40 @@ public final OperationFuture exportAs *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   ExportAssetsRequest request =
-   *       ExportAssetsRequest.newBuilder()
-   *           .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .setReadTime(Timestamp.newBuilder().build())
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setContentType(ContentType.forNumber(0))
-   *           .setOutputConfig(OutputConfig.newBuilder().build())
-   *           .addAllRelationshipTypes(new ArrayList())
-   *           .build();
-   *   ApiFuture future = assetServiceClient.exportAssetsCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ContentType;
+   * import com.google.cloud.asset.v1.ExportAssetsRequest;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.cloud.asset.v1.OutputConfig;
+   * import com.google.longrunning.Operation;
+   * import com.google.protobuf.Timestamp;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientExportAssets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientExportAssets();
+   *   }
+   *
+   *   public static void assetServiceClientExportAssets() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       ExportAssetsRequest request =
+   *           ExportAssetsRequest.newBuilder()
+   *               .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .setReadTime(Timestamp.newBuilder().build())
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setContentType(ContentType.forNumber(0))
+   *               .setOutputConfig(OutputConfig.newBuilder().build())
+   *               .addAllRelationshipTypes(new ArrayList())
+   *               .build();
+   *       ApiFuture future = assetServiceClient.exportAssetsCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -282,10 +394,26 @@ public final UnaryCallable exportAssetsCallable( *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   ResourceName parent = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
-   *   for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.resourcenames.ResourceName;
+   * import com.google.cloud.asset.v1.Asset;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.FeedName;
+   *
+   * public class AssetServiceClientListAssets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientListAssets();
+   *   }
+   *
+   *   public static void assetServiceClientListAssets() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       ResourceName parent = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
+   *       for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -309,10 +437,25 @@ public final ListAssetsPagedResponse listAssets(ResourceName parent) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   String parent = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
-   *   for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.Asset;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.FeedName;
+   *
+   * public class AssetServiceClientListAssets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientListAssets();
+   *   }
+   *
+   *   public static void assetServiceClientListAssets() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       String parent = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
+   *       for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -335,19 +478,38 @@ public final ListAssetsPagedResponse listAssets(String parent) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   ListAssetsRequest request =
-   *       ListAssetsRequest.newBuilder()
-   *           .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .setReadTime(Timestamp.newBuilder().build())
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setContentType(ContentType.forNumber(0))
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .addAllRelationshipTypes(new ArrayList())
-   *           .build();
-   *   for (Asset element : assetServiceClient.listAssets(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.Asset;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ContentType;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.cloud.asset.v1.ListAssetsRequest;
+   * import com.google.protobuf.Timestamp;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientListAssets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientListAssets();
+   *   }
+   *
+   *   public static void assetServiceClientListAssets() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       ListAssetsRequest request =
+   *           ListAssetsRequest.newBuilder()
+   *               .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .setReadTime(Timestamp.newBuilder().build())
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setContentType(ContentType.forNumber(0))
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .addAllRelationshipTypes(new ArrayList())
+   *               .build();
+   *       for (Asset element : assetServiceClient.listAssets(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -366,21 +528,41 @@ public final ListAssetsPagedResponse listAssets(ListAssetsRequest request) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   ListAssetsRequest request =
-   *       ListAssetsRequest.newBuilder()
-   *           .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .setReadTime(Timestamp.newBuilder().build())
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setContentType(ContentType.forNumber(0))
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .addAllRelationshipTypes(new ArrayList())
-   *           .build();
-   *   ApiFuture future = assetServiceClient.listAssetsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Asset element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.Asset;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ContentType;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.cloud.asset.v1.ListAssetsRequest;
+   * import com.google.protobuf.Timestamp;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientListAssets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientListAssets();
+   *   }
+   *
+   *   public static void assetServiceClientListAssets() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       ListAssetsRequest request =
+   *           ListAssetsRequest.newBuilder()
+   *               .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .setReadTime(Timestamp.newBuilder().build())
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setContentType(ContentType.forNumber(0))
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .addAllRelationshipTypes(new ArrayList())
+   *               .build();
+   *       ApiFuture future = assetServiceClient.listAssetsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Asset element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -396,27 +578,48 @@ public final UnaryCallable listAsset *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   ListAssetsRequest request =
-   *       ListAssetsRequest.newBuilder()
-   *           .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .setReadTime(Timestamp.newBuilder().build())
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setContentType(ContentType.forNumber(0))
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .addAllRelationshipTypes(new ArrayList())
-   *           .build();
-   *   while (true) {
-   *     ListAssetsResponse response = assetServiceClient.listAssetsCallable().call(request);
-   *     for (Asset element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.Asset;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ContentType;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.cloud.asset.v1.ListAssetsRequest;
+   * import com.google.cloud.asset.v1.ListAssetsResponse;
+   * import com.google.common.base.Strings;
+   * import com.google.protobuf.Timestamp;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientListAssets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientListAssets();
+   *   }
+   *
+   *   public static void assetServiceClientListAssets() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       ListAssetsRequest request =
+   *           ListAssetsRequest.newBuilder()
+   *               .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .setReadTime(Timestamp.newBuilder().build())
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setContentType(ContentType.forNumber(0))
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .addAllRelationshipTypes(new ArrayList())
+   *               .build();
+   *       while (true) {
+   *         ListAssetsResponse response = assetServiceClient.listAssetsCallable().call(request);
+   *         for (Asset element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -437,16 +640,35 @@ public final UnaryCallable listAssetsCall
    * 

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   BatchGetAssetsHistoryRequest request =
-   *       BatchGetAssetsHistoryRequest.newBuilder()
-   *           .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .addAllAssetNames(new ArrayList())
-   *           .setContentType(ContentType.forNumber(0))
-   *           .setReadTimeWindow(TimeWindow.newBuilder().build())
-   *           .addAllRelationshipTypes(new ArrayList())
-   *           .build();
-   *   BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest;
+   * import com.google.cloud.asset.v1.BatchGetAssetsHistoryResponse;
+   * import com.google.cloud.asset.v1.ContentType;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.cloud.asset.v1.TimeWindow;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientBatchGetAssetsHistory {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientBatchGetAssetsHistory();
+   *   }
+   *
+   *   public static void assetServiceClientBatchGetAssetsHistory() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       BatchGetAssetsHistoryRequest request =
+   *           BatchGetAssetsHistoryRequest.newBuilder()
+   *               .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .addAllAssetNames(new ArrayList())
+   *               .setContentType(ContentType.forNumber(0))
+   *               .setReadTimeWindow(TimeWindow.newBuilder().build())
+   *               .addAllRelationshipTypes(new ArrayList())
+   *               .build();
+   *       BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
+   *     }
+   *   }
    * }
    * }
* @@ -469,19 +691,39 @@ public final BatchGetAssetsHistoryResponse batchGetAssetsHistory( *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   BatchGetAssetsHistoryRequest request =
-   *       BatchGetAssetsHistoryRequest.newBuilder()
-   *           .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .addAllAssetNames(new ArrayList())
-   *           .setContentType(ContentType.forNumber(0))
-   *           .setReadTimeWindow(TimeWindow.newBuilder().build())
-   *           .addAllRelationshipTypes(new ArrayList())
-   *           .build();
-   *   ApiFuture future =
-   *       assetServiceClient.batchGetAssetsHistoryCallable().futureCall(request);
-   *   // Do something.
-   *   BatchGetAssetsHistoryResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest;
+   * import com.google.cloud.asset.v1.BatchGetAssetsHistoryResponse;
+   * import com.google.cloud.asset.v1.ContentType;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.cloud.asset.v1.TimeWindow;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientBatchGetAssetsHistory {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientBatchGetAssetsHistory();
+   *   }
+   *
+   *   public static void assetServiceClientBatchGetAssetsHistory() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       BatchGetAssetsHistoryRequest request =
+   *           BatchGetAssetsHistoryRequest.newBuilder()
+   *               .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .addAllAssetNames(new ArrayList())
+   *               .setContentType(ContentType.forNumber(0))
+   *               .setReadTimeWindow(TimeWindow.newBuilder().build())
+   *               .addAllRelationshipTypes(new ArrayList())
+   *               .build();
+   *       ApiFuture future =
+   *           assetServiceClient.batchGetAssetsHistoryCallable().futureCall(request);
+   *       // Do something.
+   *       BatchGetAssetsHistoryResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -497,9 +739,23 @@ public final BatchGetAssetsHistoryResponse batchGetAssetsHistory( *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   String parent = "parent-995424086";
-   *   Feed response = assetServiceClient.createFeed(parent);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.Feed;
+   *
+   * public class AssetServiceClientCreateFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientCreateFeed();
+   *   }
+   *
+   *   public static void assetServiceClientCreateFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       String parent = "parent-995424086";
+   *       Feed response = assetServiceClient.createFeed(parent);
+   *     }
+   *   }
    * }
    * }
* @@ -521,14 +777,29 @@ public final Feed createFeed(String parent) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   CreateFeedRequest request =
-   *       CreateFeedRequest.newBuilder()
-   *           .setParent("parent-995424086")
-   *           .setFeedId("feedId-1278410919")
-   *           .setFeed(Feed.newBuilder().build())
-   *           .build();
-   *   Feed response = assetServiceClient.createFeed(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.CreateFeedRequest;
+   * import com.google.cloud.asset.v1.Feed;
+   *
+   * public class AssetServiceClientCreateFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientCreateFeed();
+   *   }
+   *
+   *   public static void assetServiceClientCreateFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       CreateFeedRequest request =
+   *           CreateFeedRequest.newBuilder()
+   *               .setParent("parent-995424086")
+   *               .setFeedId("feedId-1278410919")
+   *               .setFeed(Feed.newBuilder().build())
+   *               .build();
+   *       Feed response = assetServiceClient.createFeed(request);
+   *     }
+   *   }
    * }
    * }
* @@ -546,16 +817,32 @@ public final Feed createFeed(CreateFeedRequest request) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   CreateFeedRequest request =
-   *       CreateFeedRequest.newBuilder()
-   *           .setParent("parent-995424086")
-   *           .setFeedId("feedId-1278410919")
-   *           .setFeed(Feed.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = assetServiceClient.createFeedCallable().futureCall(request);
-   *   // Do something.
-   *   Feed response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.CreateFeedRequest;
+   * import com.google.cloud.asset.v1.Feed;
+   *
+   * public class AssetServiceClientCreateFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientCreateFeed();
+   *   }
+   *
+   *   public static void assetServiceClientCreateFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       CreateFeedRequest request =
+   *           CreateFeedRequest.newBuilder()
+   *               .setParent("parent-995424086")
+   *               .setFeedId("feedId-1278410919")
+   *               .setFeed(Feed.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = assetServiceClient.createFeedCallable().futureCall(request);
+   *       // Do something.
+   *       Feed response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -570,9 +857,24 @@ public final UnaryCallable createFeedCallable() { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
-   *   Feed response = assetServiceClient.getFeed(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.Feed;
+   * import com.google.cloud.asset.v1.FeedName;
+   *
+   * public class AssetServiceClientGetFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientGetFeed();
+   *   }
+   *
+   *   public static void assetServiceClientGetFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
+   *       Feed response = assetServiceClient.getFeed(name);
+   *     }
+   *   }
    * }
    * }
* @@ -594,9 +896,24 @@ public final Feed getFeed(FeedName name) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
-   *   Feed response = assetServiceClient.getFeed(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.Feed;
+   * import com.google.cloud.asset.v1.FeedName;
+   *
+   * public class AssetServiceClientGetFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientGetFeed();
+   *   }
+   *
+   *   public static void assetServiceClientGetFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
+   *       Feed response = assetServiceClient.getFeed(name);
+   *     }
+   *   }
    * }
    * }
* @@ -617,12 +934,28 @@ public final Feed getFeed(String name) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   GetFeedRequest request =
-   *       GetFeedRequest.newBuilder()
-   *           .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .build();
-   *   Feed response = assetServiceClient.getFeed(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.Feed;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.cloud.asset.v1.GetFeedRequest;
+   *
+   * public class AssetServiceClientGetFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientGetFeed();
+   *   }
+   *
+   *   public static void assetServiceClientGetFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       GetFeedRequest request =
+   *           GetFeedRequest.newBuilder()
+   *               .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .build();
+   *       Feed response = assetServiceClient.getFeed(request);
+   *     }
+   *   }
    * }
    * }
* @@ -640,14 +973,31 @@ public final Feed getFeed(GetFeedRequest request) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   GetFeedRequest request =
-   *       GetFeedRequest.newBuilder()
-   *           .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .build();
-   *   ApiFuture future = assetServiceClient.getFeedCallable().futureCall(request);
-   *   // Do something.
-   *   Feed response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.Feed;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.cloud.asset.v1.GetFeedRequest;
+   *
+   * public class AssetServiceClientGetFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientGetFeed();
+   *   }
+   *
+   *   public static void assetServiceClientGetFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       GetFeedRequest request =
+   *           GetFeedRequest.newBuilder()
+   *               .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .build();
+   *       ApiFuture future = assetServiceClient.getFeedCallable().futureCall(request);
+   *       // Do something.
+   *       Feed response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -662,9 +1012,23 @@ public final UnaryCallable getFeedCallable() { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   String parent = "parent-995424086";
-   *   ListFeedsResponse response = assetServiceClient.listFeeds(parent);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ListFeedsResponse;
+   *
+   * public class AssetServiceClientListFeeds {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientListFeeds();
+   *   }
+   *
+   *   public static void assetServiceClientListFeeds() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       String parent = "parent-995424086";
+   *       ListFeedsResponse response = assetServiceClient.listFeeds(parent);
+   *     }
+   *   }
    * }
    * }
* @@ -685,10 +1049,25 @@ public final ListFeedsResponse listFeeds(String parent) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   ListFeedsRequest request =
-   *       ListFeedsRequest.newBuilder().setParent("parent-995424086").build();
-   *   ListFeedsResponse response = assetServiceClient.listFeeds(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ListFeedsRequest;
+   * import com.google.cloud.asset.v1.ListFeedsResponse;
+   *
+   * public class AssetServiceClientListFeeds {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientListFeeds();
+   *   }
+   *
+   *   public static void assetServiceClientListFeeds() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       ListFeedsRequest request =
+   *           ListFeedsRequest.newBuilder().setParent("parent-995424086").build();
+   *       ListFeedsResponse response = assetServiceClient.listFeeds(request);
+   *     }
+   *   }
    * }
    * }
* @@ -706,13 +1085,29 @@ public final ListFeedsResponse listFeeds(ListFeedsRequest request) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   ListFeedsRequest request =
-   *       ListFeedsRequest.newBuilder().setParent("parent-995424086").build();
-   *   ApiFuture future =
-   *       assetServiceClient.listFeedsCallable().futureCall(request);
-   *   // Do something.
-   *   ListFeedsResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ListFeedsRequest;
+   * import com.google.cloud.asset.v1.ListFeedsResponse;
+   *
+   * public class AssetServiceClientListFeeds {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientListFeeds();
+   *   }
+   *
+   *   public static void assetServiceClientListFeeds() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       ListFeedsRequest request =
+   *           ListFeedsRequest.newBuilder().setParent("parent-995424086").build();
+   *       ApiFuture future =
+   *           assetServiceClient.listFeedsCallable().futureCall(request);
+   *       // Do something.
+   *       ListFeedsResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -727,9 +1122,23 @@ public final UnaryCallable listFeedsCallabl *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   Feed feed = Feed.newBuilder().build();
-   *   Feed response = assetServiceClient.updateFeed(feed);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.Feed;
+   *
+   * public class AssetServiceClientUpdateFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientUpdateFeed();
+   *   }
+   *
+   *   public static void assetServiceClientUpdateFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       Feed feed = Feed.newBuilder().build();
+   *       Feed response = assetServiceClient.updateFeed(feed);
+   *     }
+   *   }
    * }
    * }
* @@ -750,13 +1159,29 @@ public final Feed updateFeed(Feed feed) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   UpdateFeedRequest request =
-   *       UpdateFeedRequest.newBuilder()
-   *           .setFeed(Feed.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   Feed response = assetServiceClient.updateFeed(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.Feed;
+   * import com.google.cloud.asset.v1.UpdateFeedRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class AssetServiceClientUpdateFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientUpdateFeed();
+   *   }
+   *
+   *   public static void assetServiceClientUpdateFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       UpdateFeedRequest request =
+   *           UpdateFeedRequest.newBuilder()
+   *               .setFeed(Feed.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       Feed response = assetServiceClient.updateFeed(request);
+   *     }
+   *   }
    * }
    * }
* @@ -774,15 +1199,32 @@ public final Feed updateFeed(UpdateFeedRequest request) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   UpdateFeedRequest request =
-   *       UpdateFeedRequest.newBuilder()
-   *           .setFeed(Feed.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = assetServiceClient.updateFeedCallable().futureCall(request);
-   *   // Do something.
-   *   Feed response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.Feed;
+   * import com.google.cloud.asset.v1.UpdateFeedRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class AssetServiceClientUpdateFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientUpdateFeed();
+   *   }
+   *
+   *   public static void assetServiceClientUpdateFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       UpdateFeedRequest request =
+   *           UpdateFeedRequest.newBuilder()
+   *               .setFeed(Feed.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = assetServiceClient.updateFeedCallable().futureCall(request);
+   *       // Do something.
+   *       Feed response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -797,9 +1239,24 @@ public final UnaryCallable updateFeedCallable() { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
-   *   assetServiceClient.deleteFeed(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class AssetServiceClientDeleteFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientDeleteFeed();
+   *   }
+   *
+   *   public static void assetServiceClientDeleteFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
+   *       assetServiceClient.deleteFeed(name);
+   *     }
+   *   }
    * }
    * }
* @@ -821,9 +1278,24 @@ public final void deleteFeed(FeedName name) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
-   *   assetServiceClient.deleteFeed(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class AssetServiceClientDeleteFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientDeleteFeed();
+   *   }
+   *
+   *   public static void assetServiceClientDeleteFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
+   *       assetServiceClient.deleteFeed(name);
+   *     }
+   *   }
    * }
    * }
* @@ -844,12 +1316,28 @@ public final void deleteFeed(String name) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   DeleteFeedRequest request =
-   *       DeleteFeedRequest.newBuilder()
-   *           .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .build();
-   *   assetServiceClient.deleteFeed(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.DeleteFeedRequest;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class AssetServiceClientDeleteFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientDeleteFeed();
+   *   }
+   *
+   *   public static void assetServiceClientDeleteFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       DeleteFeedRequest request =
+   *           DeleteFeedRequest.newBuilder()
+   *               .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .build();
+   *       assetServiceClient.deleteFeed(request);
+   *     }
+   *   }
    * }
    * }
* @@ -867,14 +1355,31 @@ public final void deleteFeed(DeleteFeedRequest request) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   DeleteFeedRequest request =
-   *       DeleteFeedRequest.newBuilder()
-   *           .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
-   *           .build();
-   *   ApiFuture future = assetServiceClient.deleteFeedCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.DeleteFeedRequest;
+   * import com.google.cloud.asset.v1.FeedName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class AssetServiceClientDeleteFeed {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientDeleteFeed();
+   *   }
+   *
+   *   public static void assetServiceClientDeleteFeed() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       DeleteFeedRequest request =
+   *           DeleteFeedRequest.newBuilder()
+   *               .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+   *               .build();
+   *       ApiFuture future = assetServiceClient.deleteFeedCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -891,13 +1396,29 @@ public final UnaryCallable deleteFeedCallable() { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   String scope = "scope109264468";
-   *   String query = "query107944136";
-   *   List assetTypes = new ArrayList<>();
-   *   for (ResourceSearchResult element :
-   *       assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ResourceSearchResult;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class AssetServiceClientSearchAllResources {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientSearchAllResources();
+   *   }
+   *
+   *   public static void assetServiceClientSearchAllResources() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       String scope = "scope109264468";
+   *       String query = "query107944136";
+   *       List assetTypes = new ArrayList<>();
+   *       for (ResourceSearchResult element :
+   *           assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -985,20 +1506,37 @@ public final SearchAllResourcesPagedResponse searchAllResources( *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   SearchAllResourcesRequest request =
-   *       SearchAllResourcesRequest.newBuilder()
-   *           .setScope("scope109264468")
-   *           .setQuery("query107944136")
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setReadMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   for (ResourceSearchResult element :
-   *       assetServiceClient.searchAllResources(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ResourceSearchResult;
+   * import com.google.cloud.asset.v1.SearchAllResourcesRequest;
+   * import com.google.protobuf.FieldMask;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientSearchAllResources {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientSearchAllResources();
+   *   }
+   *
+   *   public static void assetServiceClientSearchAllResources() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       SearchAllResourcesRequest request =
+   *           SearchAllResourcesRequest.newBuilder()
+   *               .setScope("scope109264468")
+   *               .setQuery("query107944136")
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .setReadMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       for (ResourceSearchResult element :
+   *           assetServiceClient.searchAllResources(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1020,22 +1558,40 @@ public final SearchAllResourcesPagedResponse searchAllResources( *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   SearchAllResourcesRequest request =
-   *       SearchAllResourcesRequest.newBuilder()
-   *           .setScope("scope109264468")
-   *           .setQuery("query107944136")
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setReadMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       assetServiceClient.searchAllResourcesPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (ResourceSearchResult element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ResourceSearchResult;
+   * import com.google.cloud.asset.v1.SearchAllResourcesRequest;
+   * import com.google.protobuf.FieldMask;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientSearchAllResources {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientSearchAllResources();
+   *   }
+   *
+   *   public static void assetServiceClientSearchAllResources() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       SearchAllResourcesRequest request =
+   *           SearchAllResourcesRequest.newBuilder()
+   *               .setScope("scope109264468")
+   *               .setQuery("query107944136")
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .setReadMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           assetServiceClient.searchAllResourcesPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (ResourceSearchResult element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1054,28 +1610,47 @@ public final SearchAllResourcesPagedResponse searchAllResources( *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   SearchAllResourcesRequest request =
-   *       SearchAllResourcesRequest.newBuilder()
-   *           .setScope("scope109264468")
-   *           .setQuery("query107944136")
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setReadMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   while (true) {
-   *     SearchAllResourcesResponse response =
-   *         assetServiceClient.searchAllResourcesCallable().call(request);
-   *     for (ResourceSearchResult element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ResourceSearchResult;
+   * import com.google.cloud.asset.v1.SearchAllResourcesRequest;
+   * import com.google.cloud.asset.v1.SearchAllResourcesResponse;
+   * import com.google.common.base.Strings;
+   * import com.google.protobuf.FieldMask;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientSearchAllResources {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientSearchAllResources();
+   *   }
+   *
+   *   public static void assetServiceClientSearchAllResources() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       SearchAllResourcesRequest request =
+   *           SearchAllResourcesRequest.newBuilder()
+   *               .setScope("scope109264468")
+   *               .setQuery("query107944136")
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .setReadMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       while (true) {
+   *         SearchAllResourcesResponse response =
+   *             assetServiceClient.searchAllResourcesCallable().call(request);
+   *         for (ResourceSearchResult element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -1095,12 +1670,26 @@ public final SearchAllResourcesPagedResponse searchAllResources(
    * 

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   String scope = "scope109264468";
-   *   String query = "query107944136";
-   *   for (IamPolicySearchResult element :
-   *       assetServiceClient.searchAllIamPolicies(scope, query).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.IamPolicySearchResult;
+   *
+   * public class AssetServiceClientSearchAllIamPolicies {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientSearchAllIamPolicies();
+   *   }
+   *
+   *   public static void assetServiceClientSearchAllIamPolicies() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       String scope = "scope109264468";
+   *       String query = "query107944136";
+   *       for (IamPolicySearchResult element :
+   *           assetServiceClient.searchAllIamPolicies(scope, query).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1171,19 +1760,35 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(String scope *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   SearchAllIamPoliciesRequest request =
-   *       SearchAllIamPoliciesRequest.newBuilder()
-   *           .setScope("scope109264468")
-   *           .setQuery("query107944136")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   for (IamPolicySearchResult element :
-   *       assetServiceClient.searchAllIamPolicies(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.IamPolicySearchResult;
+   * import com.google.cloud.asset.v1.SearchAllIamPoliciesRequest;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientSearchAllIamPolicies {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientSearchAllIamPolicies();
+   *   }
+   *
+   *   public static void assetServiceClientSearchAllIamPolicies() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       SearchAllIamPoliciesRequest request =
+   *           SearchAllIamPoliciesRequest.newBuilder()
+   *               .setScope("scope109264468")
+   *               .setQuery("query107944136")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       for (IamPolicySearchResult element :
+   *           assetServiceClient.searchAllIamPolicies(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1205,21 +1810,38 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies( *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   SearchAllIamPoliciesRequest request =
-   *       SearchAllIamPoliciesRequest.newBuilder()
-   *           .setScope("scope109264468")
-   *           .setQuery("query107944136")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   ApiFuture future =
-   *       assetServiceClient.searchAllIamPoliciesPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (IamPolicySearchResult element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.IamPolicySearchResult;
+   * import com.google.cloud.asset.v1.SearchAllIamPoliciesRequest;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientSearchAllIamPolicies {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientSearchAllIamPolicies();
+   *   }
+   *
+   *   public static void assetServiceClientSearchAllIamPolicies() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       SearchAllIamPoliciesRequest request =
+   *           SearchAllIamPoliciesRequest.newBuilder()
+   *               .setScope("scope109264468")
+   *               .setQuery("query107944136")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       ApiFuture future =
+   *           assetServiceClient.searchAllIamPoliciesPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (IamPolicySearchResult element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1238,27 +1860,45 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies( *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   SearchAllIamPoliciesRequest request =
-   *       SearchAllIamPoliciesRequest.newBuilder()
-   *           .setScope("scope109264468")
-   *           .setQuery("query107944136")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .addAllAssetTypes(new ArrayList())
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   while (true) {
-   *     SearchAllIamPoliciesResponse response =
-   *         assetServiceClient.searchAllIamPoliciesCallable().call(request);
-   *     for (IamPolicySearchResult element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.IamPolicySearchResult;
+   * import com.google.cloud.asset.v1.SearchAllIamPoliciesRequest;
+   * import com.google.cloud.asset.v1.SearchAllIamPoliciesResponse;
+   * import com.google.common.base.Strings;
+   * import java.util.ArrayList;
+   *
+   * public class AssetServiceClientSearchAllIamPolicies {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientSearchAllIamPolicies();
+   *   }
+   *
+   *   public static void assetServiceClientSearchAllIamPolicies() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       SearchAllIamPoliciesRequest request =
+   *           SearchAllIamPoliciesRequest.newBuilder()
+   *               .setScope("scope109264468")
+   *               .setQuery("query107944136")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .addAllAssetTypes(new ArrayList())
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       while (true) {
+   *         SearchAllIamPoliciesResponse response =
+   *             assetServiceClient.searchAllIamPoliciesCallable().call(request);
+   *         for (IamPolicySearchResult element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -1276,13 +1916,30 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
    * 

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   AnalyzeIamPolicyRequest request =
-   *       AnalyzeIamPolicyRequest.newBuilder()
-   *           .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
-   *           .setExecutionTimeout(Duration.newBuilder().build())
-   *           .build();
-   *   AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AnalyzeIamPolicyRequest;
+   * import com.google.cloud.asset.v1.AnalyzeIamPolicyResponse;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.IamPolicyAnalysisQuery;
+   * import com.google.protobuf.Duration;
+   *
+   * public class AssetServiceClientAnalyzeIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientAnalyzeIamPolicy();
+   *   }
+   *
+   *   public static void assetServiceClientAnalyzeIamPolicy() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       AnalyzeIamPolicyRequest request =
+   *           AnalyzeIamPolicyRequest.newBuilder()
+   *               .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
+   *               .setExecutionTimeout(Duration.newBuilder().build())
+   *               .build();
+   *       AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1300,16 +1957,34 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   AnalyzeIamPolicyRequest request =
-   *       AnalyzeIamPolicyRequest.newBuilder()
-   *           .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
-   *           .setExecutionTimeout(Duration.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       assetServiceClient.analyzeIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   AnalyzeIamPolicyResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AnalyzeIamPolicyRequest;
+   * import com.google.cloud.asset.v1.AnalyzeIamPolicyResponse;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.IamPolicyAnalysisQuery;
+   * import com.google.protobuf.Duration;
+   *
+   * public class AssetServiceClientAnalyzeIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientAnalyzeIamPolicy();
+   *   }
+   *
+   *   public static void assetServiceClientAnalyzeIamPolicy() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       AnalyzeIamPolicyRequest request =
+   *           AnalyzeIamPolicyRequest.newBuilder()
+   *               .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
+   *               .setExecutionTimeout(Duration.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           assetServiceClient.analyzeIamPolicyCallable().futureCall(request);
+   *       // Do something.
+   *       AnalyzeIamPolicyResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1332,14 +2007,31 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   AnalyzeIamPolicyLongrunningRequest request =
-   *       AnalyzeIamPolicyLongrunningRequest.newBuilder()
-   *           .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
-   *           .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
-   *           .build();
-   *   AnalyzeIamPolicyLongrunningResponse response =
-   *       assetServiceClient.analyzeIamPolicyLongrunningAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningRequest;
+   * import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.IamPolicyAnalysisOutputConfig;
+   * import com.google.cloud.asset.v1.IamPolicyAnalysisQuery;
+   *
+   * public class AssetServiceClientAnalyzeIamPolicyLongrunning {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientAnalyzeIamPolicyLongrunning();
+   *   }
+   *
+   *   public static void assetServiceClientAnalyzeIamPolicyLongrunning() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       AnalyzeIamPolicyLongrunningRequest request =
+   *           AnalyzeIamPolicyLongrunningRequest.newBuilder()
+   *               .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
+   *               .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
+   *               .build();
+   *       AnalyzeIamPolicyLongrunningResponse response =
+   *           assetServiceClient.analyzeIamPolicyLongrunningAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1366,17 +2058,36 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   AnalyzeIamPolicyLongrunningRequest request =
-   *       AnalyzeIamPolicyLongrunningRequest.newBuilder()
-   *           .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
-   *           .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
-   *           .build();
-   *   OperationFuture
-   *       future =
-   *           assetServiceClient.analyzeIamPolicyLongrunningOperationCallable().futureCall(request);
-   *   // Do something.
-   *   AnalyzeIamPolicyLongrunningResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata;
+   * import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningRequest;
+   * import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.IamPolicyAnalysisOutputConfig;
+   * import com.google.cloud.asset.v1.IamPolicyAnalysisQuery;
+   *
+   * public class AssetServiceClientAnalyzeIamPolicyLongrunning {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientAnalyzeIamPolicyLongrunning();
+   *   }
+   *
+   *   public static void assetServiceClientAnalyzeIamPolicyLongrunning() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       AnalyzeIamPolicyLongrunningRequest request =
+   *           AnalyzeIamPolicyLongrunningRequest.newBuilder()
+   *               .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
+   *               .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
+   *               .build();
+   *       OperationFuture
+   *           future =
+   *               assetServiceClient.analyzeIamPolicyLongrunningOperationCallable().futureCall(request);
+   *       // Do something.
+   *       AnalyzeIamPolicyLongrunningResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1402,16 +2113,34 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   AnalyzeIamPolicyLongrunningRequest request =
-   *       AnalyzeIamPolicyLongrunningRequest.newBuilder()
-   *           .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
-   *           .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       assetServiceClient.analyzeIamPolicyLongrunningCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningRequest;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.IamPolicyAnalysisOutputConfig;
+   * import com.google.cloud.asset.v1.IamPolicyAnalysisQuery;
+   * import com.google.longrunning.Operation;
+   *
+   * public class AssetServiceClientAnalyzeIamPolicyLongrunning {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientAnalyzeIamPolicyLongrunning();
+   *   }
+   *
+   *   public static void assetServiceClientAnalyzeIamPolicyLongrunning() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       AnalyzeIamPolicyLongrunningRequest request =
+   *           AnalyzeIamPolicyLongrunningRequest.newBuilder()
+   *               .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
+   *               .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           assetServiceClient.analyzeIamPolicyLongrunningCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1430,13 +2159,28 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   AnalyzeMoveRequest request =
-   *       AnalyzeMoveRequest.newBuilder()
-   *           .setResource("resource-341064690")
-   *           .setDestinationParent("destinationParent-1733659048")
-   *           .build();
-   *   AnalyzeMoveResponse response = assetServiceClient.analyzeMove(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AnalyzeMoveRequest;
+   * import com.google.cloud.asset.v1.AnalyzeMoveResponse;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   *
+   * public class AssetServiceClientAnalyzeMove {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientAnalyzeMove();
+   *   }
+   *
+   *   public static void assetServiceClientAnalyzeMove() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       AnalyzeMoveRequest request =
+   *           AnalyzeMoveRequest.newBuilder()
+   *               .setResource("resource-341064690")
+   *               .setDestinationParent("destinationParent-1733659048")
+   *               .build();
+   *       AnalyzeMoveResponse response = assetServiceClient.analyzeMove(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1457,16 +2201,32 @@ public final AnalyzeMoveResponse analyzeMove(AnalyzeMoveRequest request) { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   AnalyzeMoveRequest request =
-   *       AnalyzeMoveRequest.newBuilder()
-   *           .setResource("resource-341064690")
-   *           .setDestinationParent("destinationParent-1733659048")
-   *           .build();
-   *   ApiFuture future =
-   *       assetServiceClient.analyzeMoveCallable().futureCall(request);
-   *   // Do something.
-   *   AnalyzeMoveResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.asset.v1.AnalyzeMoveRequest;
+   * import com.google.cloud.asset.v1.AnalyzeMoveResponse;
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   *
+   * public class AssetServiceClientAnalyzeMove {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     assetServiceClientAnalyzeMove();
+   *   }
+   *
+   *   public static void assetServiceClientAnalyzeMove() throws Exception {
+   *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *       AnalyzeMoveRequest request =
+   *           AnalyzeMoveRequest.newBuilder()
+   *               .setResource("resource-341064690")
+   *               .setDestinationParent("destinationParent-1733659048")
+   *               .build();
+   *       ApiFuture future =
+   *           assetServiceClient.analyzeMoveCallable().futureCall(request);
+   *       // Do something.
+   *       AnalyzeMoveResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/asset/com/google/cloud/asset/v1/AssetServiceSettings.java b/test/integration/goldens/asset/com/google/cloud/asset/v1/AssetServiceSettings.java index 8bca7d5631..119f193bd1 100644 --- a/test/integration/goldens/asset/com/google/cloud/asset/v1/AssetServiceSettings.java +++ b/test/integration/goldens/asset/com/google/cloud/asset/v1/AssetServiceSettings.java @@ -58,17 +58,31 @@ *

For example, to set the total timeout of batchGetAssetsHistory to 30 seconds: * *

{@code
- * AssetServiceSettings.Builder assetServiceSettingsBuilder = AssetServiceSettings.newBuilder();
- * assetServiceSettingsBuilder
- *     .batchGetAssetsHistorySettings()
- *     .setRetrySettings(
- *         assetServiceSettingsBuilder
- *             .batchGetAssetsHistorySettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * AssetServiceSettings assetServiceSettings = assetServiceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.asset.v1.AssetServiceSettings;
+ * import java.time.Duration;
+ *
+ * public class AssetServiceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     assetServiceSettings();
+ *   }
+ *
+ *   public static void assetServiceSettings() throws Exception {
+ *     AssetServiceSettings.Builder assetServiceSettingsBuilder = AssetServiceSettings.newBuilder();
+ *     assetServiceSettingsBuilder
+ *         .batchGetAssetsHistorySettings()
+ *         .setRetrySettings(
+ *             assetServiceSettingsBuilder
+ *                 .batchGetAssetsHistorySettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     AssetServiceSettings assetServiceSettings = assetServiceSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/asset/com/google/cloud/asset/v1/package-info.java b/test/integration/goldens/asset/com/google/cloud/asset/v1/package-info.java index d07bbc1fb7..84a37185cd 100644 --- a/test/integration/goldens/asset/com/google/cloud/asset/v1/package-info.java +++ b/test/integration/goldens/asset/com/google/cloud/asset/v1/package-info.java @@ -24,16 +24,35 @@ *

Sample for AssetServiceClient: * *

{@code
- * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
- *   BatchGetAssetsHistoryRequest request =
- *       BatchGetAssetsHistoryRequest.newBuilder()
- *           .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
- *           .addAllAssetNames(new ArrayList())
- *           .setContentType(ContentType.forNumber(0))
- *           .setReadTimeWindow(TimeWindow.newBuilder().build())
- *           .addAllRelationshipTypes(new ArrayList())
- *           .build();
- *   BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
+ * package com.google.example;
+ *
+ * import com.google.cloud.asset.v1.AssetServiceClient;
+ * import com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest;
+ * import com.google.cloud.asset.v1.BatchGetAssetsHistoryResponse;
+ * import com.google.cloud.asset.v1.ContentType;
+ * import com.google.cloud.asset.v1.FeedName;
+ * import com.google.cloud.asset.v1.TimeWindow;
+ * import java.util.ArrayList;
+ *
+ * public class AssetServiceClientBatchGetAssetsHistory {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     assetServiceClientBatchGetAssetsHistory();
+ *   }
+ *
+ *   public static void assetServiceClientBatchGetAssetsHistory() throws Exception {
+ *     try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+ *       BatchGetAssetsHistoryRequest request =
+ *           BatchGetAssetsHistoryRequest.newBuilder()
+ *               .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
+ *               .addAllAssetNames(new ArrayList())
+ *               .setContentType(ContentType.forNumber(0))
+ *               .setReadTimeWindow(TimeWindow.newBuilder().build())
+ *               .addAllRelationshipTypes(new ArrayList())
+ *               .build();
+ *       BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
+ *     }
+ *   }
  * }
  * }
*/ diff --git a/test/integration/goldens/asset/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java b/test/integration/goldens/asset/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java index 30012d98c6..9a9e779a2e 100644 --- a/test/integration/goldens/asset/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java +++ b/test/integration/goldens/asset/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java @@ -102,18 +102,32 @@ *

For example, to set the total timeout of batchGetAssetsHistory to 30 seconds: * *

{@code
- * AssetServiceStubSettings.Builder assetServiceSettingsBuilder =
- *     AssetServiceStubSettings.newBuilder();
- * assetServiceSettingsBuilder
- *     .batchGetAssetsHistorySettings()
- *     .setRetrySettings(
- *         assetServiceSettingsBuilder
- *             .batchGetAssetsHistorySettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * AssetServiceStubSettings assetServiceSettings = assetServiceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.asset.v1.stub.AssetServiceStubSettings;
+ * import java.time.Duration;
+ *
+ * public class AssetServiceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     assetServiceSettings();
+ *   }
+ *
+ *   public static void assetServiceSettings() throws Exception {
+ *     AssetServiceStubSettings.Builder assetServiceSettingsBuilder =
+ *         AssetServiceStubSettings.newBuilder();
+ *     assetServiceSettingsBuilder
+ *         .batchGetAssetsHistorySettings()
+ *         .setRetrySettings(
+ *             assetServiceSettingsBuilder
+ *                 .batchGetAssetsHistorySettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     AssetServiceStubSettings assetServiceSettings = assetServiceSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1/AddressesClient.java b/test/integration/goldens/compute/com/google/cloud/compute/v1/AddressesClient.java index f9039b41df..85322cde4d 100644 --- a/test/integration/goldens/compute/com/google/cloud/compute/v1/AddressesClient.java +++ b/test/integration/goldens/compute/com/google/cloud/compute/v1/AddressesClient.java @@ -46,11 +46,26 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (AddressesClient addressesClient = AddressesClient.create()) {
- *   String project = "project-309310695";
- *   for (Map.Entry element :
- *       addressesClient.aggregatedList(project).iterateAll()) {
- *     // doThingsWith(element);
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.AddressesClient;
+ * import com.google.cloud.compute.v1.AddressesScopedList;
+ * import java.util.Map;
+ *
+ * public class AddressesClientAggregatedList {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     addressesClientAggregatedList();
+ *   }
+ *
+ *   public static void addressesClientAggregatedList() throws Exception {
+ *     try (AddressesClient addressesClient = AddressesClient.create()) {
+ *       String project = "project-309310695";
+ *       for (Map.Entry element :
+ *           addressesClient.aggregatedList(project).iterateAll()) {
+ *         // doThingsWith(element);
+ *       }
+ *     }
  *   }
  * }
  * }
@@ -84,19 +99,50 @@ *

To customize credentials: * *

{@code
- * AddressesSettings addressesSettings =
- *     AddressesSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * AddressesClient addressesClient = AddressesClient.create(addressesSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.compute.v1.AddressesClient;
+ * import com.google.cloud.compute.v1.AddressesSettings;
+ * import com.google.cloud.compute.v1.myCredentials;
+ *
+ * public class AddressesClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     addressesClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void addressesClientSetCredentialsProvider() throws Exception {
+ *     AddressesSettings addressesSettings =
+ *         AddressesSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     AddressesClient addressesClient = AddressesClient.create(addressesSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * AddressesSettings addressesSettings =
- *     AddressesSettings.newBuilder().setEndpoint(myEndpoint).build();
- * AddressesClient addressesClient = AddressesClient.create(addressesSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.AddressesClient;
+ * import com.google.cloud.compute.v1.AddressesSettings;
+ * import com.google.cloud.compute.v1.myEndpoint;
+ *
+ * public class AddressesClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     addressesClientSetEndpoint();
+ *   }
+ *
+ *   public static void addressesClientSetEndpoint() throws Exception {
+ *     AddressesSettings addressesSettings =
+ *         AddressesSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     AddressesClient addressesClient = AddressesClient.create(addressesSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -159,11 +205,26 @@ public AddressesStub getStub() { *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   String project = "project-309310695";
-   *   for (Map.Entry element :
-   *       addressesClient.aggregatedList(project).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.AddressesScopedList;
+   * import java.util.Map;
+   *
+   * public class AddressesClientAggregatedList {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientAggregatedList();
+   *   }
+   *
+   *   public static void addressesClientAggregatedList() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       String project = "project-309310695";
+   *       for (Map.Entry element :
+   *           addressesClient.aggregatedList(project).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -184,19 +245,35 @@ public final AggregatedListPagedResponse aggregatedList(String project) { *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   AggregatedListAddressesRequest request =
-   *       AggregatedListAddressesRequest.newBuilder()
-   *           .setFilter("filter-1274492040")
-   *           .setIncludeAllScopes(true)
-   *           .setMaxResults(1128457243)
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setPageToken("pageToken873572522")
-   *           .setProject("project-309310695")
-   *           .build();
-   *   for (Map.Entry element :
-   *       addressesClient.aggregatedList(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.AddressesScopedList;
+   * import com.google.cloud.compute.v1.AggregatedListAddressesRequest;
+   * import java.util.Map;
+   *
+   * public class AddressesClientAggregatedList {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientAggregatedList();
+   *   }
+   *
+   *   public static void addressesClientAggregatedList() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       AggregatedListAddressesRequest request =
+   *           AggregatedListAddressesRequest.newBuilder()
+   *               .setFilter("filter-1274492040")
+   *               .setIncludeAllScopes(true)
+   *               .setMaxResults(1128457243)
+   *               .setOrderBy("orderBy-1207110587")
+   *               .setPageToken("pageToken873572522")
+   *               .setProject("project-309310695")
+   *               .build();
+   *       for (Map.Entry element :
+   *           addressesClient.aggregatedList(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -215,21 +292,38 @@ public final AggregatedListPagedResponse aggregatedList(AggregatedListAddressesR *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   AggregatedListAddressesRequest request =
-   *       AggregatedListAddressesRequest.newBuilder()
-   *           .setFilter("filter-1274492040")
-   *           .setIncludeAllScopes(true)
-   *           .setMaxResults(1128457243)
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setPageToken("pageToken873572522")
-   *           .setProject("project-309310695")
-   *           .build();
-   *   ApiFuture> future =
-   *       addressesClient.aggregatedListPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Map.Entry element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.AddressesScopedList;
+   * import com.google.cloud.compute.v1.AggregatedListAddressesRequest;
+   * import java.util.Map;
+   *
+   * public class AddressesClientAggregatedList {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientAggregatedList();
+   *   }
+   *
+   *   public static void addressesClientAggregatedList() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       AggregatedListAddressesRequest request =
+   *           AggregatedListAddressesRequest.newBuilder()
+   *               .setFilter("filter-1274492040")
+   *               .setIncludeAllScopes(true)
+   *               .setMaxResults(1128457243)
+   *               .setOrderBy("orderBy-1207110587")
+   *               .setPageToken("pageToken873572522")
+   *               .setProject("project-309310695")
+   *               .build();
+   *       ApiFuture> future =
+   *           addressesClient.aggregatedListPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Map.Entry element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -246,26 +340,44 @@ public final AggregatedListPagedResponse aggregatedList(AggregatedListAddressesR *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   AggregatedListAddressesRequest request =
-   *       AggregatedListAddressesRequest.newBuilder()
-   *           .setFilter("filter-1274492040")
-   *           .setIncludeAllScopes(true)
-   *           .setMaxResults(1128457243)
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setPageToken("pageToken873572522")
-   *           .setProject("project-309310695")
-   *           .build();
-   *   while (true) {
-   *     AddressAggregatedList response = addressesClient.aggregatedListCallable().call(request);
-   *     for (Map.Entry element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.AddressAggregatedList;
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.AddressesScopedList;
+   * import com.google.cloud.compute.v1.AggregatedListAddressesRequest;
+   * import com.google.common.base.Strings;
+   * import java.util.Map;
+   *
+   * public class AddressesClientAggregatedList {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientAggregatedList();
+   *   }
+   *
+   *   public static void addressesClientAggregatedList() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       AggregatedListAddressesRequest request =
+   *           AggregatedListAddressesRequest.newBuilder()
+   *               .setFilter("filter-1274492040")
+   *               .setIncludeAllScopes(true)
+   *               .setMaxResults(1128457243)
+   *               .setOrderBy("orderBy-1207110587")
+   *               .setPageToken("pageToken873572522")
+   *               .setProject("project-309310695")
+   *               .build();
+   *       while (true) {
+   *         AddressAggregatedList response = addressesClient.aggregatedListCallable().call(request);
+   *         for (Map.Entry element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -283,11 +395,25 @@ public final AggregatedListPagedResponse aggregatedList(AggregatedListAddressesR
    * 

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   String project = "project-309310695";
-   *   String region = "region-934795532";
-   *   String address = "address-1147692044";
-   *   Operation response = addressesClient.deleteAsync(project, region, address).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.Operation;
+   *
+   * public class AddressesClientDelete {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientDelete();
+   *   }
+   *
+   *   public static void addressesClientDelete() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       String project = "project-309310695";
+   *       String region = "region-934795532";
+   *       String address = "address-1147692044";
+   *       Operation response = addressesClient.deleteAsync(project, region, address).get();
+   *     }
+   *   }
    * }
    * }
* @@ -314,15 +440,30 @@ public final OperationFuture deleteAsync( *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   DeleteAddressRequest request =
-   *       DeleteAddressRequest.newBuilder()
-   *           .setAddress("address-1147692044")
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .setRequestId("requestId693933066")
-   *           .build();
-   *   Operation response = addressesClient.deleteAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.DeleteAddressRequest;
+   * import com.google.cloud.compute.v1.Operation;
+   *
+   * public class AddressesClientDelete {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientDelete();
+   *   }
+   *
+   *   public static void addressesClientDelete() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       DeleteAddressRequest request =
+   *           DeleteAddressRequest.newBuilder()
+   *               .setAddress("address-1147692044")
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .setRequestId("requestId693933066")
+   *               .build();
+   *       Operation response = addressesClient.deleteAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -342,18 +483,34 @@ public final OperationFuture deleteAsync(DeleteAddressRequ *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   DeleteAddressRequest request =
-   *       DeleteAddressRequest.newBuilder()
-   *           .setAddress("address-1147692044")
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .setRequestId("requestId693933066")
-   *           .build();
-   *   OperationFuture future =
-   *       addressesClient.deleteOperationCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.DeleteAddressRequest;
+   * import com.google.cloud.compute.v1.Operation;
+   *
+   * public class AddressesClientDelete {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientDelete();
+   *   }
+   *
+   *   public static void addressesClientDelete() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       DeleteAddressRequest request =
+   *           DeleteAddressRequest.newBuilder()
+   *               .setAddress("address-1147692044")
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .setRequestId("requestId693933066")
+   *               .build();
+   *       OperationFuture future =
+   *           addressesClient.deleteOperationCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -369,17 +526,33 @@ public final OperationFuture deleteAsync(DeleteAddressRequ *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   DeleteAddressRequest request =
-   *       DeleteAddressRequest.newBuilder()
-   *           .setAddress("address-1147692044")
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .setRequestId("requestId693933066")
-   *           .build();
-   *   ApiFuture future = addressesClient.deleteCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.DeleteAddressRequest;
+   * import com.google.longrunning.Operation;
+   *
+   * public class AddressesClientDelete {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientDelete();
+   *   }
+   *
+   *   public static void addressesClientDelete() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       DeleteAddressRequest request =
+   *           DeleteAddressRequest.newBuilder()
+   *               .setAddress("address-1147692044")
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .setRequestId("requestId693933066")
+   *               .build();
+   *       ApiFuture future = addressesClient.deleteCallable().futureCall(request);
+   *       // Do something.
+   *       com.google.cloud.compute.v1.Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -394,11 +567,26 @@ public final UnaryCallable deleteCallable() { *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   String project = "project-309310695";
-   *   String region = "region-934795532";
-   *   Address addressResource = Address.newBuilder().build();
-   *   Operation response = addressesClient.insertAsync(project, region, addressResource).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.Address;
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.Operation;
+   *
+   * public class AddressesClientInsert {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientInsert();
+   *   }
+   *
+   *   public static void addressesClientInsert() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       String project = "project-309310695";
+   *       String region = "region-934795532";
+   *       Address addressResource = Address.newBuilder().build();
+   *       Operation response = addressesClient.insertAsync(project, region, addressResource).get();
+   *     }
+   *   }
    * }
    * }
* @@ -425,15 +613,31 @@ public final OperationFuture insertAsync( *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   InsertAddressRequest request =
-   *       InsertAddressRequest.newBuilder()
-   *           .setAddressResource(Address.newBuilder().build())
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .setRequestId("requestId693933066")
-   *           .build();
-   *   Operation response = addressesClient.insertAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.Address;
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.InsertAddressRequest;
+   * import com.google.cloud.compute.v1.Operation;
+   *
+   * public class AddressesClientInsert {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientInsert();
+   *   }
+   *
+   *   public static void addressesClientInsert() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       InsertAddressRequest request =
+   *           InsertAddressRequest.newBuilder()
+   *               .setAddressResource(Address.newBuilder().build())
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .setRequestId("requestId693933066")
+   *               .build();
+   *       Operation response = addressesClient.insertAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -453,18 +657,35 @@ public final OperationFuture insertAsync(InsertAddressRequ *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   InsertAddressRequest request =
-   *       InsertAddressRequest.newBuilder()
-   *           .setAddressResource(Address.newBuilder().build())
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .setRequestId("requestId693933066")
-   *           .build();
-   *   OperationFuture future =
-   *       addressesClient.insertOperationCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.cloud.compute.v1.Address;
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.InsertAddressRequest;
+   * import com.google.cloud.compute.v1.Operation;
+   *
+   * public class AddressesClientInsert {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientInsert();
+   *   }
+   *
+   *   public static void addressesClientInsert() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       InsertAddressRequest request =
+   *           InsertAddressRequest.newBuilder()
+   *               .setAddressResource(Address.newBuilder().build())
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .setRequestId("requestId693933066")
+   *               .build();
+   *       OperationFuture future =
+   *           addressesClient.insertOperationCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -480,17 +701,34 @@ public final OperationFuture insertAsync(InsertAddressRequ *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   InsertAddressRequest request =
-   *       InsertAddressRequest.newBuilder()
-   *           .setAddressResource(Address.newBuilder().build())
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .setRequestId("requestId693933066")
-   *           .build();
-   *   ApiFuture future = addressesClient.insertCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.compute.v1.Address;
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.InsertAddressRequest;
+   * import com.google.longrunning.Operation;
+   *
+   * public class AddressesClientInsert {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientInsert();
+   *   }
+   *
+   *   public static void addressesClientInsert() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       InsertAddressRequest request =
+   *           InsertAddressRequest.newBuilder()
+   *               .setAddressResource(Address.newBuilder().build())
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .setRequestId("requestId693933066")
+   *               .build();
+   *       ApiFuture future = addressesClient.insertCallable().futureCall(request);
+   *       // Do something.
+   *       com.google.cloud.compute.v1.Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -505,12 +743,26 @@ public final UnaryCallable insertCallable() { *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   String project = "project-309310695";
-   *   String region = "region-934795532";
-   *   String orderBy = "orderBy-1207110587";
-   *   for (Address element : addressesClient.list(project, region, orderBy).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.Address;
+   * import com.google.cloud.compute.v1.AddressesClient;
+   *
+   * public class AddressesClientList {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientList();
+   *   }
+   *
+   *   public static void addressesClientList() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       String project = "project-309310695";
+   *       String region = "region-934795532";
+   *       String orderBy = "orderBy-1207110587";
+   *       for (Address element : addressesClient.list(project, region, orderBy).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -543,18 +795,33 @@ public final ListPagedResponse list(String project, String region, String orderB *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   ListAddressesRequest request =
-   *       ListAddressesRequest.newBuilder()
-   *           .setFilter("filter-1274492040")
-   *           .setMaxResults(1128457243)
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setPageToken("pageToken873572522")
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .build();
-   *   for (Address element : addressesClient.list(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.Address;
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.ListAddressesRequest;
+   *
+   * public class AddressesClientList {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientList();
+   *   }
+   *
+   *   public static void addressesClientList() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       ListAddressesRequest request =
+   *           ListAddressesRequest.newBuilder()
+   *               .setFilter("filter-1274492040")
+   *               .setMaxResults(1128457243)
+   *               .setOrderBy("orderBy-1207110587")
+   *               .setPageToken("pageToken873572522")
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .build();
+   *       for (Address element : addressesClient.list(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -573,20 +840,36 @@ public final ListPagedResponse list(ListAddressesRequest request) { *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   ListAddressesRequest request =
-   *       ListAddressesRequest.newBuilder()
-   *           .setFilter("filter-1274492040")
-   *           .setMaxResults(1128457243)
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setPageToken("pageToken873572522")
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .build();
-   *   ApiFuture
future = addressesClient.listPagedCallable().futureCall(request); - * // Do something. - * for (Address element : future.get().iterateAll()) { - * // doThingsWith(element); + * package com.google.example; + * + * import com.google.api.core.ApiFuture; + * import com.google.cloud.compute.v1.Address; + * import com.google.cloud.compute.v1.AddressesClient; + * import com.google.cloud.compute.v1.ListAddressesRequest; + * + * public class AddressesClientList { + * + * public static void main(String[] args) throws Exception { + * addressesClientList(); + * } + * + * public static void addressesClientList() throws Exception { + * try (AddressesClient addressesClient = AddressesClient.create()) { + * ListAddressesRequest request = + * ListAddressesRequest.newBuilder() + * .setFilter("filter-1274492040") + * .setMaxResults(1128457243) + * .setOrderBy("orderBy-1207110587") + * .setPageToken("pageToken873572522") + * .setProject("project-309310695") + * .setRegion("region-934795532") + * .build(); + * ApiFuture
future = addressesClient.listPagedCallable().futureCall(request); + * // Do something. + * for (Address element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } * } * } * }
@@ -602,26 +885,43 @@ public final UnaryCallable listPagedCal *

Sample code: * *

{@code
-   * try (AddressesClient addressesClient = AddressesClient.create()) {
-   *   ListAddressesRequest request =
-   *       ListAddressesRequest.newBuilder()
-   *           .setFilter("filter-1274492040")
-   *           .setMaxResults(1128457243)
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setPageToken("pageToken873572522")
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .build();
-   *   while (true) {
-   *     AddressList response = addressesClient.listCallable().call(request);
-   *     for (Address element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.Address;
+   * import com.google.cloud.compute.v1.AddressList;
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.ListAddressesRequest;
+   * import com.google.common.base.Strings;
+   *
+   * public class AddressesClientList {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     addressesClientList();
+   *   }
+   *
+   *   public static void addressesClientList() throws Exception {
+   *     try (AddressesClient addressesClient = AddressesClient.create()) {
+   *       ListAddressesRequest request =
+   *           ListAddressesRequest.newBuilder()
+   *               .setFilter("filter-1274492040")
+   *               .setMaxResults(1128457243)
+   *               .setOrderBy("orderBy-1207110587")
+   *               .setPageToken("pageToken873572522")
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .build();
+   *       while (true) {
+   *         AddressList response = addressesClient.listCallable().call(request);
+   *         for (Address element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1/AddressesSettings.java b/test/integration/goldens/compute/com/google/cloud/compute/v1/AddressesSettings.java
index 58fbc804d6..94140f5431 100644
--- a/test/integration/goldens/compute/com/google/cloud/compute/v1/AddressesSettings.java
+++ b/test/integration/goldens/compute/com/google/cloud/compute/v1/AddressesSettings.java
@@ -55,17 +55,31 @@
  * 

For example, to set the total timeout of aggregatedList to 30 seconds: * *

{@code
- * AddressesSettings.Builder addressesSettingsBuilder = AddressesSettings.newBuilder();
- * addressesSettingsBuilder
- *     .aggregatedListSettings()
- *     .setRetrySettings(
- *         addressesSettingsBuilder
- *             .aggregatedListSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * AddressesSettings addressesSettings = addressesSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.AddressesSettings;
+ * import java.time.Duration;
+ *
+ * public class AddressesSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     addressesSettings();
+ *   }
+ *
+ *   public static void addressesSettings() throws Exception {
+ *     AddressesSettings.Builder addressesSettingsBuilder = AddressesSettings.newBuilder();
+ *     addressesSettingsBuilder
+ *         .aggregatedListSettings()
+ *         .setRetrySettings(
+ *             addressesSettingsBuilder
+ *                 .aggregatedListSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     AddressesSettings addressesSettings = addressesSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1/RegionOperationsClient.java b/test/integration/goldens/compute/com/google/cloud/compute/v1/RegionOperationsClient.java index 09fb0b090a..9dffb8504b 100644 --- a/test/integration/goldens/compute/com/google/cloud/compute/v1/RegionOperationsClient.java +++ b/test/integration/goldens/compute/com/google/cloud/compute/v1/RegionOperationsClient.java @@ -33,11 +33,25 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
- *   String project = "project-309310695";
- *   String region = "region-934795532";
- *   String operation = "operation1662702951";
- *   Operation response = regionOperationsClient.get(project, region, operation);
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.Operation;
+ * import com.google.cloud.compute.v1.RegionOperationsClient;
+ *
+ * public class RegionOperationsClientGet {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     regionOperationsClientGet();
+ *   }
+ *
+ *   public static void regionOperationsClientGet() throws Exception {
+ *     try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+ *       String project = "project-309310695";
+ *       String region = "region-934795532";
+ *       String operation = "operation1662702951";
+ *       Operation response = regionOperationsClient.get(project, region, operation);
+ *     }
+ *   }
  * }
  * }
* @@ -71,21 +85,52 @@ *

To customize credentials: * *

{@code
- * RegionOperationsSettings regionOperationsSettings =
- *     RegionOperationsSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * RegionOperationsClient regionOperationsClient =
- *     RegionOperationsClient.create(regionOperationsSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.compute.v1.RegionOperationsClient;
+ * import com.google.cloud.compute.v1.RegionOperationsSettings;
+ * import com.google.cloud.compute.v1.myCredentials;
+ *
+ * public class RegionOperationsClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     regionOperationsClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void regionOperationsClientSetCredentialsProvider() throws Exception {
+ *     RegionOperationsSettings regionOperationsSettings =
+ *         RegionOperationsSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     RegionOperationsClient regionOperationsClient =
+ *         RegionOperationsClient.create(regionOperationsSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * RegionOperationsSettings regionOperationsSettings =
- *     RegionOperationsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * RegionOperationsClient regionOperationsClient =
- *     RegionOperationsClient.create(regionOperationsSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.RegionOperationsClient;
+ * import com.google.cloud.compute.v1.RegionOperationsSettings;
+ * import com.google.cloud.compute.v1.myEndpoint;
+ *
+ * public class RegionOperationsClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     regionOperationsClientSetEndpoint();
+ *   }
+ *
+ *   public static void regionOperationsClientSetEndpoint() throws Exception {
+ *     RegionOperationsSettings regionOperationsSettings =
+ *         RegionOperationsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     RegionOperationsClient regionOperationsClient =
+ *         RegionOperationsClient.create(regionOperationsSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -150,11 +195,25 @@ public RegionOperationsStub getStub() { *

Sample code: * *

{@code
-   * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
-   *   String project = "project-309310695";
-   *   String region = "region-934795532";
-   *   String operation = "operation1662702951";
-   *   Operation response = regionOperationsClient.get(project, region, operation);
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.Operation;
+   * import com.google.cloud.compute.v1.RegionOperationsClient;
+   *
+   * public class RegionOperationsClientGet {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     regionOperationsClientGet();
+   *   }
+   *
+   *   public static void regionOperationsClientGet() throws Exception {
+   *     try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+   *       String project = "project-309310695";
+   *       String region = "region-934795532";
+   *       String operation = "operation1662702951";
+   *       Operation response = regionOperationsClient.get(project, region, operation);
+   *     }
+   *   }
    * }
    * }
* @@ -180,14 +239,29 @@ public final Operation get(String project, String region, String operation) { *

Sample code: * *

{@code
-   * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
-   *   GetRegionOperationRequest request =
-   *       GetRegionOperationRequest.newBuilder()
-   *           .setOperation("operation1662702951")
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .build();
-   *   Operation response = regionOperationsClient.get(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.GetRegionOperationRequest;
+   * import com.google.cloud.compute.v1.Operation;
+   * import com.google.cloud.compute.v1.RegionOperationsClient;
+   *
+   * public class RegionOperationsClientGet {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     regionOperationsClientGet();
+   *   }
+   *
+   *   public static void regionOperationsClientGet() throws Exception {
+   *     try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+   *       GetRegionOperationRequest request =
+   *           GetRegionOperationRequest.newBuilder()
+   *               .setOperation("operation1662702951")
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .build();
+   *       Operation response = regionOperationsClient.get(request);
+   *     }
+   *   }
    * }
    * }
* @@ -205,16 +279,32 @@ public final Operation get(GetRegionOperationRequest request) { *

Sample code: * *

{@code
-   * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
-   *   GetRegionOperationRequest request =
-   *       GetRegionOperationRequest.newBuilder()
-   *           .setOperation("operation1662702951")
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .build();
-   *   ApiFuture future = regionOperationsClient.getCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.compute.v1.GetRegionOperationRequest;
+   * import com.google.cloud.compute.v1.Operation;
+   * import com.google.cloud.compute.v1.RegionOperationsClient;
+   *
+   * public class RegionOperationsClientGet {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     regionOperationsClientGet();
+   *   }
+   *
+   *   public static void regionOperationsClientGet() throws Exception {
+   *     try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+   *       GetRegionOperationRequest request =
+   *           GetRegionOperationRequest.newBuilder()
+   *               .setOperation("operation1662702951")
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .build();
+   *       ApiFuture future = regionOperationsClient.getCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -238,11 +328,25 @@ public final UnaryCallable getCallable() { *

Sample code: * *

{@code
-   * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
-   *   String project = "project-309310695";
-   *   String region = "region-934795532";
-   *   String operation = "operation1662702951";
-   *   Operation response = regionOperationsClient.wait(project, region, operation);
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.Operation;
+   * import com.google.cloud.compute.v1.RegionOperationsClient;
+   *
+   * public class RegionOperationsClientWait {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     regionOperationsClientWait();
+   *   }
+   *
+   *   public static void regionOperationsClientWait() throws Exception {
+   *     try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+   *       String project = "project-309310695";
+   *       String region = "region-934795532";
+   *       String operation = "operation1662702951";
+   *       Operation response = regionOperationsClient.wait(project, region, operation);
+   *     }
+   *   }
    * }
    * }
* @@ -277,14 +381,29 @@ public final Operation wait(String project, String region, String operation) { *

Sample code: * *

{@code
-   * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
-   *   WaitRegionOperationRequest request =
-   *       WaitRegionOperationRequest.newBuilder()
-   *           .setOperation("operation1662702951")
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .build();
-   *   Operation response = regionOperationsClient.wait(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.Operation;
+   * import com.google.cloud.compute.v1.RegionOperationsClient;
+   * import com.google.cloud.compute.v1.WaitRegionOperationRequest;
+   *
+   * public class RegionOperationsClientWait {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     regionOperationsClientWait();
+   *   }
+   *
+   *   public static void regionOperationsClientWait() throws Exception {
+   *     try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+   *       WaitRegionOperationRequest request =
+   *           WaitRegionOperationRequest.newBuilder()
+   *               .setOperation("operation1662702951")
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .build();
+   *       Operation response = regionOperationsClient.wait(request);
+   *     }
+   *   }
    * }
    * }
* @@ -311,16 +430,32 @@ public final Operation wait(WaitRegionOperationRequest request) { *

Sample code: * *

{@code
-   * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
-   *   WaitRegionOperationRequest request =
-   *       WaitRegionOperationRequest.newBuilder()
-   *           .setOperation("operation1662702951")
-   *           .setProject("project-309310695")
-   *           .setRegion("region-934795532")
-   *           .build();
-   *   ApiFuture future = regionOperationsClient.waitCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.compute.v1.Operation;
+   * import com.google.cloud.compute.v1.RegionOperationsClient;
+   * import com.google.cloud.compute.v1.WaitRegionOperationRequest;
+   *
+   * public class RegionOperationsClientWait {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     regionOperationsClientWait();
+   *   }
+   *
+   *   public static void regionOperationsClientWait() throws Exception {
+   *     try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+   *       WaitRegionOperationRequest request =
+   *           WaitRegionOperationRequest.newBuilder()
+   *               .setOperation("operation1662702951")
+   *               .setProject("project-309310695")
+   *               .setRegion("region-934795532")
+   *               .build();
+   *       ApiFuture future = regionOperationsClient.waitCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1/RegionOperationsSettings.java b/test/integration/goldens/compute/com/google/cloud/compute/v1/RegionOperationsSettings.java index 91cabed69d..feac3c1248 100644 --- a/test/integration/goldens/compute/com/google/cloud/compute/v1/RegionOperationsSettings.java +++ b/test/integration/goldens/compute/com/google/cloud/compute/v1/RegionOperationsSettings.java @@ -50,18 +50,32 @@ *

For example, to set the total timeout of get to 30 seconds: * *

{@code
- * RegionOperationsSettings.Builder regionOperationsSettingsBuilder =
- *     RegionOperationsSettings.newBuilder();
- * regionOperationsSettingsBuilder
- *     .getSettings()
- *     .setRetrySettings(
- *         regionOperationsSettingsBuilder
- *             .getSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * RegionOperationsSettings regionOperationsSettings = regionOperationsSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.RegionOperationsSettings;
+ * import java.time.Duration;
+ *
+ * public class RegionOperationsSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     regionOperationsSettings();
+ *   }
+ *
+ *   public static void regionOperationsSettings() throws Exception {
+ *     RegionOperationsSettings.Builder regionOperationsSettingsBuilder =
+ *         RegionOperationsSettings.newBuilder();
+ *     regionOperationsSettingsBuilder
+ *         .getSettings()
+ *         .setRetrySettings(
+ *             regionOperationsSettingsBuilder
+ *                 .getSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     RegionOperationsSettings regionOperationsSettings = regionOperationsSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1/package-info.java b/test/integration/goldens/compute/com/google/cloud/compute/v1/package-info.java index e525d9c7df..ec10926b3c 100644 --- a/test/integration/goldens/compute/com/google/cloud/compute/v1/package-info.java +++ b/test/integration/goldens/compute/com/google/cloud/compute/v1/package-info.java @@ -26,11 +26,26 @@ *

Sample for AddressesClient: * *

{@code
- * try (AddressesClient addressesClient = AddressesClient.create()) {
- *   String project = "project-309310695";
- *   for (Map.Entry element :
- *       addressesClient.aggregatedList(project).iterateAll()) {
- *     // doThingsWith(element);
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.AddressesClient;
+ * import com.google.cloud.compute.v1.AddressesScopedList;
+ * import java.util.Map;
+ *
+ * public class AddressesClientAggregatedList {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     addressesClientAggregatedList();
+ *   }
+ *
+ *   public static void addressesClientAggregatedList() throws Exception {
+ *     try (AddressesClient addressesClient = AddressesClient.create()) {
+ *       String project = "project-309310695";
+ *       for (Map.Entry element :
+ *           addressesClient.aggregatedList(project).iterateAll()) {
+ *         // doThingsWith(element);
+ *       }
+ *     }
  *   }
  * }
  * }
@@ -42,11 +57,25 @@ *

Sample for RegionOperationsClient: * *

{@code
- * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
- *   String project = "project-309310695";
- *   String region = "region-934795532";
- *   String operation = "operation1662702951";
- *   Operation response = regionOperationsClient.get(project, region, operation);
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.Operation;
+ * import com.google.cloud.compute.v1.RegionOperationsClient;
+ *
+ * public class RegionOperationsClientGet {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     regionOperationsClientGet();
+ *   }
+ *
+ *   public static void regionOperationsClientGet() throws Exception {
+ *     try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+ *       String project = "project-309310695";
+ *       String region = "region-934795532";
+ *       String operation = "operation1662702951";
+ *       Operation response = regionOperationsClient.get(project, region, operation);
+ *     }
+ *   }
  * }
  * }
*/ diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1/stub/AddressesStubSettings.java b/test/integration/goldens/compute/com/google/cloud/compute/v1/stub/AddressesStubSettings.java index b998276981..d860445cf2 100644 --- a/test/integration/goldens/compute/com/google/cloud/compute/v1/stub/AddressesStubSettings.java +++ b/test/integration/goldens/compute/com/google/cloud/compute/v1/stub/AddressesStubSettings.java @@ -83,17 +83,31 @@ *

For example, to set the total timeout of aggregatedList to 30 seconds: * *

{@code
- * AddressesStubSettings.Builder addressesSettingsBuilder = AddressesStubSettings.newBuilder();
- * addressesSettingsBuilder
- *     .aggregatedListSettings()
- *     .setRetrySettings(
- *         addressesSettingsBuilder
- *             .aggregatedListSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * AddressesStubSettings addressesSettings = addressesSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.stub.AddressesStubSettings;
+ * import java.time.Duration;
+ *
+ * public class AddressesSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     addressesSettings();
+ *   }
+ *
+ *   public static void addressesSettings() throws Exception {
+ *     AddressesStubSettings.Builder addressesSettingsBuilder = AddressesStubSettings.newBuilder();
+ *     addressesSettingsBuilder
+ *         .aggregatedListSettings()
+ *         .setRetrySettings(
+ *             addressesSettingsBuilder
+ *                 .aggregatedListSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     AddressesStubSettings addressesSettings = addressesSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1/stub/RegionOperationsStubSettings.java b/test/integration/goldens/compute/com/google/cloud/compute/v1/stub/RegionOperationsStubSettings.java index 365c834255..2777a13ec6 100644 --- a/test/integration/goldens/compute/com/google/cloud/compute/v1/stub/RegionOperationsStubSettings.java +++ b/test/integration/goldens/compute/com/google/cloud/compute/v1/stub/RegionOperationsStubSettings.java @@ -61,18 +61,32 @@ *

For example, to set the total timeout of get to 30 seconds: * *

{@code
- * RegionOperationsStubSettings.Builder regionOperationsSettingsBuilder =
- *     RegionOperationsStubSettings.newBuilder();
- * regionOperationsSettingsBuilder
- *     .getSettings()
- *     .setRetrySettings(
- *         regionOperationsSettingsBuilder
- *             .getSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * RegionOperationsStubSettings regionOperationsSettings = regionOperationsSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.stub.RegionOperationsStubSettings;
+ * import java.time.Duration;
+ *
+ * public class RegionOperationsSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     regionOperationsSettings();
+ *   }
+ *
+ *   public static void regionOperationsSettings() throws Exception {
+ *     RegionOperationsStubSettings.Builder regionOperationsSettingsBuilder =
+ *         RegionOperationsStubSettings.newBuilder();
+ *     regionOperationsSettingsBuilder
+ *         .getSettings()
+ *         .setRetrySettings(
+ *             regionOperationsSettingsBuilder
+ *                 .getSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     RegionOperationsStubSettings regionOperationsSettings = regionOperationsSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/IamCredentialsClient.java b/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/IamCredentialsClient.java index 86294e86c1..717bfd45cd 100644 --- a/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/IamCredentialsClient.java +++ b/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/IamCredentialsClient.java @@ -43,13 +43,31 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
- *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
- *   List delegates = new ArrayList<>();
- *   List scope = new ArrayList<>();
- *   Duration lifetime = Duration.newBuilder().build();
- *   GenerateAccessTokenResponse response =
- *       iamCredentialsClient.generateAccessToken(name, delegates, scope, lifetime);
+ * package com.google.example;
+ *
+ * import com.google.cloud.iam.credentials.v1.GenerateAccessTokenResponse;
+ * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+ * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+ * import com.google.protobuf.Duration;
+ * import java.util.ArrayList;
+ * import java.util.List;
+ *
+ * public class IamCredentialsClientGenerateAccessToken {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iamCredentialsClientGenerateAccessToken();
+ *   }
+ *
+ *   public static void iamCredentialsClientGenerateAccessToken() throws Exception {
+ *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+ *       ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
+ *       List delegates = new ArrayList<>();
+ *       List scope = new ArrayList<>();
+ *       Duration lifetime = Duration.newBuilder().build();
+ *       GenerateAccessTokenResponse response =
+ *           iamCredentialsClient.generateAccessToken(name, delegates, scope, lifetime);
+ *     }
+ *   }
  * }
  * }
* @@ -82,19 +100,50 @@ *

To customize credentials: * *

{@code
- * IamCredentialsSettings iamCredentialsSettings =
- *     IamCredentialsSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create(iamCredentialsSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+ * import com.google.cloud.iam.credentials.v1.IamCredentialsSettings;
+ * import com.google.cloud.iam.credentials.v1.myCredentials;
+ *
+ * public class IamCredentialsClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iamCredentialsClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void iamCredentialsClientSetCredentialsProvider() throws Exception {
+ *     IamCredentialsSettings iamCredentialsSettings =
+ *         IamCredentialsSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create(iamCredentialsSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * IamCredentialsSettings iamCredentialsSettings =
- *     IamCredentialsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create(iamCredentialsSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+ * import com.google.cloud.iam.credentials.v1.IamCredentialsSettings;
+ * import com.google.cloud.iam.credentials.v1.myEndpoint;
+ *
+ * public class IamCredentialsClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iamCredentialsClientSetEndpoint();
+ *   }
+ *
+ *   public static void iamCredentialsClientSetEndpoint() throws Exception {
+ *     IamCredentialsSettings iamCredentialsSettings =
+ *         IamCredentialsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create(iamCredentialsSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -159,13 +208,31 @@ public IamCredentialsStub getStub() { *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
-   *   List delegates = new ArrayList<>();
-   *   List scope = new ArrayList<>();
-   *   Duration lifetime = Duration.newBuilder().build();
-   *   GenerateAccessTokenResponse response =
-   *       iamCredentialsClient.generateAccessToken(name, delegates, scope, lifetime);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.GenerateAccessTokenResponse;
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.protobuf.Duration;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class IamCredentialsClientGenerateAccessToken {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientGenerateAccessToken();
+   *   }
+   *
+   *   public static void iamCredentialsClientGenerateAccessToken() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
+   *       List delegates = new ArrayList<>();
+   *       List scope = new ArrayList<>();
+   *       Duration lifetime = Duration.newBuilder().build();
+   *       GenerateAccessTokenResponse response =
+   *           iamCredentialsClient.generateAccessToken(name, delegates, scope, lifetime);
+   *     }
+   *   }
    * }
    * }
* @@ -208,13 +275,31 @@ public final GenerateAccessTokenResponse generateAccessToken( *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
-   *   List delegates = new ArrayList<>();
-   *   List scope = new ArrayList<>();
-   *   Duration lifetime = Duration.newBuilder().build();
-   *   GenerateAccessTokenResponse response =
-   *       iamCredentialsClient.generateAccessToken(name, delegates, scope, lifetime);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.GenerateAccessTokenResponse;
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.protobuf.Duration;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class IamCredentialsClientGenerateAccessToken {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientGenerateAccessToken();
+   *   }
+   *
+   *   public static void iamCredentialsClientGenerateAccessToken() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
+   *       List delegates = new ArrayList<>();
+   *       List scope = new ArrayList<>();
+   *       Duration lifetime = Duration.newBuilder().build();
+   *       GenerateAccessTokenResponse response =
+   *           iamCredentialsClient.generateAccessToken(name, delegates, scope, lifetime);
+   *     }
+   *   }
    * }
    * }
* @@ -257,15 +342,33 @@ public final GenerateAccessTokenResponse generateAccessToken( *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   GenerateAccessTokenRequest request =
-   *       GenerateAccessTokenRequest.newBuilder()
-   *           .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
-   *           .addAllDelegates(new ArrayList())
-   *           .addAllScope(new ArrayList())
-   *           .setLifetime(Duration.newBuilder().build())
-   *           .build();
-   *   GenerateAccessTokenResponse response = iamCredentialsClient.generateAccessToken(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.GenerateAccessTokenRequest;
+   * import com.google.cloud.iam.credentials.v1.GenerateAccessTokenResponse;
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.protobuf.Duration;
+   * import java.util.ArrayList;
+   *
+   * public class IamCredentialsClientGenerateAccessToken {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientGenerateAccessToken();
+   *   }
+   *
+   *   public static void iamCredentialsClientGenerateAccessToken() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       GenerateAccessTokenRequest request =
+   *           GenerateAccessTokenRequest.newBuilder()
+   *               .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
+   *               .addAllDelegates(new ArrayList())
+   *               .addAllScope(new ArrayList())
+   *               .setLifetime(Duration.newBuilder().build())
+   *               .build();
+   *       GenerateAccessTokenResponse response = iamCredentialsClient.generateAccessToken(request);
+   *     }
+   *   }
    * }
    * }
* @@ -283,18 +386,37 @@ public final GenerateAccessTokenResponse generateAccessToken(GenerateAccessToken *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   GenerateAccessTokenRequest request =
-   *       GenerateAccessTokenRequest.newBuilder()
-   *           .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
-   *           .addAllDelegates(new ArrayList())
-   *           .addAllScope(new ArrayList())
-   *           .setLifetime(Duration.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       iamCredentialsClient.generateAccessTokenCallable().futureCall(request);
-   *   // Do something.
-   *   GenerateAccessTokenResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.iam.credentials.v1.GenerateAccessTokenRequest;
+   * import com.google.cloud.iam.credentials.v1.GenerateAccessTokenResponse;
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.protobuf.Duration;
+   * import java.util.ArrayList;
+   *
+   * public class IamCredentialsClientGenerateAccessToken {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientGenerateAccessToken();
+   *   }
+   *
+   *   public static void iamCredentialsClientGenerateAccessToken() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       GenerateAccessTokenRequest request =
+   *           GenerateAccessTokenRequest.newBuilder()
+   *               .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
+   *               .addAllDelegates(new ArrayList())
+   *               .addAllScope(new ArrayList())
+   *               .setLifetime(Duration.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           iamCredentialsClient.generateAccessTokenCallable().futureCall(request);
+   *       // Do something.
+   *       GenerateAccessTokenResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -310,13 +432,30 @@ public final GenerateAccessTokenResponse generateAccessToken(GenerateAccessToken *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
-   *   List delegates = new ArrayList<>();
-   *   String audience = "audience975628804";
-   *   boolean includeEmail = true;
-   *   GenerateIdTokenResponse response =
-   *       iamCredentialsClient.generateIdToken(name, delegates, audience, includeEmail);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.GenerateIdTokenResponse;
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class IamCredentialsClientGenerateIdToken {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientGenerateIdToken();
+   *   }
+   *
+   *   public static void iamCredentialsClientGenerateIdToken() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
+   *       List delegates = new ArrayList<>();
+   *       String audience = "audience975628804";
+   *       boolean includeEmail = true;
+   *       GenerateIdTokenResponse response =
+   *           iamCredentialsClient.generateIdToken(name, delegates, audience, includeEmail);
+   *     }
+   *   }
    * }
    * }
* @@ -357,13 +496,30 @@ public final GenerateIdTokenResponse generateIdToken( *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
-   *   List delegates = new ArrayList<>();
-   *   String audience = "audience975628804";
-   *   boolean includeEmail = true;
-   *   GenerateIdTokenResponse response =
-   *       iamCredentialsClient.generateIdToken(name, delegates, audience, includeEmail);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.GenerateIdTokenResponse;
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class IamCredentialsClientGenerateIdToken {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientGenerateIdToken();
+   *   }
+   *
+   *   public static void iamCredentialsClientGenerateIdToken() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
+   *       List delegates = new ArrayList<>();
+   *       String audience = "audience975628804";
+   *       boolean includeEmail = true;
+   *       GenerateIdTokenResponse response =
+   *           iamCredentialsClient.generateIdToken(name, delegates, audience, includeEmail);
+   *     }
+   *   }
    * }
    * }
* @@ -404,15 +560,32 @@ public final GenerateIdTokenResponse generateIdToken( *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   GenerateIdTokenRequest request =
-   *       GenerateIdTokenRequest.newBuilder()
-   *           .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
-   *           .addAllDelegates(new ArrayList())
-   *           .setAudience("audience975628804")
-   *           .setIncludeEmail(true)
-   *           .build();
-   *   GenerateIdTokenResponse response = iamCredentialsClient.generateIdToken(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.GenerateIdTokenRequest;
+   * import com.google.cloud.iam.credentials.v1.GenerateIdTokenResponse;
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import java.util.ArrayList;
+   *
+   * public class IamCredentialsClientGenerateIdToken {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientGenerateIdToken();
+   *   }
+   *
+   *   public static void iamCredentialsClientGenerateIdToken() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       GenerateIdTokenRequest request =
+   *           GenerateIdTokenRequest.newBuilder()
+   *               .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
+   *               .addAllDelegates(new ArrayList())
+   *               .setAudience("audience975628804")
+   *               .setIncludeEmail(true)
+   *               .build();
+   *       GenerateIdTokenResponse response = iamCredentialsClient.generateIdToken(request);
+   *     }
+   *   }
    * }
    * }
* @@ -430,18 +603,36 @@ public final GenerateIdTokenResponse generateIdToken(GenerateIdTokenRequest requ *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   GenerateIdTokenRequest request =
-   *       GenerateIdTokenRequest.newBuilder()
-   *           .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
-   *           .addAllDelegates(new ArrayList())
-   *           .setAudience("audience975628804")
-   *           .setIncludeEmail(true)
-   *           .build();
-   *   ApiFuture future =
-   *       iamCredentialsClient.generateIdTokenCallable().futureCall(request);
-   *   // Do something.
-   *   GenerateIdTokenResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.iam.credentials.v1.GenerateIdTokenRequest;
+   * import com.google.cloud.iam.credentials.v1.GenerateIdTokenResponse;
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import java.util.ArrayList;
+   *
+   * public class IamCredentialsClientGenerateIdToken {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientGenerateIdToken();
+   *   }
+   *
+   *   public static void iamCredentialsClientGenerateIdToken() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       GenerateIdTokenRequest request =
+   *           GenerateIdTokenRequest.newBuilder()
+   *               .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
+   *               .addAllDelegates(new ArrayList())
+   *               .setAudience("audience975628804")
+   *               .setIncludeEmail(true)
+   *               .build();
+   *       ApiFuture future =
+   *           iamCredentialsClient.generateIdTokenCallable().futureCall(request);
+   *       // Do something.
+   *       GenerateIdTokenResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -457,11 +648,29 @@ public final GenerateIdTokenResponse generateIdToken(GenerateIdTokenRequest requ *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
-   *   List delegates = new ArrayList<>();
-   *   ByteString payload = ByteString.EMPTY;
-   *   SignBlobResponse response = iamCredentialsClient.signBlob(name, delegates, payload);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.cloud.iam.credentials.v1.SignBlobResponse;
+   * import com.google.protobuf.ByteString;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class IamCredentialsClientSignBlob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientSignBlob();
+   *   }
+   *
+   *   public static void iamCredentialsClientSignBlob() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
+   *       List delegates = new ArrayList<>();
+   *       ByteString payload = ByteString.EMPTY;
+   *       SignBlobResponse response = iamCredentialsClient.signBlob(name, delegates, payload);
+   *     }
+   *   }
    * }
    * }
* @@ -498,11 +707,29 @@ public final SignBlobResponse signBlob( *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
-   *   List delegates = new ArrayList<>();
-   *   ByteString payload = ByteString.EMPTY;
-   *   SignBlobResponse response = iamCredentialsClient.signBlob(name, delegates, payload);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.cloud.iam.credentials.v1.SignBlobResponse;
+   * import com.google.protobuf.ByteString;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class IamCredentialsClientSignBlob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientSignBlob();
+   *   }
+   *
+   *   public static void iamCredentialsClientSignBlob() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
+   *       List delegates = new ArrayList<>();
+   *       ByteString payload = ByteString.EMPTY;
+   *       SignBlobResponse response = iamCredentialsClient.signBlob(name, delegates, payload);
+   *     }
+   *   }
    * }
    * }
* @@ -538,14 +765,32 @@ public final SignBlobResponse signBlob(String name, List delegates, Byte *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   SignBlobRequest request =
-   *       SignBlobRequest.newBuilder()
-   *           .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
-   *           .addAllDelegates(new ArrayList())
-   *           .setPayload(ByteString.EMPTY)
-   *           .build();
-   *   SignBlobResponse response = iamCredentialsClient.signBlob(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.cloud.iam.credentials.v1.SignBlobRequest;
+   * import com.google.cloud.iam.credentials.v1.SignBlobResponse;
+   * import com.google.protobuf.ByteString;
+   * import java.util.ArrayList;
+   *
+   * public class IamCredentialsClientSignBlob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientSignBlob();
+   *   }
+   *
+   *   public static void iamCredentialsClientSignBlob() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       SignBlobRequest request =
+   *           SignBlobRequest.newBuilder()
+   *               .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
+   *               .addAllDelegates(new ArrayList())
+   *               .setPayload(ByteString.EMPTY)
+   *               .build();
+   *       SignBlobResponse response = iamCredentialsClient.signBlob(request);
+   *     }
+   *   }
    * }
    * }
* @@ -563,17 +808,36 @@ public final SignBlobResponse signBlob(SignBlobRequest request) { *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   SignBlobRequest request =
-   *       SignBlobRequest.newBuilder()
-   *           .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
-   *           .addAllDelegates(new ArrayList())
-   *           .setPayload(ByteString.EMPTY)
-   *           .build();
-   *   ApiFuture future =
-   *       iamCredentialsClient.signBlobCallable().futureCall(request);
-   *   // Do something.
-   *   SignBlobResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.cloud.iam.credentials.v1.SignBlobRequest;
+   * import com.google.cloud.iam.credentials.v1.SignBlobResponse;
+   * import com.google.protobuf.ByteString;
+   * import java.util.ArrayList;
+   *
+   * public class IamCredentialsClientSignBlob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientSignBlob();
+   *   }
+   *
+   *   public static void iamCredentialsClientSignBlob() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       SignBlobRequest request =
+   *           SignBlobRequest.newBuilder()
+   *               .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
+   *               .addAllDelegates(new ArrayList())
+   *               .setPayload(ByteString.EMPTY)
+   *               .build();
+   *       ApiFuture future =
+   *           iamCredentialsClient.signBlobCallable().futureCall(request);
+   *       // Do something.
+   *       SignBlobResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -588,11 +852,28 @@ public final UnaryCallable signBlobCallable() *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
-   *   List delegates = new ArrayList<>();
-   *   String payload = "payload-786701938";
-   *   SignJwtResponse response = iamCredentialsClient.signJwt(name, delegates, payload);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.cloud.iam.credentials.v1.SignJwtResponse;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class IamCredentialsClientSignJwt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientSignJwt();
+   *   }
+   *
+   *   public static void iamCredentialsClientSignJwt() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
+   *       List delegates = new ArrayList<>();
+   *       String payload = "payload-786701938";
+   *       SignJwtResponse response = iamCredentialsClient.signJwt(name, delegates, payload);
+   *     }
+   *   }
    * }
    * }
* @@ -629,11 +910,28 @@ public final SignJwtResponse signJwt( *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
-   *   List delegates = new ArrayList<>();
-   *   String payload = "payload-786701938";
-   *   SignJwtResponse response = iamCredentialsClient.signJwt(name, delegates, payload);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.cloud.iam.credentials.v1.SignJwtResponse;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class IamCredentialsClientSignJwt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientSignJwt();
+   *   }
+   *
+   *   public static void iamCredentialsClientSignJwt() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
+   *       List delegates = new ArrayList<>();
+   *       String payload = "payload-786701938";
+   *       SignJwtResponse response = iamCredentialsClient.signJwt(name, delegates, payload);
+   *     }
+   *   }
    * }
    * }
* @@ -669,14 +967,31 @@ public final SignJwtResponse signJwt(String name, List delegates, String *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   SignJwtRequest request =
-   *       SignJwtRequest.newBuilder()
-   *           .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
-   *           .addAllDelegates(new ArrayList())
-   *           .setPayload("payload-786701938")
-   *           .build();
-   *   SignJwtResponse response = iamCredentialsClient.signJwt(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.cloud.iam.credentials.v1.SignJwtRequest;
+   * import com.google.cloud.iam.credentials.v1.SignJwtResponse;
+   * import java.util.ArrayList;
+   *
+   * public class IamCredentialsClientSignJwt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientSignJwt();
+   *   }
+   *
+   *   public static void iamCredentialsClientSignJwt() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       SignJwtRequest request =
+   *           SignJwtRequest.newBuilder()
+   *               .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
+   *               .addAllDelegates(new ArrayList())
+   *               .setPayload("payload-786701938")
+   *               .build();
+   *       SignJwtResponse response = iamCredentialsClient.signJwt(request);
+   *     }
+   *   }
    * }
    * }
* @@ -694,17 +1009,35 @@ public final SignJwtResponse signJwt(SignJwtRequest request) { *

Sample code: * *

{@code
-   * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
-   *   SignJwtRequest request =
-   *       SignJwtRequest.newBuilder()
-   *           .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
-   *           .addAllDelegates(new ArrayList())
-   *           .setPayload("payload-786701938")
-   *           .build();
-   *   ApiFuture future =
-   *       iamCredentialsClient.signJwtCallable().futureCall(request);
-   *   // Do something.
-   *   SignJwtResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+   * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+   * import com.google.cloud.iam.credentials.v1.SignJwtRequest;
+   * import com.google.cloud.iam.credentials.v1.SignJwtResponse;
+   * import java.util.ArrayList;
+   *
+   * public class IamCredentialsClientSignJwt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iamCredentialsClientSignJwt();
+   *   }
+   *
+   *   public static void iamCredentialsClientSignJwt() throws Exception {
+   *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+   *       SignJwtRequest request =
+   *           SignJwtRequest.newBuilder()
+   *               .setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString())
+   *               .addAllDelegates(new ArrayList())
+   *               .setPayload("payload-786701938")
+   *               .build();
+   *       ApiFuture future =
+   *           iamCredentialsClient.signJwtCallable().futureCall(request);
+   *       // Do something.
+   *       SignJwtResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/IamCredentialsSettings.java b/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/IamCredentialsSettings.java index 7395ce677d..83fe08e185 100644 --- a/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/IamCredentialsSettings.java +++ b/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/IamCredentialsSettings.java @@ -51,18 +51,32 @@ *

For example, to set the total timeout of generateAccessToken to 30 seconds: * *

{@code
- * IamCredentialsSettings.Builder iamCredentialsSettingsBuilder =
- *     IamCredentialsSettings.newBuilder();
- * iamCredentialsSettingsBuilder
- *     .generateAccessTokenSettings()
- *     .setRetrySettings(
- *         iamCredentialsSettingsBuilder
- *             .generateAccessTokenSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * IamCredentialsSettings iamCredentialsSettings = iamCredentialsSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.iam.credentials.v1.IamCredentialsSettings;
+ * import java.time.Duration;
+ *
+ * public class IamCredentialsSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iamCredentialsSettings();
+ *   }
+ *
+ *   public static void iamCredentialsSettings() throws Exception {
+ *     IamCredentialsSettings.Builder iamCredentialsSettingsBuilder =
+ *         IamCredentialsSettings.newBuilder();
+ *     iamCredentialsSettingsBuilder
+ *         .generateAccessTokenSettings()
+ *         .setRetrySettings(
+ *             iamCredentialsSettingsBuilder
+ *                 .generateAccessTokenSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     IamCredentialsSettings iamCredentialsSettings = iamCredentialsSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/package-info.java b/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/package-info.java index f65f5f2766..4cef4073d7 100644 --- a/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/package-info.java +++ b/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/package-info.java @@ -31,13 +31,31 @@ *

Sample for IamCredentialsClient: * *

{@code
- * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
- *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
- *   List delegates = new ArrayList<>();
- *   List scope = new ArrayList<>();
- *   Duration lifetime = Duration.newBuilder().build();
- *   GenerateAccessTokenResponse response =
- *       iamCredentialsClient.generateAccessToken(name, delegates, scope, lifetime);
+ * package com.google.example;
+ *
+ * import com.google.cloud.iam.credentials.v1.GenerateAccessTokenResponse;
+ * import com.google.cloud.iam.credentials.v1.IamCredentialsClient;
+ * import com.google.cloud.iam.credentials.v1.ServiceAccountName;
+ * import com.google.protobuf.Duration;
+ * import java.util.ArrayList;
+ * import java.util.List;
+ *
+ * public class IamCredentialsClientGenerateAccessToken {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iamCredentialsClientGenerateAccessToken();
+ *   }
+ *
+ *   public static void iamCredentialsClientGenerateAccessToken() throws Exception {
+ *     try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
+ *       ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
+ *       List delegates = new ArrayList<>();
+ *       List scope = new ArrayList<>();
+ *       Duration lifetime = Duration.newBuilder().build();
+ *       GenerateAccessTokenResponse response =
+ *           iamCredentialsClient.generateAccessToken(name, delegates, scope, lifetime);
+ *     }
+ *   }
  * }
  * }
*/ diff --git a/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/stub/IamCredentialsStubSettings.java b/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/stub/IamCredentialsStubSettings.java index 26792da200..4a26eca037 100644 --- a/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/stub/IamCredentialsStubSettings.java +++ b/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/stub/IamCredentialsStubSettings.java @@ -67,18 +67,32 @@ *

For example, to set the total timeout of generateAccessToken to 30 seconds: * *

{@code
- * IamCredentialsStubSettings.Builder iamCredentialsSettingsBuilder =
- *     IamCredentialsStubSettings.newBuilder();
- * iamCredentialsSettingsBuilder
- *     .generateAccessTokenSettings()
- *     .setRetrySettings(
- *         iamCredentialsSettingsBuilder
- *             .generateAccessTokenSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * IamCredentialsStubSettings iamCredentialsSettings = iamCredentialsSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.iam.credentials.v1.stub.IamCredentialsStubSettings;
+ * import java.time.Duration;
+ *
+ * public class IamCredentialsSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iamCredentialsSettings();
+ *   }
+ *
+ *   public static void iamCredentialsSettings() throws Exception {
+ *     IamCredentialsStubSettings.Builder iamCredentialsSettingsBuilder =
+ *         IamCredentialsStubSettings.newBuilder();
+ *     iamCredentialsSettingsBuilder
+ *         .generateAccessTokenSettings()
+ *         .setRetrySettings(
+ *             iamCredentialsSettingsBuilder
+ *                 .generateAccessTokenSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     IamCredentialsStubSettings iamCredentialsSettings = iamCredentialsSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/iam/com/google/iam/v1/IAMPolicyClient.java b/test/integration/goldens/iam/com/google/iam/v1/IAMPolicyClient.java index 5580eab1e2..6d50cfe172 100644 --- a/test/integration/goldens/iam/com/google/iam/v1/IAMPolicyClient.java +++ b/test/integration/goldens/iam/com/google/iam/v1/IAMPolicyClient.java @@ -54,13 +54,28 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
- *   SetIamPolicyRequest request =
- *       SetIamPolicyRequest.newBuilder()
- *           .setResource("SetIamPolicyRequest1223629066".toString())
- *           .setPolicy(Policy.newBuilder().build())
- *           .build();
- *   Policy response = iAMPolicyClient.setIamPolicy(request);
+ * package com.google.example;
+ *
+ * import com.google.iam.v1.IAMPolicyClient;
+ * import com.google.iam.v1.Policy;
+ * import com.google.iam.v1.SetIamPolicyRequest;
+ *
+ * public class IAMPolicyClientSetIamPolicy {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iAMPolicyClientSetIamPolicy();
+ *   }
+ *
+ *   public static void iAMPolicyClientSetIamPolicy() throws Exception {
+ *     try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
+ *       SetIamPolicyRequest request =
+ *           SetIamPolicyRequest.newBuilder()
+ *               .setResource("SetIamPolicyRequest1223629066".toString())
+ *               .setPolicy(Policy.newBuilder().build())
+ *               .build();
+ *       Policy response = iAMPolicyClient.setIamPolicy(request);
+ *     }
+ *   }
  * }
  * }
* @@ -93,19 +108,50 @@ *

To customize credentials: * *

{@code
- * IAMPolicySettings iAMPolicySettings =
- *     IAMPolicySettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create(iAMPolicySettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.iam.v1.IAMPolicyClient;
+ * import com.google.iam.v1.IAMPolicySettings;
+ * import com.google.iam.v1.myCredentials;
+ *
+ * public class IAMPolicyClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iAMPolicyClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void iAMPolicyClientSetCredentialsProvider() throws Exception {
+ *     IAMPolicySettings iAMPolicySettings =
+ *         IAMPolicySettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create(iAMPolicySettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * IAMPolicySettings iAMPolicySettings =
- *     IAMPolicySettings.newBuilder().setEndpoint(myEndpoint).build();
- * IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create(iAMPolicySettings);
+ * package com.google.example;
+ *
+ * import com.google.iam.v1.IAMPolicyClient;
+ * import com.google.iam.v1.IAMPolicySettings;
+ * import com.google.iam.v1.myEndpoint;
+ *
+ * public class IAMPolicyClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iAMPolicyClientSetEndpoint();
+ *   }
+ *
+ *   public static void iAMPolicyClientSetEndpoint() throws Exception {
+ *     IAMPolicySettings iAMPolicySettings =
+ *         IAMPolicySettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create(iAMPolicySettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -168,13 +214,28 @@ public IAMPolicyStub getStub() { *

Sample code: * *

{@code
-   * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
-   *   SetIamPolicyRequest request =
-   *       SetIamPolicyRequest.newBuilder()
-   *           .setResource("SetIamPolicyRequest1223629066".toString())
-   *           .setPolicy(Policy.newBuilder().build())
-   *           .build();
-   *   Policy response = iAMPolicyClient.setIamPolicy(request);
+   * package com.google.example;
+   *
+   * import com.google.iam.v1.IAMPolicyClient;
+   * import com.google.iam.v1.Policy;
+   * import com.google.iam.v1.SetIamPolicyRequest;
+   *
+   * public class IAMPolicyClientSetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iAMPolicyClientSetIamPolicy();
+   *   }
+   *
+   *   public static void iAMPolicyClientSetIamPolicy() throws Exception {
+   *     try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
+   *       SetIamPolicyRequest request =
+   *           SetIamPolicyRequest.newBuilder()
+   *               .setResource("SetIamPolicyRequest1223629066".toString())
+   *               .setPolicy(Policy.newBuilder().build())
+   *               .build();
+   *       Policy response = iAMPolicyClient.setIamPolicy(request);
+   *     }
+   *   }
    * }
    * }
* @@ -192,15 +253,31 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { *

Sample code: * *

{@code
-   * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
-   *   SetIamPolicyRequest request =
-   *       SetIamPolicyRequest.newBuilder()
-   *           .setResource("SetIamPolicyRequest1223629066".toString())
-   *           .setPolicy(Policy.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = iAMPolicyClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   Policy response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.iam.v1.IAMPolicyClient;
+   * import com.google.iam.v1.Policy;
+   * import com.google.iam.v1.SetIamPolicyRequest;
+   *
+   * public class IAMPolicyClientSetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iAMPolicyClientSetIamPolicy();
+   *   }
+   *
+   *   public static void iAMPolicyClientSetIamPolicy() throws Exception {
+   *     try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
+   *       SetIamPolicyRequest request =
+   *           SetIamPolicyRequest.newBuilder()
+   *               .setResource("SetIamPolicyRequest1223629066".toString())
+   *               .setPolicy(Policy.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = iAMPolicyClient.setIamPolicyCallable().futureCall(request);
+   *       // Do something.
+   *       Policy response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -216,13 +293,29 @@ public final UnaryCallable setIamPolicyCallable() { *

Sample code: * *

{@code
-   * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource("GetIamPolicyRequest-1527610370".toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   Policy response = iAMPolicyClient.getIamPolicy(request);
+   * package com.google.example;
+   *
+   * import com.google.iam.v1.GetIamPolicyRequest;
+   * import com.google.iam.v1.GetPolicyOptions;
+   * import com.google.iam.v1.IAMPolicyClient;
+   * import com.google.iam.v1.Policy;
+   *
+   * public class IAMPolicyClientGetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iAMPolicyClientGetIamPolicy();
+   *   }
+   *
+   *   public static void iAMPolicyClientGetIamPolicy() throws Exception {
+   *     try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
+   *       GetIamPolicyRequest request =
+   *           GetIamPolicyRequest.newBuilder()
+   *               .setResource("GetIamPolicyRequest-1527610370".toString())
+   *               .setOptions(GetPolicyOptions.newBuilder().build())
+   *               .build();
+   *       Policy response = iAMPolicyClient.getIamPolicy(request);
+   *     }
+   *   }
    * }
    * }
* @@ -241,15 +334,32 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { *

Sample code: * *

{@code
-   * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource("GetIamPolicyRequest-1527610370".toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = iAMPolicyClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   Policy response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.iam.v1.GetIamPolicyRequest;
+   * import com.google.iam.v1.GetPolicyOptions;
+   * import com.google.iam.v1.IAMPolicyClient;
+   * import com.google.iam.v1.Policy;
+   *
+   * public class IAMPolicyClientGetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iAMPolicyClientGetIamPolicy();
+   *   }
+   *
+   *   public static void iAMPolicyClientGetIamPolicy() throws Exception {
+   *     try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
+   *       GetIamPolicyRequest request =
+   *           GetIamPolicyRequest.newBuilder()
+   *               .setResource("GetIamPolicyRequest-1527610370".toString())
+   *               .setOptions(GetPolicyOptions.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = iAMPolicyClient.getIamPolicyCallable().futureCall(request);
+   *       // Do something.
+   *       Policy response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -269,13 +379,29 @@ public final UnaryCallable getIamPolicyCallable() { *

Sample code: * *

{@code
-   * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource("TestIamPermissionsRequest942398222".toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   TestIamPermissionsResponse response = iAMPolicyClient.testIamPermissions(request);
+   * package com.google.example;
+   *
+   * import com.google.iam.v1.IAMPolicyClient;
+   * import com.google.iam.v1.TestIamPermissionsRequest;
+   * import com.google.iam.v1.TestIamPermissionsResponse;
+   * import java.util.ArrayList;
+   *
+   * public class IAMPolicyClientTestIamPermissions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iAMPolicyClientTestIamPermissions();
+   *   }
+   *
+   *   public static void iAMPolicyClientTestIamPermissions() throws Exception {
+   *     try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
+   *       TestIamPermissionsRequest request =
+   *           TestIamPermissionsRequest.newBuilder()
+   *               .setResource("TestIamPermissionsRequest942398222".toString())
+   *               .addAllPermissions(new ArrayList())
+   *               .build();
+   *       TestIamPermissionsResponse response = iAMPolicyClient.testIamPermissions(request);
+   *     }
+   *   }
    * }
    * }
* @@ -298,16 +424,33 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq *

Sample code: * *

{@code
-   * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource("TestIamPermissionsRequest942398222".toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   ApiFuture future =
-   *       iAMPolicyClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something.
-   *   TestIamPermissionsResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.iam.v1.IAMPolicyClient;
+   * import com.google.iam.v1.TestIamPermissionsRequest;
+   * import com.google.iam.v1.TestIamPermissionsResponse;
+   * import java.util.ArrayList;
+   *
+   * public class IAMPolicyClientTestIamPermissions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     iAMPolicyClientTestIamPermissions();
+   *   }
+   *
+   *   public static void iAMPolicyClientTestIamPermissions() throws Exception {
+   *     try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
+   *       TestIamPermissionsRequest request =
+   *           TestIamPermissionsRequest.newBuilder()
+   *               .setResource("TestIamPermissionsRequest942398222".toString())
+   *               .addAllPermissions(new ArrayList())
+   *               .build();
+   *       ApiFuture future =
+   *           iAMPolicyClient.testIamPermissionsCallable().futureCall(request);
+   *       // Do something.
+   *       TestIamPermissionsResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/iam/com/google/iam/v1/IAMPolicySettings.java b/test/integration/goldens/iam/com/google/iam/v1/IAMPolicySettings.java index 26eb385562..9af5d0667f 100644 --- a/test/integration/goldens/iam/com/google/iam/v1/IAMPolicySettings.java +++ b/test/integration/goldens/iam/com/google/iam/v1/IAMPolicySettings.java @@ -50,17 +50,31 @@ *

For example, to set the total timeout of setIamPolicy to 30 seconds: * *

{@code
- * IAMPolicySettings.Builder iAMPolicySettingsBuilder = IAMPolicySettings.newBuilder();
- * iAMPolicySettingsBuilder
- *     .setIamPolicySettings()
- *     .setRetrySettings(
- *         iAMPolicySettingsBuilder
- *             .setIamPolicySettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * IAMPolicySettings iAMPolicySettings = iAMPolicySettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.iam.v1.IAMPolicySettings;
+ * import java.time.Duration;
+ *
+ * public class IAMPolicySettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iAMPolicySettings();
+ *   }
+ *
+ *   public static void iAMPolicySettings() throws Exception {
+ *     IAMPolicySettings.Builder iAMPolicySettingsBuilder = IAMPolicySettings.newBuilder();
+ *     iAMPolicySettingsBuilder
+ *         .setIamPolicySettings()
+ *         .setRetrySettings(
+ *             iAMPolicySettingsBuilder
+ *                 .setIamPolicySettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     IAMPolicySettings iAMPolicySettings = iAMPolicySettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/iam/com/google/iam/v1/package-info.java b/test/integration/goldens/iam/com/google/iam/v1/package-info.java index 8f87748c4b..f7ce1450a8 100644 --- a/test/integration/goldens/iam/com/google/iam/v1/package-info.java +++ b/test/integration/goldens/iam/com/google/iam/v1/package-info.java @@ -45,13 +45,28 @@ *

Sample for IAMPolicyClient: * *

{@code
- * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
- *   SetIamPolicyRequest request =
- *       SetIamPolicyRequest.newBuilder()
- *           .setResource("resource-341064690")
- *           .setPolicy(Policy.newBuilder().build())
- *           .build();
- *   Policy response = iAMPolicyClient.setIamPolicy(request);
+ * package com.google.example;
+ *
+ * import com.google.iam.v1.IAMPolicyClient;
+ * import com.google.iam.v1.Policy;
+ * import com.google.iam.v1.SetIamPolicyRequest;
+ *
+ * public class IAMPolicyClientSetIamPolicy {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iAMPolicyClientSetIamPolicy();
+ *   }
+ *
+ *   public static void iAMPolicyClientSetIamPolicy() throws Exception {
+ *     try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
+ *       SetIamPolicyRequest request =
+ *           SetIamPolicyRequest.newBuilder()
+ *               .setResource("resource-341064690")
+ *               .setPolicy(Policy.newBuilder().build())
+ *               .build();
+ *       Policy response = iAMPolicyClient.setIamPolicy(request);
+ *     }
+ *   }
  * }
  * }
*/ diff --git a/test/integration/goldens/iam/com/google/iam/v1/stub/IAMPolicyStubSettings.java b/test/integration/goldens/iam/com/google/iam/v1/stub/IAMPolicyStubSettings.java index 03c10fcb73..1dc98ef14e 100644 --- a/test/integration/goldens/iam/com/google/iam/v1/stub/IAMPolicyStubSettings.java +++ b/test/integration/goldens/iam/com/google/iam/v1/stub/IAMPolicyStubSettings.java @@ -63,17 +63,31 @@ *

For example, to set the total timeout of setIamPolicy to 30 seconds: * *

{@code
- * IAMPolicyStubSettings.Builder iAMPolicySettingsBuilder = IAMPolicyStubSettings.newBuilder();
- * iAMPolicySettingsBuilder
- *     .setIamPolicySettings()
- *     .setRetrySettings(
- *         iAMPolicySettingsBuilder
- *             .setIamPolicySettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * IAMPolicyStubSettings iAMPolicySettings = iAMPolicySettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.iam.v1.stub.IAMPolicyStubSettings;
+ * import java.time.Duration;
+ *
+ * public class IAMPolicySettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iAMPolicySettings();
+ *   }
+ *
+ *   public static void iAMPolicySettings() throws Exception {
+ *     IAMPolicyStubSettings.Builder iAMPolicySettingsBuilder = IAMPolicyStubSettings.newBuilder();
+ *     iAMPolicySettingsBuilder
+ *         .setIamPolicySettings()
+ *         .setRetrySettings(
+ *             iAMPolicySettingsBuilder
+ *                 .setIamPolicySettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     IAMPolicyStubSettings iAMPolicySettings = iAMPolicySettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/kms/com/google/cloud/kms/v1/KeyManagementServiceClient.java b/test/integration/goldens/kms/com/google/cloud/kms/v1/KeyManagementServiceClient.java index e4d0dcc548..998c8954a2 100644 --- a/test/integration/goldens/kms/com/google/cloud/kms/v1/KeyManagementServiceClient.java +++ b/test/integration/goldens/kms/com/google/cloud/kms/v1/KeyManagementServiceClient.java @@ -65,10 +65,25 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (KeyManagementServiceClient keyManagementServiceClient =
- *     KeyManagementServiceClient.create()) {
- *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
- *   KeyRing response = keyManagementServiceClient.getKeyRing(name);
+ * package com.google.example;
+ *
+ * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+ * import com.google.cloud.kms.v1.KeyRing;
+ * import com.google.cloud.kms.v1.KeyRingName;
+ *
+ * public class KeyManagementServiceClientGetKeyRing {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     keyManagementServiceClientGetKeyRing();
+ *   }
+ *
+ *   public static void keyManagementServiceClientGetKeyRing() throws Exception {
+ *     try (KeyManagementServiceClient keyManagementServiceClient =
+ *         KeyManagementServiceClient.create()) {
+ *       KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+ *       KeyRing response = keyManagementServiceClient.getKeyRing(name);
+ *     }
+ *   }
  * }
  * }
* @@ -102,21 +117,52 @@ *

To customize credentials: * *

{@code
- * KeyManagementServiceSettings keyManagementServiceSettings =
- *     KeyManagementServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * KeyManagementServiceClient keyManagementServiceClient =
- *     KeyManagementServiceClient.create(keyManagementServiceSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+ * import com.google.cloud.kms.v1.KeyManagementServiceSettings;
+ * import com.google.cloud.kms.v1.myCredentials;
+ *
+ * public class KeyManagementServiceClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     keyManagementServiceClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void keyManagementServiceClientSetCredentialsProvider() throws Exception {
+ *     KeyManagementServiceSettings keyManagementServiceSettings =
+ *         KeyManagementServiceSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     KeyManagementServiceClient keyManagementServiceClient =
+ *         KeyManagementServiceClient.create(keyManagementServiceSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * KeyManagementServiceSettings keyManagementServiceSettings =
- *     KeyManagementServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * KeyManagementServiceClient keyManagementServiceClient =
- *     KeyManagementServiceClient.create(keyManagementServiceSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+ * import com.google.cloud.kms.v1.KeyManagementServiceSettings;
+ * import com.google.cloud.kms.v1.myEndpoint;
+ *
+ * public class KeyManagementServiceClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     keyManagementServiceClientSetEndpoint();
+ *   }
+ *
+ *   public static void keyManagementServiceClientSetEndpoint() throws Exception {
+ *     KeyManagementServiceSettings keyManagementServiceSettings =
+ *         KeyManagementServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     KeyManagementServiceClient keyManagementServiceClient =
+ *         KeyManagementServiceClient.create(keyManagementServiceSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -181,11 +227,26 @@ public KeyManagementServiceStub getStub() { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (KeyRing element : keyManagementServiceClient.listKeyRings(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.LocationName;
+   *
+   * public class KeyManagementServiceClientListKeyRings {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListKeyRings();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListKeyRings() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *       for (KeyRing element : keyManagementServiceClient.listKeyRings(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -209,11 +270,26 @@ public final ListKeyRingsPagedResponse listKeyRings(LocationName parent) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
-   *   for (KeyRing element : keyManagementServiceClient.listKeyRings(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.LocationName;
+   *
+   * public class KeyManagementServiceClientListKeyRings {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListKeyRings();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListKeyRings() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *       for (KeyRing element : keyManagementServiceClient.listKeyRings(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -234,18 +310,34 @@ public final ListKeyRingsPagedResponse listKeyRings(String parent) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListKeyRingsRequest request =
-   *       ListKeyRingsRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   for (KeyRing element : keyManagementServiceClient.listKeyRings(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.ListKeyRingsRequest;
+   * import com.google.cloud.kms.v1.LocationName;
+   *
+   * public class KeyManagementServiceClientListKeyRings {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListKeyRings();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListKeyRings() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListKeyRingsRequest request =
+   *           ListKeyRingsRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       for (KeyRing element : keyManagementServiceClient.listKeyRings(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -264,21 +356,38 @@ public final ListKeyRingsPagedResponse listKeyRings(ListKeyRingsRequest request) *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListKeyRingsRequest request =
-   *       ListKeyRingsRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.listKeyRingsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (KeyRing element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.ListKeyRingsRequest;
+   * import com.google.cloud.kms.v1.LocationName;
+   *
+   * public class KeyManagementServiceClientListKeyRings {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListKeyRings();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListKeyRings() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListKeyRingsRequest request =
+   *           ListKeyRingsRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.listKeyRingsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (KeyRing element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -295,27 +404,45 @@ public final ListKeyRingsPagedResponse listKeyRings(ListKeyRingsRequest request) *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListKeyRingsRequest request =
-   *       ListKeyRingsRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   while (true) {
-   *     ListKeyRingsResponse response =
-   *         keyManagementServiceClient.listKeyRingsCallable().call(request);
-   *     for (KeyRing element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.ListKeyRingsRequest;
+   * import com.google.cloud.kms.v1.ListKeyRingsResponse;
+   * import com.google.cloud.kms.v1.LocationName;
+   * import com.google.common.base.Strings;
+   *
+   * public class KeyManagementServiceClientListKeyRings {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListKeyRings();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListKeyRings() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListKeyRingsRequest request =
+   *           ListKeyRingsRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       while (true) {
+   *         ListKeyRingsResponse response =
+   *             keyManagementServiceClient.listKeyRingsCallable().call(request);
+   *         for (KeyRing element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -332,11 +459,26 @@ public final UnaryCallable listKeyRin
    * 

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
-   *   for (CryptoKey element : keyManagementServiceClient.listCryptoKeys(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientListCryptoKeys {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListCryptoKeys();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListCryptoKeys() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *       for (CryptoKey element : keyManagementServiceClient.listCryptoKeys(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -360,11 +502,26 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(KeyRingName parent) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
-   *   for (CryptoKey element : keyManagementServiceClient.listCryptoKeys(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientListCryptoKeys {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListCryptoKeys();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListCryptoKeys() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
+   *       for (CryptoKey element : keyManagementServiceClient.listCryptoKeys(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -385,18 +542,34 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(String parent) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListCryptoKeysRequest request =
-   *       ListCryptoKeysRequest.newBuilder()
-   *           .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   for (CryptoKey element : keyManagementServiceClient.listCryptoKeys(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   * import com.google.cloud.kms.v1.ListCryptoKeysRequest;
+   *
+   * public class KeyManagementServiceClientListCryptoKeys {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListCryptoKeys();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListCryptoKeys() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListCryptoKeysRequest request =
+   *           ListCryptoKeysRequest.newBuilder()
+   *               .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       for (CryptoKey element : keyManagementServiceClient.listCryptoKeys(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -415,21 +588,38 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(ListCryptoKeysRequest re *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListCryptoKeysRequest request =
-   *       ListCryptoKeysRequest.newBuilder()
-   *           .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.listCryptoKeysPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (CryptoKey element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   * import com.google.cloud.kms.v1.ListCryptoKeysRequest;
+   *
+   * public class KeyManagementServiceClientListCryptoKeys {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListCryptoKeys();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListCryptoKeys() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListCryptoKeysRequest request =
+   *           ListCryptoKeysRequest.newBuilder()
+   *               .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.listCryptoKeysPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (CryptoKey element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -446,27 +636,45 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(ListCryptoKeysRequest re *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListCryptoKeysRequest request =
-   *       ListCryptoKeysRequest.newBuilder()
-   *           .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   while (true) {
-   *     ListCryptoKeysResponse response =
-   *         keyManagementServiceClient.listCryptoKeysCallable().call(request);
-   *     for (CryptoKey element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   * import com.google.cloud.kms.v1.ListCryptoKeysRequest;
+   * import com.google.cloud.kms.v1.ListCryptoKeysResponse;
+   * import com.google.common.base.Strings;
+   *
+   * public class KeyManagementServiceClientListCryptoKeys {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListCryptoKeys();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListCryptoKeys() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListCryptoKeysRequest request =
+   *           ListCryptoKeysRequest.newBuilder()
+   *               .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       while (true) {
+   *         ListCryptoKeysResponse response =
+   *             keyManagementServiceClient.listCryptoKeysCallable().call(request);
+   *         for (CryptoKey element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -484,13 +692,28 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(ListCryptoKeysRequest re
    * 

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyName parent =
-   *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
-   *   for (CryptoKeyVersion element :
-   *       keyManagementServiceClient.listCryptoKeyVersions(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientListCryptoKeyVersions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListCryptoKeyVersions();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListCryptoKeyVersions() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyName parent =
+   *           CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *       for (CryptoKeyVersion element :
+   *           keyManagementServiceClient.listCryptoKeyVersions(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -514,13 +737,28 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(CryptoKeyN *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String parent =
-   *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
-   *   for (CryptoKeyVersion element :
-   *       keyManagementServiceClient.listCryptoKeyVersions(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientListCryptoKeyVersions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListCryptoKeyVersions();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListCryptoKeyVersions() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String parent =
+   *           CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
+   *       for (CryptoKeyVersion element :
+   *           keyManagementServiceClient.listCryptoKeyVersions(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -542,21 +780,37 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(String par *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListCryptoKeyVersionsRequest request =
-   *       ListCryptoKeyVersionsRequest.newBuilder()
-   *           .setParent(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   for (CryptoKeyVersion element :
-   *       keyManagementServiceClient.listCryptoKeyVersions(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest;
+   *
+   * public class KeyManagementServiceClientListCryptoKeyVersions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListCryptoKeyVersions();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListCryptoKeyVersions() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListCryptoKeyVersionsRequest request =
+   *           ListCryptoKeyVersionsRequest.newBuilder()
+   *               .setParent(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       for (CryptoKeyVersion element :
+   *           keyManagementServiceClient.listCryptoKeyVersions(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -576,23 +830,40 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListCryptoKeyVersionsRequest request =
-   *       ListCryptoKeyVersionsRequest.newBuilder()
-   *           .setParent(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.listCryptoKeyVersionsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (CryptoKeyVersion element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest;
+   *
+   * public class KeyManagementServiceClientListCryptoKeyVersions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListCryptoKeyVersions();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListCryptoKeyVersions() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListCryptoKeyVersionsRequest request =
+   *           ListCryptoKeyVersionsRequest.newBuilder()
+   *               .setParent(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.listCryptoKeyVersionsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (CryptoKeyVersion element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -609,29 +880,47 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListCryptoKeyVersionsRequest request =
-   *       ListCryptoKeyVersionsRequest.newBuilder()
-   *           .setParent(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   while (true) {
-   *     ListCryptoKeyVersionsResponse response =
-   *         keyManagementServiceClient.listCryptoKeyVersionsCallable().call(request);
-   *     for (CryptoKeyVersion element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest;
+   * import com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse;
+   * import com.google.common.base.Strings;
+   *
+   * public class KeyManagementServiceClientListCryptoKeyVersions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListCryptoKeyVersions();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListCryptoKeyVersions() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListCryptoKeyVersionsRequest request =
+   *           ListCryptoKeyVersionsRequest.newBuilder()
+   *               .setParent(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       while (true) {
+   *         ListCryptoKeyVersionsResponse response =
+   *             keyManagementServiceClient.listCryptoKeyVersionsCallable().call(request);
+   *         for (CryptoKeyVersion element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -649,11 +938,26 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(
    * 

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
-   *   for (ImportJob element : keyManagementServiceClient.listImportJobs(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientListImportJobs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListImportJobs();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListImportJobs() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *       for (ImportJob element : keyManagementServiceClient.listImportJobs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -677,11 +981,26 @@ public final ListImportJobsPagedResponse listImportJobs(KeyRingName parent) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
-   *   for (ImportJob element : keyManagementServiceClient.listImportJobs(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientListImportJobs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListImportJobs();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListImportJobs() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
+   *       for (ImportJob element : keyManagementServiceClient.listImportJobs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -702,18 +1021,34 @@ public final ListImportJobsPagedResponse listImportJobs(String parent) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListImportJobsRequest request =
-   *       ListImportJobsRequest.newBuilder()
-   *           .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   for (ImportJob element : keyManagementServiceClient.listImportJobs(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   * import com.google.cloud.kms.v1.ListImportJobsRequest;
+   *
+   * public class KeyManagementServiceClientListImportJobs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListImportJobs();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListImportJobs() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListImportJobsRequest request =
+   *           ListImportJobsRequest.newBuilder()
+   *               .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       for (ImportJob element : keyManagementServiceClient.listImportJobs(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -732,21 +1067,38 @@ public final ListImportJobsPagedResponse listImportJobs(ListImportJobsRequest re *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListImportJobsRequest request =
-   *       ListImportJobsRequest.newBuilder()
-   *           .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.listImportJobsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (ImportJob element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   * import com.google.cloud.kms.v1.ListImportJobsRequest;
+   *
+   * public class KeyManagementServiceClientListImportJobs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListImportJobs();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListImportJobs() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListImportJobsRequest request =
+   *           ListImportJobsRequest.newBuilder()
+   *               .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.listImportJobsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (ImportJob element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -763,27 +1115,45 @@ public final ListImportJobsPagedResponse listImportJobs(ListImportJobsRequest re *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListImportJobsRequest request =
-   *       ListImportJobsRequest.newBuilder()
-   *           .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .build();
-   *   while (true) {
-   *     ListImportJobsResponse response =
-   *         keyManagementServiceClient.listImportJobsCallable().call(request);
-   *     for (ImportJob element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   * import com.google.cloud.kms.v1.ListImportJobsRequest;
+   * import com.google.cloud.kms.v1.ListImportJobsResponse;
+   * import com.google.common.base.Strings;
+   *
+   * public class KeyManagementServiceClientListImportJobs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListImportJobs();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListImportJobs() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListImportJobsRequest request =
+   *           ListImportJobsRequest.newBuilder()
+   *               .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .build();
+   *       while (true) {
+   *         ListImportJobsResponse response =
+   *             keyManagementServiceClient.listImportJobsCallable().call(request);
+   *         for (ImportJob element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -801,10 +1171,25 @@ public final ListImportJobsPagedResponse listImportJobs(ListImportJobsRequest re
    * 

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
-   *   KeyRing response = keyManagementServiceClient.getKeyRing(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientGetKeyRing {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetKeyRing();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetKeyRing() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *       KeyRing response = keyManagementServiceClient.getKeyRing(name);
+   *     }
+   *   }
    * }
    * }
* @@ -825,10 +1210,25 @@ public final KeyRing getKeyRing(KeyRingName name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
-   *   KeyRing response = keyManagementServiceClient.getKeyRing(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientGetKeyRing {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetKeyRing();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetKeyRing() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
+   *       KeyRing response = keyManagementServiceClient.getKeyRing(name);
+   *     }
+   *   }
    * }
    * }
* @@ -848,13 +1248,29 @@ public final KeyRing getKeyRing(String name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetKeyRingRequest request =
-   *       GetKeyRingRequest.newBuilder()
-   *           .setName(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .build();
-   *   KeyRing response = keyManagementServiceClient.getKeyRing(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.GetKeyRingRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientGetKeyRing {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetKeyRing();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetKeyRing() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetKeyRingRequest request =
+   *           GetKeyRingRequest.newBuilder()
+   *               .setName(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .build();
+   *       KeyRing response = keyManagementServiceClient.getKeyRing(request);
+   *     }
+   *   }
    * }
    * }
* @@ -872,16 +1288,33 @@ public final KeyRing getKeyRing(GetKeyRingRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetKeyRingRequest request =
-   *       GetKeyRingRequest.newBuilder()
-   *           .setName(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.getKeyRingCallable().futureCall(request);
-   *   // Do something.
-   *   KeyRing response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.GetKeyRingRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientGetKeyRing {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetKeyRing();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetKeyRing() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetKeyRingRequest request =
+   *           GetKeyRingRequest.newBuilder()
+   *               .setName(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.getKeyRingCallable().futureCall(request);
+   *       // Do something.
+   *       KeyRing response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -898,11 +1331,26 @@ public final UnaryCallable getKeyRingCallable() { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyName name =
-   *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
-   *   CryptoKey response = keyManagementServiceClient.getCryptoKey(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetCryptoKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetCryptoKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetCryptoKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyName name =
+   *           CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *       CryptoKey response = keyManagementServiceClient.getCryptoKey(name);
+   *     }
+   *   }
    * }
    * }
* @@ -925,11 +1373,26 @@ public final CryptoKey getCryptoKey(CryptoKeyName name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name =
-   *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
-   *   CryptoKey response = keyManagementServiceClient.getCryptoKey(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetCryptoKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetCryptoKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetCryptoKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name =
+   *           CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
+   *       CryptoKey response = keyManagementServiceClient.getCryptoKey(name);
+   *     }
+   *   }
    * }
    * }
* @@ -951,15 +1414,31 @@ public final CryptoKey getCryptoKey(String name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetCryptoKeyRequest request =
-   *       GetCryptoKeyRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .build();
-   *   CryptoKey response = keyManagementServiceClient.getCryptoKey(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.GetCryptoKeyRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetCryptoKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetCryptoKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetCryptoKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetCryptoKeyRequest request =
+   *           GetCryptoKeyRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .build();
+   *       CryptoKey response = keyManagementServiceClient.getCryptoKey(request);
+   *     }
+   *   }
    * }
    * }
* @@ -979,18 +1458,35 @@ public final CryptoKey getCryptoKey(GetCryptoKeyRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetCryptoKeyRequest request =
-   *       GetCryptoKeyRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.getCryptoKeyCallable().futureCall(request);
-   *   // Do something.
-   *   CryptoKey response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.GetCryptoKeyRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetCryptoKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetCryptoKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetCryptoKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetCryptoKeyRequest request =
+   *           GetCryptoKeyRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.getCryptoKeyCallable().futureCall(request);
+   *       // Do something.
+   *       CryptoKey response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1005,12 +1501,27 @@ public final UnaryCallable getCryptoKeyCallable( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyVersionName name =
-   *       CryptoKeyVersionName.of(
-   *           "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
-   *   CryptoKeyVersion response = keyManagementServiceClient.getCryptoKeyVersion(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyVersionName name =
+   *           CryptoKeyVersionName.of(
+   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *       CryptoKeyVersion response = keyManagementServiceClient.getCryptoKeyVersion(name);
+   *     }
+   *   }
    * }
    * }
* @@ -1033,13 +1544,28 @@ public final CryptoKeyVersion getCryptoKeyVersion(CryptoKeyVersionName name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name =
-   *       CryptoKeyVersionName.of(
-   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
-   *           .toString();
-   *   CryptoKeyVersion response = keyManagementServiceClient.getCryptoKeyVersion(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name =
+   *           CryptoKeyVersionName.of(
+   *                   "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
+   *               .toString();
+   *       CryptoKeyVersion response = keyManagementServiceClient.getCryptoKeyVersion(name);
+   *     }
+   *   }
    * }
    * }
* @@ -1060,20 +1586,36 @@ public final CryptoKeyVersion getCryptoKeyVersion(String name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetCryptoKeyVersionRequest request =
-   *       GetCryptoKeyVersionRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .build();
-   *   CryptoKeyVersion response = keyManagementServiceClient.getCryptoKeyVersion(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.GetCryptoKeyVersionRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetCryptoKeyVersionRequest request =
+   *           GetCryptoKeyVersionRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .build();
+   *       CryptoKeyVersion response = keyManagementServiceClient.getCryptoKeyVersion(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1091,23 +1633,40 @@ public final CryptoKeyVersion getCryptoKeyVersion(GetCryptoKeyVersionRequest req *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetCryptoKeyVersionRequest request =
-   *       GetCryptoKeyVersionRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.getCryptoKeyVersionCallable().futureCall(request);
-   *   // Do something.
-   *   CryptoKeyVersion response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.GetCryptoKeyVersionRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetCryptoKeyVersionRequest request =
+   *           GetCryptoKeyVersionRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.getCryptoKeyVersionCallable().futureCall(request);
+   *       // Do something.
+   *       CryptoKeyVersion response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1126,12 +1685,27 @@ public final CryptoKeyVersion getCryptoKeyVersion(GetCryptoKeyVersionRequest req *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyVersionName name =
-   *       CryptoKeyVersionName.of(
-   *           "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
-   *   PublicKey response = keyManagementServiceClient.getPublicKey(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.PublicKey;
+   *
+   * public class KeyManagementServiceClientGetPublicKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetPublicKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetPublicKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyVersionName name =
+   *           CryptoKeyVersionName.of(
+   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *       PublicKey response = keyManagementServiceClient.getPublicKey(name);
+   *     }
+   *   }
    * }
    * }
* @@ -1155,13 +1729,28 @@ public final PublicKey getPublicKey(CryptoKeyVersionName name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name =
-   *       CryptoKeyVersionName.of(
-   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
-   *           .toString();
-   *   PublicKey response = keyManagementServiceClient.getPublicKey(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.PublicKey;
+   *
+   * public class KeyManagementServiceClientGetPublicKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetPublicKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetPublicKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name =
+   *           CryptoKeyVersionName.of(
+   *                   "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
+   *               .toString();
+   *       PublicKey response = keyManagementServiceClient.getPublicKey(name);
+   *     }
+   *   }
    * }
    * }
* @@ -1184,20 +1773,36 @@ public final PublicKey getPublicKey(String name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetPublicKeyRequest request =
-   *       GetPublicKeyRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .build();
-   *   PublicKey response = keyManagementServiceClient.getPublicKey(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.GetPublicKeyRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.PublicKey;
+   *
+   * public class KeyManagementServiceClientGetPublicKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetPublicKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetPublicKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetPublicKeyRequest request =
+   *           GetPublicKeyRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .build();
+   *       PublicKey response = keyManagementServiceClient.getPublicKey(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1218,23 +1823,40 @@ public final PublicKey getPublicKey(GetPublicKeyRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetPublicKeyRequest request =
-   *       GetPublicKeyRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.getPublicKeyCallable().futureCall(request);
-   *   // Do something.
-   *   PublicKey response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.GetPublicKeyRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.PublicKey;
+   *
+   * public class KeyManagementServiceClientGetPublicKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetPublicKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetPublicKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetPublicKeyRequest request =
+   *           GetPublicKeyRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.getPublicKeyCallable().futureCall(request);
+   *       // Do something.
+   *       PublicKey response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1249,11 +1871,26 @@ public final UnaryCallable getPublicKeyCallable( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ImportJobName name =
-   *       ImportJobName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]");
-   *   ImportJob response = keyManagementServiceClient.getImportJob(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.ImportJobName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetImportJob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetImportJob();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetImportJob() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ImportJobName name =
+   *           ImportJobName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]");
+   *       ImportJob response = keyManagementServiceClient.getImportJob(name);
+   *     }
+   *   }
    * }
    * }
* @@ -1274,11 +1911,26 @@ public final ImportJob getImportJob(ImportJobName name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name =
-   *       ImportJobName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]").toString();
-   *   ImportJob response = keyManagementServiceClient.getImportJob(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.ImportJobName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetImportJob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetImportJob();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetImportJob() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name =
+   *           ImportJobName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]").toString();
+   *       ImportJob response = keyManagementServiceClient.getImportJob(name);
+   *     }
+   *   }
    * }
    * }
* @@ -1298,15 +1950,31 @@ public final ImportJob getImportJob(String name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetImportJobRequest request =
-   *       GetImportJobRequest.newBuilder()
-   *           .setName(
-   *               ImportJobName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]")
-   *                   .toString())
-   *           .build();
-   *   ImportJob response = keyManagementServiceClient.getImportJob(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.GetImportJobRequest;
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.ImportJobName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetImportJob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetImportJob();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetImportJob() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetImportJobRequest request =
+   *           GetImportJobRequest.newBuilder()
+   *               .setName(
+   *                   ImportJobName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]")
+   *                       .toString())
+   *               .build();
+   *       ImportJob response = keyManagementServiceClient.getImportJob(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1324,18 +1992,35 @@ public final ImportJob getImportJob(GetImportJobRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetImportJobRequest request =
-   *       GetImportJobRequest.newBuilder()
-   *           .setName(
-   *               ImportJobName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.getImportJobCallable().futureCall(request);
-   *   // Do something.
-   *   ImportJob response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.GetImportJobRequest;
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.ImportJobName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientGetImportJob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetImportJob();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetImportJob() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetImportJobRequest request =
+   *           GetImportJobRequest.newBuilder()
+   *               .setName(
+   *                   ImportJobName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.getImportJobCallable().futureCall(request);
+   *       // Do something.
+   *       ImportJob response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1350,12 +2035,27 @@ public final UnaryCallable getImportJobCallable( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   String keyRingId = "keyRingId-2027180374";
-   *   KeyRing keyRing = KeyRing.newBuilder().build();
-   *   KeyRing response = keyManagementServiceClient.createKeyRing(parent, keyRingId, keyRing);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.LocationName;
+   *
+   * public class KeyManagementServiceClientCreateKeyRing {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateKeyRing();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateKeyRing() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *       String keyRingId = "keyRingId-2027180374";
+   *       KeyRing keyRing = KeyRing.newBuilder().build();
+   *       KeyRing response = keyManagementServiceClient.createKeyRing(parent, keyRingId, keyRing);
+   *     }
+   *   }
    * }
    * }
* @@ -1383,12 +2083,27 @@ public final KeyRing createKeyRing(LocationName parent, String keyRingId, KeyRin *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
-   *   String keyRingId = "keyRingId-2027180374";
-   *   KeyRing keyRing = KeyRing.newBuilder().build();
-   *   KeyRing response = keyManagementServiceClient.createKeyRing(parent, keyRingId, keyRing);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.LocationName;
+   *
+   * public class KeyManagementServiceClientCreateKeyRing {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateKeyRing();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateKeyRing() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *       String keyRingId = "keyRingId-2027180374";
+   *       KeyRing keyRing = KeyRing.newBuilder().build();
+   *       KeyRing response = keyManagementServiceClient.createKeyRing(parent, keyRingId, keyRing);
+   *     }
+   *   }
    * }
    * }
* @@ -1416,15 +2131,31 @@ public final KeyRing createKeyRing(String parent, String keyRingId, KeyRing keyR *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CreateKeyRingRequest request =
-   *       CreateKeyRingRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setKeyRingId("keyRingId-2027180374")
-   *           .setKeyRing(KeyRing.newBuilder().build())
-   *           .build();
-   *   KeyRing response = keyManagementServiceClient.createKeyRing(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CreateKeyRingRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.LocationName;
+   *
+   * public class KeyManagementServiceClientCreateKeyRing {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateKeyRing();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateKeyRing() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CreateKeyRingRequest request =
+   *           CreateKeyRingRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setKeyRingId("keyRingId-2027180374")
+   *               .setKeyRing(KeyRing.newBuilder().build())
+   *               .build();
+   *       KeyRing response = keyManagementServiceClient.createKeyRing(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1442,18 +2173,35 @@ public final KeyRing createKeyRing(CreateKeyRingRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CreateKeyRingRequest request =
-   *       CreateKeyRingRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setKeyRingId("keyRingId-2027180374")
-   *           .setKeyRing(KeyRing.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.createKeyRingCallable().futureCall(request);
-   *   // Do something.
-   *   KeyRing response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CreateKeyRingRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRing;
+   * import com.google.cloud.kms.v1.LocationName;
+   *
+   * public class KeyManagementServiceClientCreateKeyRing {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateKeyRing();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateKeyRing() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CreateKeyRingRequest request =
+   *           CreateKeyRingRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setKeyRingId("keyRingId-2027180374")
+   *               .setKeyRing(KeyRing.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.createKeyRingCallable().futureCall(request);
+   *       // Do something.
+   *       KeyRing response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1473,13 +2221,28 @@ public final UnaryCallable createKeyRingCallable( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
-   *   String cryptoKeyId = "cryptoKeyId-1643185255";
-   *   CryptoKey cryptoKey = CryptoKey.newBuilder().build();
-   *   CryptoKey response =
-   *       keyManagementServiceClient.createCryptoKey(parent, cryptoKeyId, cryptoKey);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientCreateCryptoKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateCryptoKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateCryptoKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *       String cryptoKeyId = "cryptoKeyId-1643185255";
+   *       CryptoKey cryptoKey = CryptoKey.newBuilder().build();
+   *       CryptoKey response =
+   *           keyManagementServiceClient.createCryptoKey(parent, cryptoKeyId, cryptoKey);
+   *     }
+   *   }
    * }
    * }
* @@ -1514,13 +2277,28 @@ public final CryptoKey createCryptoKey( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
-   *   String cryptoKeyId = "cryptoKeyId-1643185255";
-   *   CryptoKey cryptoKey = CryptoKey.newBuilder().build();
-   *   CryptoKey response =
-   *       keyManagementServiceClient.createCryptoKey(parent, cryptoKeyId, cryptoKey);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientCreateCryptoKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateCryptoKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateCryptoKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
+   *       String cryptoKeyId = "cryptoKeyId-1643185255";
+   *       CryptoKey cryptoKey = CryptoKey.newBuilder().build();
+   *       CryptoKey response =
+   *           keyManagementServiceClient.createCryptoKey(parent, cryptoKeyId, cryptoKey);
+   *     }
+   *   }
    * }
    * }
* @@ -1554,16 +2332,32 @@ public final CryptoKey createCryptoKey(String parent, String cryptoKeyId, Crypto *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CreateCryptoKeyRequest request =
-   *       CreateCryptoKeyRequest.newBuilder()
-   *           .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .setCryptoKeyId("cryptoKeyId-1643185255")
-   *           .setCryptoKey(CryptoKey.newBuilder().build())
-   *           .setSkipInitialVersionCreation(true)
-   *           .build();
-   *   CryptoKey response = keyManagementServiceClient.createCryptoKey(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CreateCryptoKeyRequest;
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientCreateCryptoKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateCryptoKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateCryptoKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CreateCryptoKeyRequest request =
+   *           CreateCryptoKeyRequest.newBuilder()
+   *               .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .setCryptoKeyId("cryptoKeyId-1643185255")
+   *               .setCryptoKey(CryptoKey.newBuilder().build())
+   *               .setSkipInitialVersionCreation(true)
+   *               .build();
+   *       CryptoKey response = keyManagementServiceClient.createCryptoKey(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1586,19 +2380,36 @@ public final CryptoKey createCryptoKey(CreateCryptoKeyRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CreateCryptoKeyRequest request =
-   *       CreateCryptoKeyRequest.newBuilder()
-   *           .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .setCryptoKeyId("cryptoKeyId-1643185255")
-   *           .setCryptoKey(CryptoKey.newBuilder().build())
-   *           .setSkipInitialVersionCreation(true)
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.createCryptoKeyCallable().futureCall(request);
-   *   // Do something.
-   *   CryptoKey response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CreateCryptoKeyRequest;
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientCreateCryptoKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateCryptoKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateCryptoKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CreateCryptoKeyRequest request =
+   *           CreateCryptoKeyRequest.newBuilder()
+   *               .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .setCryptoKeyId("cryptoKeyId-1643185255")
+   *               .setCryptoKey(CryptoKey.newBuilder().build())
+   *               .setSkipInitialVersionCreation(true)
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.createCryptoKeyCallable().futureCall(request);
+   *       // Do something.
+   *       CryptoKey response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1618,13 +2429,28 @@ public final UnaryCallable createCryptoKeyCal *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyName parent =
-   *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
-   *   CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
-   *   CryptoKeyVersion response =
-   *       keyManagementServiceClient.createCryptoKeyVersion(parent, cryptoKeyVersion);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientCreateCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyName parent =
+   *           CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *       CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
+   *       CryptoKeyVersion response =
+   *           keyManagementServiceClient.createCryptoKeyVersion(parent, cryptoKeyVersion);
+   *     }
+   *   }
    * }
    * }
* @@ -1657,13 +2483,28 @@ public final CryptoKeyVersion createCryptoKeyVersion( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String parent =
-   *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
-   *   CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
-   *   CryptoKeyVersion response =
-   *       keyManagementServiceClient.createCryptoKeyVersion(parent, cryptoKeyVersion);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientCreateCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String parent =
+   *           CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
+   *       CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
+   *       CryptoKeyVersion response =
+   *           keyManagementServiceClient.createCryptoKeyVersion(parent, cryptoKeyVersion);
+   *     }
+   *   }
    * }
    * }
* @@ -1696,16 +2537,32 @@ public final CryptoKeyVersion createCryptoKeyVersion( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CreateCryptoKeyVersionRequest request =
-   *       CreateCryptoKeyVersionRequest.newBuilder()
-   *           .setParent(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setCryptoKeyVersion(CryptoKeyVersion.newBuilder().build())
-   *           .build();
-   *   CryptoKeyVersion response = keyManagementServiceClient.createCryptoKeyVersion(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientCreateCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CreateCryptoKeyVersionRequest request =
+   *           CreateCryptoKeyVersionRequest.newBuilder()
+   *               .setParent(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setCryptoKeyVersion(CryptoKeyVersion.newBuilder().build())
+   *               .build();
+   *       CryptoKeyVersion response = keyManagementServiceClient.createCryptoKeyVersion(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1728,19 +2585,36 @@ public final CryptoKeyVersion createCryptoKeyVersion(CreateCryptoKeyVersionReque *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CreateCryptoKeyVersionRequest request =
-   *       CreateCryptoKeyVersionRequest.newBuilder()
-   *           .setParent(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setCryptoKeyVersion(CryptoKeyVersion.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.createCryptoKeyVersionCallable().futureCall(request);
-   *   // Do something.
-   *   CryptoKeyVersion response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientCreateCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CreateCryptoKeyVersionRequest request =
+   *           CreateCryptoKeyVersionRequest.newBuilder()
+   *               .setParent(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setCryptoKeyVersion(CryptoKeyVersion.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.createCryptoKeyVersionCallable().futureCall(request);
+   *       // Do something.
+   *       CryptoKeyVersion response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1761,16 +2635,32 @@ public final CryptoKeyVersion createCryptoKeyVersion(CreateCryptoKeyVersionReque *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ImportCryptoKeyVersionRequest request =
-   *       ImportCryptoKeyVersionRequest.newBuilder()
-   *           .setParent(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setImportJob("importJob-208547368")
-   *           .build();
-   *   CryptoKeyVersion response = keyManagementServiceClient.importCryptoKeyVersion(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientImportCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientImportCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientImportCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ImportCryptoKeyVersionRequest request =
+   *           ImportCryptoKeyVersionRequest.newBuilder()
+   *               .setParent(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setImportJob("importJob-208547368")
+   *               .build();
+   *       CryptoKeyVersion response = keyManagementServiceClient.importCryptoKeyVersion(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1793,19 +2683,36 @@ public final CryptoKeyVersion importCryptoKeyVersion(ImportCryptoKeyVersionReque *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ImportCryptoKeyVersionRequest request =
-   *       ImportCryptoKeyVersionRequest.newBuilder()
-   *           .setParent(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setImportJob("importJob-208547368")
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.importCryptoKeyVersionCallable().futureCall(request);
-   *   // Do something.
-   *   CryptoKeyVersion response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientImportCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientImportCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientImportCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ImportCryptoKeyVersionRequest request =
+   *           ImportCryptoKeyVersionRequest.newBuilder()
+   *               .setParent(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setImportJob("importJob-208547368")
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.importCryptoKeyVersionCallable().futureCall(request);
+   *       // Do something.
+   *       CryptoKeyVersion response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1824,13 +2731,28 @@ public final CryptoKeyVersion importCryptoKeyVersion(ImportCryptoKeyVersionReque *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
-   *   String importJobId = "importJobId1449444627";
-   *   ImportJob importJob = ImportJob.newBuilder().build();
-   *   ImportJob response =
-   *       keyManagementServiceClient.createImportJob(parent, importJobId, importJob);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientCreateImportJob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateImportJob();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateImportJob() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *       String importJobId = "importJobId1449444627";
+   *       ImportJob importJob = ImportJob.newBuilder().build();
+   *       ImportJob response =
+   *           keyManagementServiceClient.createImportJob(parent, importJobId, importJob);
+   *     }
+   *   }
    * }
    * }
* @@ -1864,13 +2786,28 @@ public final ImportJob createImportJob( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
-   *   String importJobId = "importJobId1449444627";
-   *   ImportJob importJob = ImportJob.newBuilder().build();
-   *   ImportJob response =
-   *       keyManagementServiceClient.createImportJob(parent, importJobId, importJob);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientCreateImportJob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateImportJob();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateImportJob() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
+   *       String importJobId = "importJobId1449444627";
+   *       ImportJob importJob = ImportJob.newBuilder().build();
+   *       ImportJob response =
+   *           keyManagementServiceClient.createImportJob(parent, importJobId, importJob);
+   *     }
+   *   }
    * }
    * }
* @@ -1903,15 +2840,31 @@ public final ImportJob createImportJob(String parent, String importJobId, Import *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CreateImportJobRequest request =
-   *       CreateImportJobRequest.newBuilder()
-   *           .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .setImportJobId("importJobId1449444627")
-   *           .setImportJob(ImportJob.newBuilder().build())
-   *           .build();
-   *   ImportJob response = keyManagementServiceClient.createImportJob(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CreateImportJobRequest;
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientCreateImportJob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateImportJob();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateImportJob() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CreateImportJobRequest request =
+   *           CreateImportJobRequest.newBuilder()
+   *               .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .setImportJobId("importJobId1449444627")
+   *               .setImportJob(ImportJob.newBuilder().build())
+   *               .build();
+   *       ImportJob response = keyManagementServiceClient.createImportJob(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1932,18 +2885,35 @@ public final ImportJob createImportJob(CreateImportJobRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CreateImportJobRequest request =
-   *       CreateImportJobRequest.newBuilder()
-   *           .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
-   *           .setImportJobId("importJobId1449444627")
-   *           .setImportJob(ImportJob.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.createImportJobCallable().futureCall(request);
-   *   // Do something.
-   *   ImportJob response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CreateImportJobRequest;
+   * import com.google.cloud.kms.v1.ImportJob;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.KeyRingName;
+   *
+   * public class KeyManagementServiceClientCreateImportJob {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientCreateImportJob();
+   *   }
+   *
+   *   public static void keyManagementServiceClientCreateImportJob() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CreateImportJobRequest request =
+   *           CreateImportJobRequest.newBuilder()
+   *               .setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString())
+   *               .setImportJobId("importJobId1449444627")
+   *               .setImportJob(ImportJob.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.createImportJobCallable().futureCall(request);
+   *       // Do something.
+   *       ImportJob response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1958,11 +2928,26 @@ public final UnaryCallable createImportJobCal *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKey cryptoKey = CryptoKey.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   CryptoKey response = keyManagementServiceClient.updateCryptoKey(cryptoKey, updateMask);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class KeyManagementServiceClientUpdateCryptoKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientUpdateCryptoKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientUpdateCryptoKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKey cryptoKey = CryptoKey.newBuilder().build();
+   *       FieldMask updateMask = FieldMask.newBuilder().build();
+   *       CryptoKey response = keyManagementServiceClient.updateCryptoKey(cryptoKey, updateMask);
+   *     }
+   *   }
    * }
    * }
* @@ -1986,14 +2971,30 @@ public final CryptoKey updateCryptoKey(CryptoKey cryptoKey, FieldMask updateMask *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   UpdateCryptoKeyRequest request =
-   *       UpdateCryptoKeyRequest.newBuilder()
-   *           .setCryptoKey(CryptoKey.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   CryptoKey response = keyManagementServiceClient.updateCryptoKey(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.UpdateCryptoKeyRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class KeyManagementServiceClientUpdateCryptoKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientUpdateCryptoKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientUpdateCryptoKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       UpdateCryptoKeyRequest request =
+   *           UpdateCryptoKeyRequest.newBuilder()
+   *               .setCryptoKey(CryptoKey.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       CryptoKey response = keyManagementServiceClient.updateCryptoKey(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2011,17 +3012,34 @@ public final CryptoKey updateCryptoKey(UpdateCryptoKeyRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   UpdateCryptoKeyRequest request =
-   *       UpdateCryptoKeyRequest.newBuilder()
-   *           .setCryptoKey(CryptoKey.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.updateCryptoKeyCallable().futureCall(request);
-   *   // Do something.
-   *   CryptoKey response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.UpdateCryptoKeyRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class KeyManagementServiceClientUpdateCryptoKey {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientUpdateCryptoKey();
+   *   }
+   *
+   *   public static void keyManagementServiceClientUpdateCryptoKey() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       UpdateCryptoKeyRequest request =
+   *           UpdateCryptoKeyRequest.newBuilder()
+   *               .setCryptoKey(CryptoKey.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.updateCryptoKeyCallable().futureCall(request);
+   *       // Do something.
+   *       CryptoKey response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2044,12 +3062,27 @@ public final UnaryCallable updateCryptoKeyCal *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   CryptoKeyVersion response =
-   *       keyManagementServiceClient.updateCryptoKeyVersion(cryptoKeyVersion, updateMask);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class KeyManagementServiceClientUpdateCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientUpdateCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientUpdateCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
+   *       FieldMask updateMask = FieldMask.newBuilder().build();
+   *       CryptoKeyVersion response =
+   *           keyManagementServiceClient.updateCryptoKeyVersion(cryptoKeyVersion, updateMask);
+   *     }
+   *   }
    * }
    * }
* @@ -2083,14 +3116,30 @@ public final CryptoKeyVersion updateCryptoKeyVersion( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   UpdateCryptoKeyVersionRequest request =
-   *       UpdateCryptoKeyVersionRequest.newBuilder()
-   *           .setCryptoKeyVersion(CryptoKeyVersion.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   CryptoKeyVersion response = keyManagementServiceClient.updateCryptoKeyVersion(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class KeyManagementServiceClientUpdateCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientUpdateCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientUpdateCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       UpdateCryptoKeyVersionRequest request =
+   *           UpdateCryptoKeyVersionRequest.newBuilder()
+   *               .setCryptoKeyVersion(CryptoKeyVersion.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       CryptoKeyVersion response = keyManagementServiceClient.updateCryptoKeyVersion(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2116,17 +3165,34 @@ public final CryptoKeyVersion updateCryptoKeyVersion(UpdateCryptoKeyVersionReque *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   UpdateCryptoKeyVersionRequest request =
-   *       UpdateCryptoKeyVersionRequest.newBuilder()
-   *           .setCryptoKeyVersion(CryptoKeyVersion.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.updateCryptoKeyVersionCallable().futureCall(request);
-   *   // Do something.
-   *   CryptoKeyVersion response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class KeyManagementServiceClientUpdateCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientUpdateCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientUpdateCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       UpdateCryptoKeyVersionRequest request =
+   *           UpdateCryptoKeyVersionRequest.newBuilder()
+   *               .setCryptoKeyVersion(CryptoKeyVersion.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.updateCryptoKeyVersionCallable().futureCall(request);
+   *       // Do something.
+   *       CryptoKeyVersion response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2145,11 +3211,28 @@ public final CryptoKeyVersion updateCryptoKeyVersion(UpdateCryptoKeyVersionReque *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ResourceName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
-   *   ByteString plaintext = ByteString.EMPTY;
-   *   EncryptResponse response = keyManagementServiceClient.encrypt(name, plaintext);
+   * package com.google.example;
+   *
+   * import com.google.api.resourcenames.ResourceName;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.EncryptResponse;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   *
+   * public class KeyManagementServiceClientEncrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientEncrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientEncrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ResourceName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *       ByteString plaintext = ByteString.EMPTY;
+   *       EncryptResponse response = keyManagementServiceClient.encrypt(name, plaintext);
+   *     }
+   *   }
    * }
    * }
* @@ -2185,12 +3268,28 @@ public final EncryptResponse encrypt(ResourceName name, ByteString plaintext) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name =
-   *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
-   *   ByteString plaintext = ByteString.EMPTY;
-   *   EncryptResponse response = keyManagementServiceClient.encrypt(name, plaintext);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.EncryptResponse;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   *
+   * public class KeyManagementServiceClientEncrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientEncrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientEncrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name =
+   *           CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
+   *       ByteString plaintext = ByteString.EMPTY;
+   *       EncryptResponse response = keyManagementServiceClient.encrypt(name, plaintext);
+   *     }
+   *   }
    * }
    * }
* @@ -2223,19 +3322,37 @@ public final EncryptResponse encrypt(String name, ByteString plaintext) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   EncryptRequest request =
-   *       EncryptRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setPlaintext(ByteString.EMPTY)
-   *           .setAdditionalAuthenticatedData(ByteString.EMPTY)
-   *           .setPlaintextCrc32C(Int64Value.newBuilder().build())
-   *           .setAdditionalAuthenticatedDataCrc32C(Int64Value.newBuilder().build())
-   *           .build();
-   *   EncryptResponse response = keyManagementServiceClient.encrypt(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.EncryptRequest;
+   * import com.google.cloud.kms.v1.EncryptResponse;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   * import com.google.protobuf.Int64Value;
+   *
+   * public class KeyManagementServiceClientEncrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientEncrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientEncrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       EncryptRequest request =
+   *           EncryptRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setPlaintext(ByteString.EMPTY)
+   *               .setAdditionalAuthenticatedData(ByteString.EMPTY)
+   *               .setPlaintextCrc32C(Int64Value.newBuilder().build())
+   *               .setAdditionalAuthenticatedDataCrc32C(Int64Value.newBuilder().build())
+   *               .build();
+   *       EncryptResponse response = keyManagementServiceClient.encrypt(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2256,22 +3373,41 @@ public final EncryptResponse encrypt(EncryptRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   EncryptRequest request =
-   *       EncryptRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setPlaintext(ByteString.EMPTY)
-   *           .setAdditionalAuthenticatedData(ByteString.EMPTY)
-   *           .setPlaintextCrc32C(Int64Value.newBuilder().build())
-   *           .setAdditionalAuthenticatedDataCrc32C(Int64Value.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.encryptCallable().futureCall(request);
-   *   // Do something.
-   *   EncryptResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.EncryptRequest;
+   * import com.google.cloud.kms.v1.EncryptResponse;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   * import com.google.protobuf.Int64Value;
+   *
+   * public class KeyManagementServiceClientEncrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientEncrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientEncrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       EncryptRequest request =
+   *           EncryptRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setPlaintext(ByteString.EMPTY)
+   *               .setAdditionalAuthenticatedData(ByteString.EMPTY)
+   *               .setPlaintextCrc32C(Int64Value.newBuilder().build())
+   *               .setAdditionalAuthenticatedDataCrc32C(Int64Value.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.encryptCallable().futureCall(request);
+   *       // Do something.
+   *       EncryptResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2289,12 +3425,28 @@ public final UnaryCallable encryptCallable() { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyName name =
-   *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
-   *   ByteString ciphertext = ByteString.EMPTY;
-   *   DecryptResponse response = keyManagementServiceClient.decrypt(name, ciphertext);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.DecryptResponse;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   *
+   * public class KeyManagementServiceClientDecrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientDecrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientDecrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyName name =
+   *           CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *       ByteString ciphertext = ByteString.EMPTY;
+   *       DecryptResponse response = keyManagementServiceClient.decrypt(name, ciphertext);
+   *     }
+   *   }
    * }
    * }
* @@ -2323,12 +3475,28 @@ public final DecryptResponse decrypt(CryptoKeyName name, ByteString ciphertext) *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name =
-   *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
-   *   ByteString ciphertext = ByteString.EMPTY;
-   *   DecryptResponse response = keyManagementServiceClient.decrypt(name, ciphertext);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.DecryptResponse;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   *
+   * public class KeyManagementServiceClientDecrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientDecrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientDecrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name =
+   *           CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
+   *       ByteString ciphertext = ByteString.EMPTY;
+   *       DecryptResponse response = keyManagementServiceClient.decrypt(name, ciphertext);
+   *     }
+   *   }
    * }
    * }
* @@ -2354,19 +3522,37 @@ public final DecryptResponse decrypt(String name, ByteString ciphertext) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   DecryptRequest request =
-   *       DecryptRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setCiphertext(ByteString.EMPTY)
-   *           .setAdditionalAuthenticatedData(ByteString.EMPTY)
-   *           .setCiphertextCrc32C(Int64Value.newBuilder().build())
-   *           .setAdditionalAuthenticatedDataCrc32C(Int64Value.newBuilder().build())
-   *           .build();
-   *   DecryptResponse response = keyManagementServiceClient.decrypt(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.DecryptRequest;
+   * import com.google.cloud.kms.v1.DecryptResponse;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   * import com.google.protobuf.Int64Value;
+   *
+   * public class KeyManagementServiceClientDecrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientDecrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientDecrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       DecryptRequest request =
+   *           DecryptRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setCiphertext(ByteString.EMPTY)
+   *               .setAdditionalAuthenticatedData(ByteString.EMPTY)
+   *               .setCiphertextCrc32C(Int64Value.newBuilder().build())
+   *               .setAdditionalAuthenticatedDataCrc32C(Int64Value.newBuilder().build())
+   *               .build();
+   *       DecryptResponse response = keyManagementServiceClient.decrypt(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2387,22 +3573,41 @@ public final DecryptResponse decrypt(DecryptRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   DecryptRequest request =
-   *       DecryptRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setCiphertext(ByteString.EMPTY)
-   *           .setAdditionalAuthenticatedData(ByteString.EMPTY)
-   *           .setCiphertextCrc32C(Int64Value.newBuilder().build())
-   *           .setAdditionalAuthenticatedDataCrc32C(Int64Value.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.decryptCallable().futureCall(request);
-   *   // Do something.
-   *   DecryptResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.DecryptRequest;
+   * import com.google.cloud.kms.v1.DecryptResponse;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   * import com.google.protobuf.Int64Value;
+   *
+   * public class KeyManagementServiceClientDecrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientDecrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientDecrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       DecryptRequest request =
+   *           DecryptRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setCiphertext(ByteString.EMPTY)
+   *               .setAdditionalAuthenticatedData(ByteString.EMPTY)
+   *               .setCiphertextCrc32C(Int64Value.newBuilder().build())
+   *               .setAdditionalAuthenticatedDataCrc32C(Int64Value.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.decryptCallable().futureCall(request);
+   *       // Do something.
+   *       DecryptResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2420,13 +3625,29 @@ public final UnaryCallable decryptCallable() { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyVersionName name =
-   *       CryptoKeyVersionName.of(
-   *           "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
-   *   Digest digest = Digest.newBuilder().build();
-   *   AsymmetricSignResponse response = keyManagementServiceClient.asymmetricSign(name, digest);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.AsymmetricSignResponse;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.Digest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientAsymmetricSign {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientAsymmetricSign();
+   *   }
+   *
+   *   public static void keyManagementServiceClientAsymmetricSign() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyVersionName name =
+   *           CryptoKeyVersionName.of(
+   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *       Digest digest = Digest.newBuilder().build();
+   *       AsymmetricSignResponse response = keyManagementServiceClient.asymmetricSign(name, digest);
+   *     }
+   *   }
    * }
    * }
* @@ -2456,14 +3677,30 @@ public final AsymmetricSignResponse asymmetricSign(CryptoKeyVersionName name, Di *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name =
-   *       CryptoKeyVersionName.of(
-   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
-   *           .toString();
-   *   Digest digest = Digest.newBuilder().build();
-   *   AsymmetricSignResponse response = keyManagementServiceClient.asymmetricSign(name, digest);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.AsymmetricSignResponse;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.Digest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientAsymmetricSign {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientAsymmetricSign();
+   *   }
+   *
+   *   public static void keyManagementServiceClientAsymmetricSign() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name =
+   *           CryptoKeyVersionName.of(
+   *                   "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
+   *               .toString();
+   *       Digest digest = Digest.newBuilder().build();
+   *       AsymmetricSignResponse response = keyManagementServiceClient.asymmetricSign(name, digest);
+   *     }
+   *   }
    * }
    * }
* @@ -2490,22 +3727,40 @@ public final AsymmetricSignResponse asymmetricSign(String name, Digest digest) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   AsymmetricSignRequest request =
-   *       AsymmetricSignRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .setDigest(Digest.newBuilder().build())
-   *           .setDigestCrc32C(Int64Value.newBuilder().build())
-   *           .build();
-   *   AsymmetricSignResponse response = keyManagementServiceClient.asymmetricSign(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.AsymmetricSignRequest;
+   * import com.google.cloud.kms.v1.AsymmetricSignResponse;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.Digest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.Int64Value;
+   *
+   * public class KeyManagementServiceClientAsymmetricSign {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientAsymmetricSign();
+   *   }
+   *
+   *   public static void keyManagementServiceClientAsymmetricSign() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       AsymmetricSignRequest request =
+   *           AsymmetricSignRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .setDigest(Digest.newBuilder().build())
+   *               .setDigestCrc32C(Int64Value.newBuilder().build())
+   *               .build();
+   *       AsymmetricSignResponse response = keyManagementServiceClient.asymmetricSign(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2526,25 +3781,44 @@ public final AsymmetricSignResponse asymmetricSign(AsymmetricSignRequest request *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   AsymmetricSignRequest request =
-   *       AsymmetricSignRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .setDigest(Digest.newBuilder().build())
-   *           .setDigestCrc32C(Int64Value.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.asymmetricSignCallable().futureCall(request);
-   *   // Do something.
-   *   AsymmetricSignResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.AsymmetricSignRequest;
+   * import com.google.cloud.kms.v1.AsymmetricSignResponse;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.Digest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.Int64Value;
+   *
+   * public class KeyManagementServiceClientAsymmetricSign {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientAsymmetricSign();
+   *   }
+   *
+   *   public static void keyManagementServiceClientAsymmetricSign() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       AsymmetricSignRequest request =
+   *           AsymmetricSignRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .setDigest(Digest.newBuilder().build())
+   *               .setDigestCrc32C(Int64Value.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.asymmetricSignCallable().futureCall(request);
+   *       // Do something.
+   *       AsymmetricSignResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2563,14 +3837,30 @@ public final AsymmetricSignResponse asymmetricSign(AsymmetricSignRequest request *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyVersionName name =
-   *       CryptoKeyVersionName.of(
-   *           "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
-   *   ByteString ciphertext = ByteString.EMPTY;
-   *   AsymmetricDecryptResponse response =
-   *       keyManagementServiceClient.asymmetricDecrypt(name, ciphertext);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.AsymmetricDecryptResponse;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   *
+   * public class KeyManagementServiceClientAsymmetricDecrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientAsymmetricDecrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientAsymmetricDecrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyVersionName name =
+   *           CryptoKeyVersionName.of(
+   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *       ByteString ciphertext = ByteString.EMPTY;
+   *       AsymmetricDecryptResponse response =
+   *           keyManagementServiceClient.asymmetricDecrypt(name, ciphertext);
+   *     }
+   *   }
    * }
    * }
* @@ -2600,15 +3890,31 @@ public final AsymmetricDecryptResponse asymmetricDecrypt( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name =
-   *       CryptoKeyVersionName.of(
-   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
-   *           .toString();
-   *   ByteString ciphertext = ByteString.EMPTY;
-   *   AsymmetricDecryptResponse response =
-   *       keyManagementServiceClient.asymmetricDecrypt(name, ciphertext);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.AsymmetricDecryptResponse;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   *
+   * public class KeyManagementServiceClientAsymmetricDecrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientAsymmetricDecrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientAsymmetricDecrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name =
+   *           CryptoKeyVersionName.of(
+   *                   "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
+   *               .toString();
+   *       ByteString ciphertext = ByteString.EMPTY;
+   *       AsymmetricDecryptResponse response =
+   *           keyManagementServiceClient.asymmetricDecrypt(name, ciphertext);
+   *     }
+   *   }
    * }
    * }
* @@ -2634,22 +3940,40 @@ public final AsymmetricDecryptResponse asymmetricDecrypt(String name, ByteString *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   AsymmetricDecryptRequest request =
-   *       AsymmetricDecryptRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .setCiphertext(ByteString.EMPTY)
-   *           .setCiphertextCrc32C(Int64Value.newBuilder().build())
-   *           .build();
-   *   AsymmetricDecryptResponse response = keyManagementServiceClient.asymmetricDecrypt(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.AsymmetricDecryptRequest;
+   * import com.google.cloud.kms.v1.AsymmetricDecryptResponse;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   * import com.google.protobuf.Int64Value;
+   *
+   * public class KeyManagementServiceClientAsymmetricDecrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientAsymmetricDecrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientAsymmetricDecrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       AsymmetricDecryptRequest request =
+   *           AsymmetricDecryptRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .setCiphertext(ByteString.EMPTY)
+   *               .setCiphertextCrc32C(Int64Value.newBuilder().build())
+   *               .build();
+   *       AsymmetricDecryptResponse response = keyManagementServiceClient.asymmetricDecrypt(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2670,25 +3994,44 @@ public final AsymmetricDecryptResponse asymmetricDecrypt(AsymmetricDecryptReques *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   AsymmetricDecryptRequest request =
-   *       AsymmetricDecryptRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .setCiphertext(ByteString.EMPTY)
-   *           .setCiphertextCrc32C(Int64Value.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.asymmetricDecryptCallable().futureCall(request);
-   *   // Do something.
-   *   AsymmetricDecryptResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.AsymmetricDecryptRequest;
+   * import com.google.cloud.kms.v1.AsymmetricDecryptResponse;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.protobuf.ByteString;
+   * import com.google.protobuf.Int64Value;
+   *
+   * public class KeyManagementServiceClientAsymmetricDecrypt {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientAsymmetricDecrypt();
+   *   }
+   *
+   *   public static void keyManagementServiceClientAsymmetricDecrypt() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       AsymmetricDecryptRequest request =
+   *           AsymmetricDecryptRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .setCiphertext(ByteString.EMPTY)
+   *               .setCiphertextCrc32C(Int64Value.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.asymmetricDecryptCallable().futureCall(request);
+   *       // Do something.
+   *       AsymmetricDecryptResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2707,13 +4050,28 @@ public final AsymmetricDecryptResponse asymmetricDecrypt(AsymmetricDecryptReques *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyName name =
-   *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
-   *   String cryptoKeyVersionId = "cryptoKeyVersionId987674581";
-   *   CryptoKey response =
-   *       keyManagementServiceClient.updateCryptoKeyPrimaryVersion(name, cryptoKeyVersionId);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientUpdateCryptoKeyPrimaryVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientUpdateCryptoKeyPrimaryVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientUpdateCryptoKeyPrimaryVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyName name =
+   *           CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *       String cryptoKeyVersionId = "cryptoKeyVersionId987674581";
+   *       CryptoKey response =
+   *           keyManagementServiceClient.updateCryptoKeyPrimaryVersion(name, cryptoKeyVersionId);
+   *     }
+   *   }
    * }
    * }
* @@ -2743,13 +4101,28 @@ public final CryptoKey updateCryptoKeyPrimaryVersion( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name =
-   *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
-   *   String cryptoKeyVersionId = "cryptoKeyVersionId987674581";
-   *   CryptoKey response =
-   *       keyManagementServiceClient.updateCryptoKeyPrimaryVersion(name, cryptoKeyVersionId);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientUpdateCryptoKeyPrimaryVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientUpdateCryptoKeyPrimaryVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientUpdateCryptoKeyPrimaryVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name =
+   *           CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
+   *       String cryptoKeyVersionId = "cryptoKeyVersionId987674581";
+   *       CryptoKey response =
+   *           keyManagementServiceClient.updateCryptoKeyPrimaryVersion(name, cryptoKeyVersionId);
+   *     }
+   *   }
    * }
    * }
* @@ -2778,16 +4151,32 @@ public final CryptoKey updateCryptoKeyPrimaryVersion(String name, String cryptoK *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   UpdateCryptoKeyPrimaryVersionRequest request =
-   *       UpdateCryptoKeyPrimaryVersionRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setCryptoKeyVersionId("cryptoKeyVersionId987674581")
-   *           .build();
-   *   CryptoKey response = keyManagementServiceClient.updateCryptoKeyPrimaryVersion(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest;
+   *
+   * public class KeyManagementServiceClientUpdateCryptoKeyPrimaryVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientUpdateCryptoKeyPrimaryVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientUpdateCryptoKeyPrimaryVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       UpdateCryptoKeyPrimaryVersionRequest request =
+   *           UpdateCryptoKeyPrimaryVersionRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setCryptoKeyVersionId("cryptoKeyVersionId987674581")
+   *               .build();
+   *       CryptoKey response = keyManagementServiceClient.updateCryptoKeyPrimaryVersion(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2809,19 +4198,36 @@ public final CryptoKey updateCryptoKeyPrimaryVersion( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   UpdateCryptoKeyPrimaryVersionRequest request =
-   *       UpdateCryptoKeyPrimaryVersionRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setCryptoKeyVersionId("cryptoKeyVersionId987674581")
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.updateCryptoKeyPrimaryVersionCallable().futureCall(request);
-   *   // Do something.
-   *   CryptoKey response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKey;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest;
+   *
+   * public class KeyManagementServiceClientUpdateCryptoKeyPrimaryVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientUpdateCryptoKeyPrimaryVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientUpdateCryptoKeyPrimaryVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       UpdateCryptoKeyPrimaryVersionRequest request =
+   *           UpdateCryptoKeyPrimaryVersionRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setCryptoKeyVersionId("cryptoKeyVersionId987674581")
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.updateCryptoKeyPrimaryVersionCallable().futureCall(request);
+   *       // Do something.
+   *       CryptoKey response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2850,12 +4256,27 @@ public final CryptoKey updateCryptoKeyPrimaryVersion( *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyVersionName name =
-   *       CryptoKeyVersionName.of(
-   *           "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
-   *   CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientDestroyCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientDestroyCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientDestroyCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyVersionName name =
+   *           CryptoKeyVersionName.of(
+   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *       CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(name);
+   *     }
+   *   }
    * }
    * }
* @@ -2891,13 +4312,28 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(CryptoKeyVersionName name) *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name =
-   *       CryptoKeyVersionName.of(
-   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
-   *           .toString();
-   *   CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientDestroyCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientDestroyCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientDestroyCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name =
+   *           CryptoKeyVersionName.of(
+   *                   "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
+   *               .toString();
+   *       CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(name);
+   *     }
+   *   }
    * }
    * }
* @@ -2931,20 +4367,36 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(String name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   DestroyCryptoKeyVersionRequest request =
-   *       DestroyCryptoKeyVersionRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .build();
-   *   CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientDestroyCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientDestroyCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientDestroyCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       DestroyCryptoKeyVersionRequest request =
+   *           DestroyCryptoKeyVersionRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .build();
+   *       CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2975,23 +4427,40 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(DestroyCryptoKeyVersionReq *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   DestroyCryptoKeyVersionRequest request =
-   *       DestroyCryptoKeyVersionRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.destroyCryptoKeyVersionCallable().futureCall(request);
-   *   // Do something.
-   *   CryptoKeyVersion response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientDestroyCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientDestroyCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientDestroyCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       DestroyCryptoKeyVersionRequest request =
+   *           DestroyCryptoKeyVersionRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.destroyCryptoKeyVersionCallable().futureCall(request);
+   *       // Do something.
+   *       CryptoKeyVersion response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -3014,12 +4483,27 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(DestroyCryptoKeyVersionReq *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   CryptoKeyVersionName name =
-   *       CryptoKeyVersionName.of(
-   *           "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
-   *   CryptoKeyVersion response = keyManagementServiceClient.restoreCryptoKeyVersion(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientRestoreCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientRestoreCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientRestoreCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       CryptoKeyVersionName name =
+   *           CryptoKeyVersionName.of(
+   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *       CryptoKeyVersion response = keyManagementServiceClient.restoreCryptoKeyVersion(name);
+   *     }
+   *   }
    * }
    * }
* @@ -3049,13 +4533,28 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(CryptoKeyVersionName name) *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   String name =
-   *       CryptoKeyVersionName.of(
-   *               "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
-   *           .toString();
-   *   CryptoKeyVersion response = keyManagementServiceClient.restoreCryptoKeyVersion(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   *
+   * public class KeyManagementServiceClientRestoreCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientRestoreCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientRestoreCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       String name =
+   *           CryptoKeyVersionName.of(
+   *                   "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
+   *               .toString();
+   *       CryptoKeyVersion response = keyManagementServiceClient.restoreCryptoKeyVersion(name);
+   *     }
+   *   }
    * }
    * }
* @@ -3083,20 +4582,36 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(String name) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   RestoreCryptoKeyVersionRequest request =
-   *       RestoreCryptoKeyVersionRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .build();
-   *   CryptoKeyVersion response = keyManagementServiceClient.restoreCryptoKeyVersion(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest;
+   *
+   * public class KeyManagementServiceClientRestoreCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientRestoreCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientRestoreCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       RestoreCryptoKeyVersionRequest request =
+   *           RestoreCryptoKeyVersionRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .build();
+   *       CryptoKeyVersion response = keyManagementServiceClient.restoreCryptoKeyVersion(request);
+   *     }
+   *   }
    * }
    * }
* @@ -3121,23 +4636,40 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(RestoreCryptoKeyVersionReq *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   RestoreCryptoKeyVersionRequest request =
-   *       RestoreCryptoKeyVersionRequest.newBuilder()
-   *           .setName(
-   *               CryptoKeyVersionName.of(
-   *                       "[PROJECT]",
-   *                       "[LOCATION]",
-   *                       "[KEY_RING]",
-   *                       "[CRYPTO_KEY]",
-   *                       "[CRYPTO_KEY_VERSION]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.restoreCryptoKeyVersionCallable().futureCall(request);
-   *   // Do something.
-   *   CryptoKeyVersion response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKeyVersion;
+   * import com.google.cloud.kms.v1.CryptoKeyVersionName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest;
+   *
+   * public class KeyManagementServiceClientRestoreCryptoKeyVersion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientRestoreCryptoKeyVersion();
+   *   }
+   *
+   *   public static void keyManagementServiceClientRestoreCryptoKeyVersion() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       RestoreCryptoKeyVersionRequest request =
+   *           RestoreCryptoKeyVersionRequest.newBuilder()
+   *               .setName(
+   *                   CryptoKeyVersionName.of(
+   *                           "[PROJECT]",
+   *                           "[LOCATION]",
+   *                           "[KEY_RING]",
+   *                           "[CRYPTO_KEY]",
+   *                           "[CRYPTO_KEY_VERSION]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.restoreCryptoKeyVersionCallable().futureCall(request);
+   *       // Do something.
+   *       CryptoKeyVersion response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -3154,16 +4686,33 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(RestoreCryptoKeyVersionReq *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   Policy response = keyManagementServiceClient.getIamPolicy(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.iam.v1.GetIamPolicyRequest;
+   * import com.google.iam.v1.GetPolicyOptions;
+   * import com.google.iam.v1.Policy;
+   *
+   * public class KeyManagementServiceClientGetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetIamPolicy();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetIamPolicy() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetIamPolicyRequest request =
+   *           GetIamPolicyRequest.newBuilder()
+   *               .setResource(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setOptions(GetPolicyOptions.newBuilder().build())
+   *               .build();
+   *       Policy response = keyManagementServiceClient.getIamPolicy(request);
+   *     }
+   *   }
    * }
    * }
* @@ -3182,19 +4731,37 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   Policy response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.iam.v1.GetIamPolicyRequest;
+   * import com.google.iam.v1.GetPolicyOptions;
+   * import com.google.iam.v1.Policy;
+   *
+   * public class KeyManagementServiceClientGetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetIamPolicy();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetIamPolicy() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetIamPolicyRequest request =
+   *           GetIamPolicyRequest.newBuilder()
+   *               .setResource(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .setOptions(GetPolicyOptions.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.getIamPolicyCallable().futureCall(request);
+   *       // Do something.
+   *       Policy response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -3209,17 +4776,32 @@ public final UnaryCallable getIamPolicyCallable() { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Location element : keyManagementServiceClient.listLocations(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.location.ListLocationsRequest;
+   * import com.google.cloud.location.Location;
+   *
+   * public class KeyManagementServiceClientListLocations {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListLocations();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListLocations() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListLocationsRequest request =
+   *           ListLocationsRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setFilter("filter-1274492040")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (Location element : keyManagementServiceClient.listLocations(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -3238,20 +4820,36 @@ public final ListLocationsPagedResponse listLocations(ListLocationsRequest reque *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.listLocationsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Location element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.location.ListLocationsRequest;
+   * import com.google.cloud.location.Location;
+   *
+   * public class KeyManagementServiceClientListLocations {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListLocations();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListLocations() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListLocationsRequest request =
+   *           ListLocationsRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setFilter("filter-1274492040")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.listLocationsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Location element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -3268,26 +4866,43 @@ public final ListLocationsPagedResponse listLocations(ListLocationsRequest reque *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListLocationsResponse response =
-   *         keyManagementServiceClient.listLocationsCallable().call(request);
-   *     for (Location element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.location.ListLocationsRequest;
+   * import com.google.cloud.location.ListLocationsResponse;
+   * import com.google.cloud.location.Location;
+   * import com.google.common.base.Strings;
+   *
+   * public class KeyManagementServiceClientListLocations {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientListLocations();
+   *   }
+   *
+   *   public static void keyManagementServiceClientListLocations() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       ListLocationsRequest request =
+   *           ListLocationsRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setFilter("filter-1274492040")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListLocationsResponse response =
+   *             keyManagementServiceClient.listLocationsCallable().call(request);
+   *         for (Location element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -3304,10 +4919,25 @@ public final UnaryCallable listLoca
    * 

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-   *   Location response = keyManagementServiceClient.getLocation(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.location.GetLocationRequest;
+   * import com.google.cloud.location.Location;
+   *
+   * public class KeyManagementServiceClientGetLocation {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetLocation();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetLocation() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *       Location response = keyManagementServiceClient.getLocation(request);
+   *     }
+   *   }
    * }
    * }
* @@ -3325,13 +4955,29 @@ public final Location getLocation(GetLocationRequest request) { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.getLocationCallable().futureCall(request);
-   *   // Do something.
-   *   Location response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.cloud.location.GetLocationRequest;
+   * import com.google.cloud.location.Location;
+   *
+   * public class KeyManagementServiceClientGetLocation {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientGetLocation();
+   *   }
+   *
+   *   public static void keyManagementServiceClientGetLocation() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.getLocationCallable().futureCall(request);
+   *       // Do something.
+   *       Location response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -3347,16 +4993,33 @@ public final UnaryCallable getLocationCallable() { *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   TestIamPermissionsResponse response = keyManagementServiceClient.testIamPermissions(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.iam.v1.TestIamPermissionsRequest;
+   * import com.google.iam.v1.TestIamPermissionsResponse;
+   * import java.util.ArrayList;
+   *
+   * public class KeyManagementServiceClientTestIamPermissions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientTestIamPermissions();
+   *   }
+   *
+   *   public static void keyManagementServiceClientTestIamPermissions() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       TestIamPermissionsRequest request =
+   *           TestIamPermissionsRequest.newBuilder()
+   *               .setResource(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .addAllPermissions(new ArrayList())
+   *               .build();
+   *       TestIamPermissionsResponse response = keyManagementServiceClient.testIamPermissions(request);
+   *     }
+   *   }
    * }
    * }
* @@ -3375,19 +5038,37 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq *

Sample code: * *

{@code
-   * try (KeyManagementServiceClient keyManagementServiceClient =
-   *     KeyManagementServiceClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource(
-   *               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
-   *                   .toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   ApiFuture future =
-   *       keyManagementServiceClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something.
-   *   TestIamPermissionsResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.kms.v1.CryptoKeyName;
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+   * import com.google.iam.v1.TestIamPermissionsRequest;
+   * import com.google.iam.v1.TestIamPermissionsResponse;
+   * import java.util.ArrayList;
+   *
+   * public class KeyManagementServiceClientTestIamPermissions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     keyManagementServiceClientTestIamPermissions();
+   *   }
+   *
+   *   public static void keyManagementServiceClientTestIamPermissions() throws Exception {
+   *     try (KeyManagementServiceClient keyManagementServiceClient =
+   *         KeyManagementServiceClient.create()) {
+   *       TestIamPermissionsRequest request =
+   *           TestIamPermissionsRequest.newBuilder()
+   *               .setResource(
+   *                   CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+   *                       .toString())
+   *               .addAllPermissions(new ArrayList())
+   *               .build();
+   *       ApiFuture future =
+   *           keyManagementServiceClient.testIamPermissionsCallable().futureCall(request);
+   *       // Do something.
+   *       TestIamPermissionsResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/kms/com/google/cloud/kms/v1/KeyManagementServiceSettings.java b/test/integration/goldens/kms/com/google/cloud/kms/v1/KeyManagementServiceSettings.java index fb53484f12..c67ac44c7c 100644 --- a/test/integration/goldens/kms/com/google/cloud/kms/v1/KeyManagementServiceSettings.java +++ b/test/integration/goldens/kms/com/google/cloud/kms/v1/KeyManagementServiceSettings.java @@ -65,19 +65,33 @@ *

For example, to set the total timeout of getKeyRing to 30 seconds: * *

{@code
- * KeyManagementServiceSettings.Builder keyManagementServiceSettingsBuilder =
- *     KeyManagementServiceSettings.newBuilder();
- * keyManagementServiceSettingsBuilder
- *     .getKeyRingSettings()
- *     .setRetrySettings(
- *         keyManagementServiceSettingsBuilder
- *             .getKeyRingSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * KeyManagementServiceSettings keyManagementServiceSettings =
- *     keyManagementServiceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.kms.v1.KeyManagementServiceSettings;
+ * import java.time.Duration;
+ *
+ * public class KeyManagementServiceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     keyManagementServiceSettings();
+ *   }
+ *
+ *   public static void keyManagementServiceSettings() throws Exception {
+ *     KeyManagementServiceSettings.Builder keyManagementServiceSettingsBuilder =
+ *         KeyManagementServiceSettings.newBuilder();
+ *     keyManagementServiceSettingsBuilder
+ *         .getKeyRingSettings()
+ *         .setRetrySettings(
+ *             keyManagementServiceSettingsBuilder
+ *                 .getKeyRingSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     KeyManagementServiceSettings keyManagementServiceSettings =
+ *         keyManagementServiceSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/kms/com/google/cloud/kms/v1/package-info.java b/test/integration/goldens/kms/com/google/cloud/kms/v1/package-info.java index 387836b476..1c56bce0b9 100644 --- a/test/integration/goldens/kms/com/google/cloud/kms/v1/package-info.java +++ b/test/integration/goldens/kms/com/google/cloud/kms/v1/package-info.java @@ -39,10 +39,25 @@ *

Sample for KeyManagementServiceClient: * *

{@code
- * try (KeyManagementServiceClient keyManagementServiceClient =
- *     KeyManagementServiceClient.create()) {
- *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
- *   KeyRing response = keyManagementServiceClient.getKeyRing(name);
+ * package com.google.example;
+ *
+ * import com.google.cloud.kms.v1.KeyManagementServiceClient;
+ * import com.google.cloud.kms.v1.KeyRing;
+ * import com.google.cloud.kms.v1.KeyRingName;
+ *
+ * public class KeyManagementServiceClientGetKeyRing {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     keyManagementServiceClientGetKeyRing();
+ *   }
+ *
+ *   public static void keyManagementServiceClientGetKeyRing() throws Exception {
+ *     try (KeyManagementServiceClient keyManagementServiceClient =
+ *         KeyManagementServiceClient.create()) {
+ *       KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+ *       KeyRing response = keyManagementServiceClient.getKeyRing(name);
+ *     }
+ *   }
  * }
  * }
*/ diff --git a/test/integration/goldens/kms/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java b/test/integration/goldens/kms/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java index e3faa10060..0327acb7cb 100644 --- a/test/integration/goldens/kms/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java +++ b/test/integration/goldens/kms/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java @@ -115,19 +115,33 @@ *

For example, to set the total timeout of getKeyRing to 30 seconds: * *

{@code
- * KeyManagementServiceStubSettings.Builder keyManagementServiceSettingsBuilder =
- *     KeyManagementServiceStubSettings.newBuilder();
- * keyManagementServiceSettingsBuilder
- *     .getKeyRingSettings()
- *     .setRetrySettings(
- *         keyManagementServiceSettingsBuilder
- *             .getKeyRingSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * KeyManagementServiceStubSettings keyManagementServiceSettings =
- *     keyManagementServiceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.kms.v1.stub.KeyManagementServiceStubSettings;
+ * import java.time.Duration;
+ *
+ * public class KeyManagementServiceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     keyManagementServiceSettings();
+ *   }
+ *
+ *   public static void keyManagementServiceSettings() throws Exception {
+ *     KeyManagementServiceStubSettings.Builder keyManagementServiceSettingsBuilder =
+ *         KeyManagementServiceStubSettings.newBuilder();
+ *     keyManagementServiceSettingsBuilder
+ *         .getKeyRingSettings()
+ *         .setRetrySettings(
+ *             keyManagementServiceSettingsBuilder
+ *                 .getKeyRingSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     KeyManagementServiceStubSettings keyManagementServiceSettings =
+ *         keyManagementServiceSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/library/com/google/cloud/example/library/v1/LibraryServiceClient.java b/test/integration/goldens/library/com/google/cloud/example/library/v1/LibraryServiceClient.java index 3a758ad3f9..11cec50aea 100644 --- a/test/integration/goldens/library/com/google/cloud/example/library/v1/LibraryServiceClient.java +++ b/test/integration/goldens/library/com/google/cloud/example/library/v1/LibraryServiceClient.java @@ -67,9 +67,23 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- *   Shelf shelf = Shelf.newBuilder().build();
- *   Shelf response = libraryServiceClient.createShelf(shelf);
+ * package com.google.example;
+ *
+ * import com.google.cloud.example.library.v1.LibraryServiceClient;
+ * import com.google.example.library.v1.Shelf;
+ *
+ * public class LibraryServiceClientCreateShelf {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     libraryServiceClientCreateShelf();
+ *   }
+ *
+ *   public static void libraryServiceClientCreateShelf() throws Exception {
+ *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+ *       Shelf shelf = Shelf.newBuilder().build();
+ *       Shelf response = libraryServiceClient.createShelf(shelf);
+ *     }
+ *   }
  * }
  * }
* @@ -102,19 +116,50 @@ *

To customize credentials: * *

{@code
- * LibraryServiceSettings libraryServiceSettings =
- *     LibraryServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * LibraryServiceClient libraryServiceClient = LibraryServiceClient.create(libraryServiceSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.example.library.v1.LibraryServiceClient;
+ * import com.google.cloud.example.library.v1.LibraryServiceSettings;
+ * import com.google.cloud.example.library.v1.myCredentials;
+ *
+ * public class LibraryServiceClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     libraryServiceClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void libraryServiceClientSetCredentialsProvider() throws Exception {
+ *     LibraryServiceSettings libraryServiceSettings =
+ *         LibraryServiceSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     LibraryServiceClient libraryServiceClient = LibraryServiceClient.create(libraryServiceSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * LibraryServiceSettings libraryServiceSettings =
- *     LibraryServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * LibraryServiceClient libraryServiceClient = LibraryServiceClient.create(libraryServiceSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.example.library.v1.LibraryServiceClient;
+ * import com.google.cloud.example.library.v1.LibraryServiceSettings;
+ * import com.google.cloud.example.library.v1.myEndpoint;
+ *
+ * public class LibraryServiceClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     libraryServiceClientSetEndpoint();
+ *   }
+ *
+ *   public static void libraryServiceClientSetEndpoint() throws Exception {
+ *     LibraryServiceSettings libraryServiceSettings =
+ *         LibraryServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     LibraryServiceClient libraryServiceClient = LibraryServiceClient.create(libraryServiceSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -179,9 +224,23 @@ public LibraryServiceStub getStub() { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   Shelf shelf = Shelf.newBuilder().build();
-   *   Shelf response = libraryServiceClient.createShelf(shelf);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Shelf;
+   *
+   * public class LibraryServiceClientCreateShelf {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientCreateShelf();
+   *   }
+   *
+   *   public static void libraryServiceClientCreateShelf() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       Shelf shelf = Shelf.newBuilder().build();
+   *       Shelf response = libraryServiceClient.createShelf(shelf);
+   *     }
+   *   }
    * }
    * }
* @@ -200,10 +259,25 @@ public final Shelf createShelf(Shelf shelf) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   CreateShelfRequest request =
-   *       CreateShelfRequest.newBuilder().setShelf(Shelf.newBuilder().build()).build();
-   *   Shelf response = libraryServiceClient.createShelf(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.CreateShelfRequest;
+   * import com.google.example.library.v1.Shelf;
+   *
+   * public class LibraryServiceClientCreateShelf {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientCreateShelf();
+   *   }
+   *
+   *   public static void libraryServiceClientCreateShelf() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       CreateShelfRequest request =
+   *           CreateShelfRequest.newBuilder().setShelf(Shelf.newBuilder().build()).build();
+   *       Shelf response = libraryServiceClient.createShelf(request);
+   *     }
+   *   }
    * }
    * }
* @@ -221,12 +295,28 @@ public final Shelf createShelf(CreateShelfRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   CreateShelfRequest request =
-   *       CreateShelfRequest.newBuilder().setShelf(Shelf.newBuilder().build()).build();
-   *   ApiFuture future = libraryServiceClient.createShelfCallable().futureCall(request);
-   *   // Do something.
-   *   Shelf response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.CreateShelfRequest;
+   * import com.google.example.library.v1.Shelf;
+   *
+   * public class LibraryServiceClientCreateShelf {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientCreateShelf();
+   *   }
+   *
+   *   public static void libraryServiceClientCreateShelf() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       CreateShelfRequest request =
+   *           CreateShelfRequest.newBuilder().setShelf(Shelf.newBuilder().build()).build();
+   *       ApiFuture future = libraryServiceClient.createShelfCallable().futureCall(request);
+   *       // Do something.
+   *       Shelf response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -241,9 +331,24 @@ public final UnaryCallable createShelfCallable() { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ShelfName name = ShelfName.of("[SHELF_ID]");
-   *   Shelf response = libraryServiceClient.getShelf(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Shelf;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientGetShelf {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientGetShelf();
+   *   }
+   *
+   *   public static void libraryServiceClientGetShelf() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ShelfName name = ShelfName.of("[SHELF_ID]");
+   *       Shelf response = libraryServiceClient.getShelf(name);
+   *     }
+   *   }
    * }
    * }
* @@ -263,9 +368,24 @@ public final Shelf getShelf(ShelfName name) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   String name = ShelfName.of("[SHELF_ID]").toString();
-   *   Shelf response = libraryServiceClient.getShelf(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Shelf;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientGetShelf {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientGetShelf();
+   *   }
+   *
+   *   public static void libraryServiceClientGetShelf() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       String name = ShelfName.of("[SHELF_ID]").toString();
+   *       Shelf response = libraryServiceClient.getShelf(name);
+   *     }
+   *   }
    * }
    * }
* @@ -284,10 +404,26 @@ public final Shelf getShelf(String name) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   GetShelfRequest request =
-   *       GetShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
-   *   Shelf response = libraryServiceClient.getShelf(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.GetShelfRequest;
+   * import com.google.example.library.v1.Shelf;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientGetShelf {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientGetShelf();
+   *   }
+   *
+   *   public static void libraryServiceClientGetShelf() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       GetShelfRequest request =
+   *           GetShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
+   *       Shelf response = libraryServiceClient.getShelf(request);
+   *     }
+   *   }
    * }
    * }
* @@ -305,12 +441,29 @@ public final Shelf getShelf(GetShelfRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   GetShelfRequest request =
-   *       GetShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
-   *   ApiFuture future = libraryServiceClient.getShelfCallable().futureCall(request);
-   *   // Do something.
-   *   Shelf response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.GetShelfRequest;
+   * import com.google.example.library.v1.Shelf;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientGetShelf {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientGetShelf();
+   *   }
+   *
+   *   public static void libraryServiceClientGetShelf() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       GetShelfRequest request =
+   *           GetShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
+   *       ApiFuture future = libraryServiceClient.getShelfCallable().futureCall(request);
+   *       // Do something.
+   *       Shelf response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -326,14 +479,29 @@ public final UnaryCallable getShelfCallable() { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ListShelvesRequest request =
-   *       ListShelvesRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Shelf element : libraryServiceClient.listShelves(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.ListShelvesRequest;
+   * import com.google.example.library.v1.Shelf;
+   *
+   * public class LibraryServiceClientListShelves {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientListShelves();
+   *   }
+   *
+   *   public static void libraryServiceClientListShelves() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ListShelvesRequest request =
+   *           ListShelvesRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (Shelf element : libraryServiceClient.listShelves(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -353,16 +521,32 @@ public final ListShelvesPagedResponse listShelves(ListShelvesRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ListShelvesRequest request =
-   *       ListShelvesRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = libraryServiceClient.listShelvesPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Shelf element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.ListShelvesRequest;
+   * import com.google.example.library.v1.Shelf;
+   *
+   * public class LibraryServiceClientListShelves {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientListShelves();
+   *   }
+   *
+   *   public static void libraryServiceClientListShelves() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ListShelvesRequest request =
+   *           ListShelvesRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future = libraryServiceClient.listShelvesPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Shelf element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -380,22 +564,39 @@ public final ListShelvesPagedResponse listShelves(ListShelvesRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ListShelvesRequest request =
-   *       ListShelvesRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListShelvesResponse response = libraryServiceClient.listShelvesCallable().call(request);
-   *     for (Shelf element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.common.base.Strings;
+   * import com.google.example.library.v1.ListShelvesRequest;
+   * import com.google.example.library.v1.ListShelvesResponse;
+   * import com.google.example.library.v1.Shelf;
+   *
+   * public class LibraryServiceClientListShelves {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientListShelves();
+   *   }
+   *
+   *   public static void libraryServiceClientListShelves() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ListShelvesRequest request =
+   *           ListShelvesRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListShelvesResponse response = libraryServiceClient.listShelvesCallable().call(request);
+   *         for (Shelf element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -412,9 +613,24 @@ public final UnaryCallable listShelvesC
    * 

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ShelfName name = ShelfName.of("[SHELF_ID]");
-   *   libraryServiceClient.deleteShelf(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.ShelfName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LibraryServiceClientDeleteShelf {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientDeleteShelf();
+   *   }
+   *
+   *   public static void libraryServiceClientDeleteShelf() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ShelfName name = ShelfName.of("[SHELF_ID]");
+   *       libraryServiceClient.deleteShelf(name);
+   *     }
+   *   }
    * }
    * }
* @@ -434,9 +650,24 @@ public final void deleteShelf(ShelfName name) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   String name = ShelfName.of("[SHELF_ID]").toString();
-   *   libraryServiceClient.deleteShelf(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.ShelfName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LibraryServiceClientDeleteShelf {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientDeleteShelf();
+   *   }
+   *
+   *   public static void libraryServiceClientDeleteShelf() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       String name = ShelfName.of("[SHELF_ID]").toString();
+   *       libraryServiceClient.deleteShelf(name);
+   *     }
+   *   }
    * }
    * }
* @@ -455,10 +686,26 @@ public final void deleteShelf(String name) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   DeleteShelfRequest request =
-   *       DeleteShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
-   *   libraryServiceClient.deleteShelf(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.DeleteShelfRequest;
+   * import com.google.example.library.v1.ShelfName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LibraryServiceClientDeleteShelf {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientDeleteShelf();
+   *   }
+   *
+   *   public static void libraryServiceClientDeleteShelf() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       DeleteShelfRequest request =
+   *           DeleteShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
+   *       libraryServiceClient.deleteShelf(request);
+   *     }
+   *   }
    * }
    * }
* @@ -476,12 +723,29 @@ public final void deleteShelf(DeleteShelfRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   DeleteShelfRequest request =
-   *       DeleteShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
-   *   ApiFuture future = libraryServiceClient.deleteShelfCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.DeleteShelfRequest;
+   * import com.google.example.library.v1.ShelfName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LibraryServiceClientDeleteShelf {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientDeleteShelf();
+   *   }
+   *
+   *   public static void libraryServiceClientDeleteShelf() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       DeleteShelfRequest request =
+   *           DeleteShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
+   *       ApiFuture future = libraryServiceClient.deleteShelfCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -501,10 +765,25 @@ public final UnaryCallable deleteShelfCallable() { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ShelfName name = ShelfName.of("[SHELF_ID]");
-   *   ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
-   *   Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Shelf;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMergeShelves {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMergeShelves();
+   *   }
+   *
+   *   public static void libraryServiceClientMergeShelves() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ShelfName name = ShelfName.of("[SHELF_ID]");
+   *       ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
+   *       Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
+   *     }
+   *   }
    * }
    * }
* @@ -533,10 +812,25 @@ public final Shelf mergeShelves(ShelfName name, ShelfName otherShelf) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ShelfName name = ShelfName.of("[SHELF_ID]");
-   *   String otherShelf = ShelfName.of("[SHELF_ID]").toString();
-   *   Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Shelf;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMergeShelves {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMergeShelves();
+   *   }
+   *
+   *   public static void libraryServiceClientMergeShelves() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ShelfName name = ShelfName.of("[SHELF_ID]");
+   *       String otherShelf = ShelfName.of("[SHELF_ID]").toString();
+   *       Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
+   *     }
+   *   }
    * }
    * }
* @@ -565,10 +859,25 @@ public final Shelf mergeShelves(ShelfName name, String otherShelf) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   String name = ShelfName.of("[SHELF_ID]").toString();
-   *   ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
-   *   Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Shelf;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMergeShelves {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMergeShelves();
+   *   }
+   *
+   *   public static void libraryServiceClientMergeShelves() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       String name = ShelfName.of("[SHELF_ID]").toString();
+   *       ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
+   *       Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
+   *     }
+   *   }
    * }
    * }
* @@ -597,10 +906,25 @@ public final Shelf mergeShelves(String name, ShelfName otherShelf) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   String name = ShelfName.of("[SHELF_ID]").toString();
-   *   String otherShelf = ShelfName.of("[SHELF_ID]").toString();
-   *   Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Shelf;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMergeShelves {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMergeShelves();
+   *   }
+   *
+   *   public static void libraryServiceClientMergeShelves() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       String name = ShelfName.of("[SHELF_ID]").toString();
+   *       String otherShelf = ShelfName.of("[SHELF_ID]").toString();
+   *       Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
+   *     }
+   *   }
    * }
    * }
* @@ -626,13 +950,29 @@ public final Shelf mergeShelves(String name, String otherShelf) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   MergeShelvesRequest request =
-   *       MergeShelvesRequest.newBuilder()
-   *           .setName(ShelfName.of("[SHELF_ID]").toString())
-   *           .setOtherShelf(ShelfName.of("[SHELF_ID]").toString())
-   *           .build();
-   *   Shelf response = libraryServiceClient.mergeShelves(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.MergeShelvesRequest;
+   * import com.google.example.library.v1.Shelf;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMergeShelves {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMergeShelves();
+   *   }
+   *
+   *   public static void libraryServiceClientMergeShelves() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       MergeShelvesRequest request =
+   *           MergeShelvesRequest.newBuilder()
+   *               .setName(ShelfName.of("[SHELF_ID]").toString())
+   *               .setOtherShelf(ShelfName.of("[SHELF_ID]").toString())
+   *               .build();
+   *       Shelf response = libraryServiceClient.mergeShelves(request);
+   *     }
+   *   }
    * }
    * }
* @@ -655,15 +995,32 @@ public final Shelf mergeShelves(MergeShelvesRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   MergeShelvesRequest request =
-   *       MergeShelvesRequest.newBuilder()
-   *           .setName(ShelfName.of("[SHELF_ID]").toString())
-   *           .setOtherShelf(ShelfName.of("[SHELF_ID]").toString())
-   *           .build();
-   *   ApiFuture future = libraryServiceClient.mergeShelvesCallable().futureCall(request);
-   *   // Do something.
-   *   Shelf response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.MergeShelvesRequest;
+   * import com.google.example.library.v1.Shelf;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMergeShelves {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMergeShelves();
+   *   }
+   *
+   *   public static void libraryServiceClientMergeShelves() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       MergeShelvesRequest request =
+   *           MergeShelvesRequest.newBuilder()
+   *               .setName(ShelfName.of("[SHELF_ID]").toString())
+   *               .setOtherShelf(ShelfName.of("[SHELF_ID]").toString())
+   *               .build();
+   *       ApiFuture future = libraryServiceClient.mergeShelvesCallable().futureCall(request);
+   *       // Do something.
+   *       Shelf response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -678,10 +1035,25 @@ public final UnaryCallable mergeShelvesCallable() { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ShelfName parent = ShelfName.of("[SHELF_ID]");
-   *   Book book = Book.newBuilder().build();
-   *   Book response = libraryServiceClient.createBook(parent, book);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientCreateBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientCreateBook();
+   *   }
+   *
+   *   public static void libraryServiceClientCreateBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ShelfName parent = ShelfName.of("[SHELF_ID]");
+   *       Book book = Book.newBuilder().build();
+   *       Book response = libraryServiceClient.createBook(parent, book);
+   *     }
+   *   }
    * }
    * }
* @@ -705,10 +1077,25 @@ public final Book createBook(ShelfName parent, Book book) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   String parent = ShelfName.of("[SHELF_ID]").toString();
-   *   Book book = Book.newBuilder().build();
-   *   Book response = libraryServiceClient.createBook(parent, book);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientCreateBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientCreateBook();
+   *   }
+   *
+   *   public static void libraryServiceClientCreateBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       String parent = ShelfName.of("[SHELF_ID]").toString();
+   *       Book book = Book.newBuilder().build();
+   *       Book response = libraryServiceClient.createBook(parent, book);
+   *     }
+   *   }
    * }
    * }
* @@ -729,13 +1116,29 @@ public final Book createBook(String parent, Book book) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   CreateBookRequest request =
-   *       CreateBookRequest.newBuilder()
-   *           .setParent(ShelfName.of("[SHELF_ID]").toString())
-   *           .setBook(Book.newBuilder().build())
-   *           .build();
-   *   Book response = libraryServiceClient.createBook(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.CreateBookRequest;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientCreateBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientCreateBook();
+   *   }
+   *
+   *   public static void libraryServiceClientCreateBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       CreateBookRequest request =
+   *           CreateBookRequest.newBuilder()
+   *               .setParent(ShelfName.of("[SHELF_ID]").toString())
+   *               .setBook(Book.newBuilder().build())
+   *               .build();
+   *       Book response = libraryServiceClient.createBook(request);
+   *     }
+   *   }
    * }
    * }
* @@ -753,15 +1156,32 @@ public final Book createBook(CreateBookRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   CreateBookRequest request =
-   *       CreateBookRequest.newBuilder()
-   *           .setParent(ShelfName.of("[SHELF_ID]").toString())
-   *           .setBook(Book.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = libraryServiceClient.createBookCallable().futureCall(request);
-   *   // Do something.
-   *   Book response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.CreateBookRequest;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientCreateBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientCreateBook();
+   *   }
+   *
+   *   public static void libraryServiceClientCreateBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       CreateBookRequest request =
+   *           CreateBookRequest.newBuilder()
+   *               .setParent(ShelfName.of("[SHELF_ID]").toString())
+   *               .setBook(Book.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = libraryServiceClient.createBookCallable().futureCall(request);
+   *       // Do something.
+   *       Book response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -776,9 +1196,24 @@ public final UnaryCallable createBookCallable() { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   BookName name = BookName.of("[SHELF]", "[BOOK]");
-   *   Book response = libraryServiceClient.getBook(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.BookName;
+   *
+   * public class LibraryServiceClientGetBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientGetBook();
+   *   }
+   *
+   *   public static void libraryServiceClientGetBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       BookName name = BookName.of("[SHELF]", "[BOOK]");
+   *       Book response = libraryServiceClient.getBook(name);
+   *     }
+   *   }
    * }
    * }
* @@ -798,9 +1233,24 @@ public final Book getBook(BookName name) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   String name = BookName.of("[SHELF]", "[BOOK]").toString();
-   *   Book response = libraryServiceClient.getBook(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.BookName;
+   *
+   * public class LibraryServiceClientGetBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientGetBook();
+   *   }
+   *
+   *   public static void libraryServiceClientGetBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       String name = BookName.of("[SHELF]", "[BOOK]").toString();
+   *       Book response = libraryServiceClient.getBook(name);
+   *     }
+   *   }
    * }
    * }
* @@ -819,10 +1269,26 @@ public final Book getBook(String name) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   GetBookRequest request =
-   *       GetBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).build();
-   *   Book response = libraryServiceClient.getBook(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.example.library.v1.GetBookRequest;
+   *
+   * public class LibraryServiceClientGetBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientGetBook();
+   *   }
+   *
+   *   public static void libraryServiceClientGetBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       GetBookRequest request =
+   *           GetBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).build();
+   *       Book response = libraryServiceClient.getBook(request);
+   *     }
+   *   }
    * }
    * }
* @@ -840,12 +1306,29 @@ public final Book getBook(GetBookRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   GetBookRequest request =
-   *       GetBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).build();
-   *   ApiFuture future = libraryServiceClient.getBookCallable().futureCall(request);
-   *   // Do something.
-   *   Book response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.example.library.v1.GetBookRequest;
+   *
+   * public class LibraryServiceClientGetBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientGetBook();
+   *   }
+   *
+   *   public static void libraryServiceClientGetBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       GetBookRequest request =
+   *           GetBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).build();
+   *       ApiFuture future = libraryServiceClient.getBookCallable().futureCall(request);
+   *       // Do something.
+   *       Book response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -862,10 +1345,25 @@ public final UnaryCallable getBookCallable() { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ShelfName parent = ShelfName.of("[SHELF_ID]");
-   *   for (Book element : libraryServiceClient.listBooks(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientListBooks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientListBooks();
+   *   }
+   *
+   *   public static void libraryServiceClientListBooks() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ShelfName parent = ShelfName.of("[SHELF_ID]");
+   *       for (Book element : libraryServiceClient.listBooks(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -888,10 +1386,25 @@ public final ListBooksPagedResponse listBooks(ShelfName parent) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   String parent = ShelfName.of("[SHELF_ID]").toString();
-   *   for (Book element : libraryServiceClient.listBooks(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientListBooks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientListBooks();
+   *   }
+   *
+   *   public static void libraryServiceClientListBooks() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       String parent = ShelfName.of("[SHELF_ID]").toString();
+   *       for (Book element : libraryServiceClient.listBooks(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -913,15 +1426,31 @@ public final ListBooksPagedResponse listBooks(String parent) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ListBooksRequest request =
-   *       ListBooksRequest.newBuilder()
-   *           .setParent(ShelfName.of("[SHELF_ID]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Book element : libraryServiceClient.listBooks(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.ListBooksRequest;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientListBooks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientListBooks();
+   *   }
+   *
+   *   public static void libraryServiceClientListBooks() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ListBooksRequest request =
+   *           ListBooksRequest.newBuilder()
+   *               .setParent(ShelfName.of("[SHELF_ID]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (Book element : libraryServiceClient.listBooks(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -942,17 +1471,34 @@ public final ListBooksPagedResponse listBooks(ListBooksRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ListBooksRequest request =
-   *       ListBooksRequest.newBuilder()
-   *           .setParent(ShelfName.of("[SHELF_ID]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = libraryServiceClient.listBooksPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Book element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.ListBooksRequest;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientListBooks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientListBooks();
+   *   }
+   *
+   *   public static void libraryServiceClientListBooks() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ListBooksRequest request =
+   *           ListBooksRequest.newBuilder()
+   *               .setParent(ShelfName.of("[SHELF_ID]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future = libraryServiceClient.listBooksPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Book element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -970,23 +1516,41 @@ public final UnaryCallable listBooksPa *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ListBooksRequest request =
-   *       ListBooksRequest.newBuilder()
-   *           .setParent(ShelfName.of("[SHELF_ID]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListBooksResponse response = libraryServiceClient.listBooksCallable().call(request);
-   *     for (Book element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.common.base.Strings;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.ListBooksRequest;
+   * import com.google.example.library.v1.ListBooksResponse;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientListBooks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientListBooks();
+   *   }
+   *
+   *   public static void libraryServiceClientListBooks() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       ListBooksRequest request =
+   *           ListBooksRequest.newBuilder()
+   *               .setParent(ShelfName.of("[SHELF_ID]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListBooksResponse response = libraryServiceClient.listBooksCallable().call(request);
+   *         for (Book element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -1003,9 +1567,24 @@ public final UnaryCallable listBooksCallabl
    * 

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   BookName name = BookName.of("[SHELF]", "[BOOK]");
-   *   libraryServiceClient.deleteBook(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LibraryServiceClientDeleteBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientDeleteBook();
+   *   }
+   *
+   *   public static void libraryServiceClientDeleteBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       BookName name = BookName.of("[SHELF]", "[BOOK]");
+   *       libraryServiceClient.deleteBook(name);
+   *     }
+   *   }
    * }
    * }
* @@ -1025,9 +1604,24 @@ public final void deleteBook(BookName name) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   String name = BookName.of("[SHELF]", "[BOOK]").toString();
-   *   libraryServiceClient.deleteBook(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LibraryServiceClientDeleteBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientDeleteBook();
+   *   }
+   *
+   *   public static void libraryServiceClientDeleteBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       String name = BookName.of("[SHELF]", "[BOOK]").toString();
+   *       libraryServiceClient.deleteBook(name);
+   *     }
+   *   }
    * }
    * }
* @@ -1046,12 +1640,28 @@ public final void deleteBook(String name) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   DeleteBookRequest request =
-   *       DeleteBookRequest.newBuilder()
-   *           .setName(BookName.of("[SHELF]", "[BOOK]").toString())
-   *           .build();
-   *   libraryServiceClient.deleteBook(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.example.library.v1.DeleteBookRequest;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LibraryServiceClientDeleteBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientDeleteBook();
+   *   }
+   *
+   *   public static void libraryServiceClientDeleteBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       DeleteBookRequest request =
+   *           DeleteBookRequest.newBuilder()
+   *               .setName(BookName.of("[SHELF]", "[BOOK]").toString())
+   *               .build();
+   *       libraryServiceClient.deleteBook(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1069,14 +1679,31 @@ public final void deleteBook(DeleteBookRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   DeleteBookRequest request =
-   *       DeleteBookRequest.newBuilder()
-   *           .setName(BookName.of("[SHELF]", "[BOOK]").toString())
-   *           .build();
-   *   ApiFuture future = libraryServiceClient.deleteBookCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.example.library.v1.DeleteBookRequest;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LibraryServiceClientDeleteBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientDeleteBook();
+   *   }
+   *
+   *   public static void libraryServiceClientDeleteBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       DeleteBookRequest request =
+   *           DeleteBookRequest.newBuilder()
+   *               .setName(BookName.of("[SHELF]", "[BOOK]").toString())
+   *               .build();
+   *       ApiFuture future = libraryServiceClient.deleteBookCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1092,10 +1719,25 @@ public final UnaryCallable deleteBookCallable() { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   Book book = Book.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Book response = libraryServiceClient.updateBook(book, updateMask);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class LibraryServiceClientUpdateBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientUpdateBook();
+   *   }
+   *
+   *   public static void libraryServiceClientUpdateBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       Book book = Book.newBuilder().build();
+   *       FieldMask updateMask = FieldMask.newBuilder().build();
+   *       Book response = libraryServiceClient.updateBook(book, updateMask);
+   *     }
+   *   }
    * }
    * }
* @@ -1117,13 +1759,29 @@ public final Book updateBook(Book book, FieldMask updateMask) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   UpdateBookRequest request =
-   *       UpdateBookRequest.newBuilder()
-   *           .setBook(Book.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   Book response = libraryServiceClient.updateBook(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.UpdateBookRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class LibraryServiceClientUpdateBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientUpdateBook();
+   *   }
+   *
+   *   public static void libraryServiceClientUpdateBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       UpdateBookRequest request =
+   *           UpdateBookRequest.newBuilder()
+   *               .setBook(Book.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       Book response = libraryServiceClient.updateBook(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1142,15 +1800,32 @@ public final Book updateBook(UpdateBookRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   UpdateBookRequest request =
-   *       UpdateBookRequest.newBuilder()
-   *           .setBook(Book.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = libraryServiceClient.updateBookCallable().futureCall(request);
-   *   // Do something.
-   *   Book response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.UpdateBookRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class LibraryServiceClientUpdateBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientUpdateBook();
+   *   }
+   *
+   *   public static void libraryServiceClientUpdateBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       UpdateBookRequest request =
+   *           UpdateBookRequest.newBuilder()
+   *               .setBook(Book.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = libraryServiceClient.updateBookCallable().futureCall(request);
+   *       // Do something.
+   *       Book response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1166,10 +1841,26 @@ public final UnaryCallable updateBookCallable() { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   BookName name = BookName.of("[SHELF]", "[BOOK]");
-   *   ShelfName otherShelfName = ShelfName.of("[SHELF_ID]");
-   *   Book response = libraryServiceClient.moveBook(name, otherShelfName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMoveBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMoveBook();
+   *   }
+   *
+   *   public static void libraryServiceClientMoveBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       BookName name = BookName.of("[SHELF]", "[BOOK]");
+   *       ShelfName otherShelfName = ShelfName.of("[SHELF_ID]");
+   *       Book response = libraryServiceClient.moveBook(name, otherShelfName);
+   *     }
+   *   }
    * }
    * }
* @@ -1194,10 +1885,26 @@ public final Book moveBook(BookName name, ShelfName otherShelfName) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   BookName name = BookName.of("[SHELF]", "[BOOK]");
-   *   String otherShelfName = ShelfName.of("[SHELF_ID]").toString();
-   *   Book response = libraryServiceClient.moveBook(name, otherShelfName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMoveBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMoveBook();
+   *   }
+   *
+   *   public static void libraryServiceClientMoveBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       BookName name = BookName.of("[SHELF]", "[BOOK]");
+   *       String otherShelfName = ShelfName.of("[SHELF_ID]").toString();
+   *       Book response = libraryServiceClient.moveBook(name, otherShelfName);
+   *     }
+   *   }
    * }
    * }
* @@ -1222,10 +1929,26 @@ public final Book moveBook(BookName name, String otherShelfName) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   String name = BookName.of("[SHELF]", "[BOOK]").toString();
-   *   ShelfName otherShelfName = ShelfName.of("[SHELF_ID]");
-   *   Book response = libraryServiceClient.moveBook(name, otherShelfName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMoveBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMoveBook();
+   *   }
+   *
+   *   public static void libraryServiceClientMoveBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       String name = BookName.of("[SHELF]", "[BOOK]").toString();
+   *       ShelfName otherShelfName = ShelfName.of("[SHELF_ID]");
+   *       Book response = libraryServiceClient.moveBook(name, otherShelfName);
+   *     }
+   *   }
    * }
    * }
* @@ -1250,10 +1973,26 @@ public final Book moveBook(String name, ShelfName otherShelfName) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   String name = BookName.of("[SHELF]", "[BOOK]").toString();
-   *   String otherShelfName = ShelfName.of("[SHELF_ID]").toString();
-   *   Book response = libraryServiceClient.moveBook(name, otherShelfName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMoveBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMoveBook();
+   *   }
+   *
+   *   public static void libraryServiceClientMoveBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       String name = BookName.of("[SHELF]", "[BOOK]").toString();
+   *       String otherShelfName = ShelfName.of("[SHELF_ID]").toString();
+   *       Book response = libraryServiceClient.moveBook(name, otherShelfName);
+   *     }
+   *   }
    * }
    * }
* @@ -1275,13 +2014,30 @@ public final Book moveBook(String name, String otherShelfName) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   MoveBookRequest request =
-   *       MoveBookRequest.newBuilder()
-   *           .setName(BookName.of("[SHELF]", "[BOOK]").toString())
-   *           .setOtherShelfName(ShelfName.of("[SHELF_ID]").toString())
-   *           .build();
-   *   Book response = libraryServiceClient.moveBook(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.example.library.v1.MoveBookRequest;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMoveBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMoveBook();
+   *   }
+   *
+   *   public static void libraryServiceClientMoveBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       MoveBookRequest request =
+   *           MoveBookRequest.newBuilder()
+   *               .setName(BookName.of("[SHELF]", "[BOOK]").toString())
+   *               .setOtherShelfName(ShelfName.of("[SHELF_ID]").toString())
+   *               .build();
+   *       Book response = libraryServiceClient.moveBook(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1300,15 +2056,33 @@ public final Book moveBook(MoveBookRequest request) { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   MoveBookRequest request =
-   *       MoveBookRequest.newBuilder()
-   *           .setName(BookName.of("[SHELF]", "[BOOK]").toString())
-   *           .setOtherShelfName(ShelfName.of("[SHELF_ID]").toString())
-   *           .build();
-   *   ApiFuture future = libraryServiceClient.moveBookCallable().futureCall(request);
-   *   // Do something.
-   *   Book response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
+   * import com.google.example.library.v1.Book;
+   * import com.google.example.library.v1.BookName;
+   * import com.google.example.library.v1.MoveBookRequest;
+   * import com.google.example.library.v1.ShelfName;
+   *
+   * public class LibraryServiceClientMoveBook {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     libraryServiceClientMoveBook();
+   *   }
+   *
+   *   public static void libraryServiceClientMoveBook() throws Exception {
+   *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+   *       MoveBookRequest request =
+   *           MoveBookRequest.newBuilder()
+   *               .setName(BookName.of("[SHELF]", "[BOOK]").toString())
+   *               .setOtherShelfName(ShelfName.of("[SHELF_ID]").toString())
+   *               .build();
+   *       ApiFuture future = libraryServiceClient.moveBookCallable().futureCall(request);
+   *       // Do something.
+   *       Book response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/library/com/google/cloud/example/library/v1/LibraryServiceSettings.java b/test/integration/goldens/library/com/google/cloud/example/library/v1/LibraryServiceSettings.java index b4d1a7f314..275bdbfbc4 100644 --- a/test/integration/goldens/library/com/google/cloud/example/library/v1/LibraryServiceSettings.java +++ b/test/integration/goldens/library/com/google/cloud/example/library/v1/LibraryServiceSettings.java @@ -71,18 +71,32 @@ *

For example, to set the total timeout of createShelf to 30 seconds: * *

{@code
- * LibraryServiceSettings.Builder libraryServiceSettingsBuilder =
- *     LibraryServiceSettings.newBuilder();
- * libraryServiceSettingsBuilder
- *     .createShelfSettings()
- *     .setRetrySettings(
- *         libraryServiceSettingsBuilder
- *             .createShelfSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * LibraryServiceSettings libraryServiceSettings = libraryServiceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.example.library.v1.LibraryServiceSettings;
+ * import java.time.Duration;
+ *
+ * public class LibraryServiceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     libraryServiceSettings();
+ *   }
+ *
+ *   public static void libraryServiceSettings() throws Exception {
+ *     LibraryServiceSettings.Builder libraryServiceSettingsBuilder =
+ *         LibraryServiceSettings.newBuilder();
+ *     libraryServiceSettingsBuilder
+ *         .createShelfSettings()
+ *         .setRetrySettings(
+ *             libraryServiceSettingsBuilder
+ *                 .createShelfSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     LibraryServiceSettings libraryServiceSettings = libraryServiceSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/library/com/google/cloud/example/library/v1/package-info.java b/test/integration/goldens/library/com/google/cloud/example/library/v1/package-info.java index 4e8bca3b27..dd48c61deb 100644 --- a/test/integration/goldens/library/com/google/cloud/example/library/v1/package-info.java +++ b/test/integration/goldens/library/com/google/cloud/example/library/v1/package-info.java @@ -31,9 +31,23 @@ *

Sample for LibraryServiceClient: * *

{@code
- * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- *   Shelf shelf = Shelf.newBuilder().build();
- *   Shelf response = libraryServiceClient.createShelf(shelf);
+ * package com.google.example;
+ *
+ * import com.google.cloud.example.library.v1.LibraryServiceClient;
+ * import com.google.example.library.v1.Shelf;
+ *
+ * public class LibraryServiceClientCreateShelf {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     libraryServiceClientCreateShelf();
+ *   }
+ *
+ *   public static void libraryServiceClientCreateShelf() throws Exception {
+ *     try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+ *       Shelf shelf = Shelf.newBuilder().build();
+ *       Shelf response = libraryServiceClient.createShelf(shelf);
+ *     }
+ *   }
  * }
  * }
*/ diff --git a/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java b/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java index 159cd561a6..1fb2b31278 100644 --- a/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java +++ b/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java @@ -85,18 +85,32 @@ *

For example, to set the total timeout of createShelf to 30 seconds: * *

{@code
- * LibraryServiceStubSettings.Builder libraryServiceSettingsBuilder =
- *     LibraryServiceStubSettings.newBuilder();
- * libraryServiceSettingsBuilder
- *     .createShelfSettings()
- *     .setRetrySettings(
- *         libraryServiceSettingsBuilder
- *             .createShelfSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * LibraryServiceStubSettings libraryServiceSettings = libraryServiceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.example.library.v1.stub.LibraryServiceStubSettings;
+ * import java.time.Duration;
+ *
+ * public class LibraryServiceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     libraryServiceSettings();
+ *   }
+ *
+ *   public static void libraryServiceSettings() throws Exception {
+ *     LibraryServiceStubSettings.Builder libraryServiceSettingsBuilder =
+ *         LibraryServiceStubSettings.newBuilder();
+ *     libraryServiceSettingsBuilder
+ *         .createShelfSettings()
+ *         .setRetrySettings(
+ *             libraryServiceSettingsBuilder
+ *                 .createShelfSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     LibraryServiceStubSettings libraryServiceSettings = libraryServiceSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/ConfigClient.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/ConfigClient.java index cf5b1db536..d3c1ad4440 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/ConfigClient.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/ConfigClient.java @@ -85,14 +85,30 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (ConfigClient configClient = ConfigClient.create()) {
- *   GetBucketRequest request =
- *       GetBucketRequest.newBuilder()
- *           .setName(
- *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
- *                   .toString())
- *           .build();
- *   LogBucket response = configClient.getBucket(request);
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.ConfigClient;
+ * import com.google.logging.v2.GetBucketRequest;
+ * import com.google.logging.v2.LogBucket;
+ * import com.google.logging.v2.LogBucketName;
+ *
+ * public class ConfigClientGetBucket {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     configClientGetBucket();
+ *   }
+ *
+ *   public static void configClientGetBucket() throws Exception {
+ *     try (ConfigClient configClient = ConfigClient.create()) {
+ *       GetBucketRequest request =
+ *           GetBucketRequest.newBuilder()
+ *               .setName(
+ *                   LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+ *                       .toString())
+ *               .build();
+ *       LogBucket response = configClient.getBucket(request);
+ *     }
+ *   }
  * }
  * }
* @@ -125,18 +141,49 @@ *

To customize credentials: * *

{@code
- * ConfigSettings configSettings =
- *     ConfigSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * ConfigClient configClient = ConfigClient.create(configSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.logging.v2.ConfigClient;
+ * import com.google.cloud.logging.v2.ConfigSettings;
+ * import com.google.cloud.logging.v2.myCredentials;
+ *
+ * public class ConfigClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     configClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void configClientSetCredentialsProvider() throws Exception {
+ *     ConfigSettings configSettings =
+ *         ConfigSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     ConfigClient configClient = ConfigClient.create(configSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * ConfigSettings configSettings = ConfigSettings.newBuilder().setEndpoint(myEndpoint).build();
- * ConfigClient configClient = ConfigClient.create(configSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.ConfigClient;
+ * import com.google.cloud.logging.v2.ConfigSettings;
+ * import com.google.cloud.logging.v2.myEndpoint;
+ *
+ * public class ConfigClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     configClientSetEndpoint();
+ *   }
+ *
+ *   public static void configClientSetEndpoint() throws Exception {
+ *     ConfigSettings configSettings = ConfigSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     ConfigClient configClient = ConfigClient.create(configSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -199,11 +246,26 @@ public ConfigServiceV2Stub getStub() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   BillingAccountLocationName parent =
-   *       BillingAccountLocationName.of("[BILLING_ACCOUNT]", "[LOCATION]");
-   *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.BillingAccountLocationName;
+   * import com.google.logging.v2.LogBucket;
+   *
+   * public class ConfigClientListBuckets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListBuckets();
+   *   }
+   *
+   *   public static void configClientListBuckets() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       BillingAccountLocationName parent =
+   *           BillingAccountLocationName.of("[BILLING_ACCOUNT]", "[LOCATION]");
+   *       for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -232,10 +294,25 @@ public final ListBucketsPagedResponse listBuckets(BillingAccountLocationName par *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   FolderLocationName parent = FolderLocationName.of("[FOLDER]", "[LOCATION]");
-   *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.FolderLocationName;
+   * import com.google.logging.v2.LogBucket;
+   *
+   * public class ConfigClientListBuckets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListBuckets();
+   *   }
+   *
+   *   public static void configClientListBuckets() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       FolderLocationName parent = FolderLocationName.of("[FOLDER]", "[LOCATION]");
+   *       for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -264,10 +341,25 @@ public final ListBucketsPagedResponse listBuckets(FolderLocationName parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LocationName;
+   * import com.google.logging.v2.LogBucket;
+   *
+   * public class ConfigClientListBuckets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListBuckets();
+   *   }
+   *
+   *   public static void configClientListBuckets() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *       for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -296,10 +388,25 @@ public final ListBucketsPagedResponse listBuckets(LocationName parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogBucket;
+   * import com.google.logging.v2.OrganizationLocationName;
+   *
+   * public class ConfigClientListBuckets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListBuckets();
+   *   }
+   *
+   *   public static void configClientListBuckets() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
+   *       for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -328,10 +435,25 @@ public final ListBucketsPagedResponse listBuckets(OrganizationLocationName paren *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
-   *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LocationName;
+   * import com.google.logging.v2.LogBucket;
+   *
+   * public class ConfigClientListBuckets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListBuckets();
+   *   }
+   *
+   *   public static void configClientListBuckets() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *       for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -357,15 +479,31 @@ public final ListBucketsPagedResponse listBuckets(String parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListBucketsRequest request =
-   *       ListBucketsRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   for (LogBucket element : configClient.listBuckets(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.ListBucketsRequest;
+   * import com.google.logging.v2.LocationName;
+   * import com.google.logging.v2.LogBucket;
+   *
+   * public class ConfigClientListBuckets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListBuckets();
+   *   }
+   *
+   *   public static void configClientListBuckets() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListBucketsRequest request =
+   *           ListBucketsRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       for (LogBucket element : configClient.listBuckets(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -384,17 +522,34 @@ public final ListBucketsPagedResponse listBuckets(ListBucketsRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListBucketsRequest request =
-   *       ListBucketsRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   ApiFuture future = configClient.listBucketsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (LogBucket element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.ListBucketsRequest;
+   * import com.google.logging.v2.LocationName;
+   * import com.google.logging.v2.LogBucket;
+   *
+   * public class ConfigClientListBuckets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListBuckets();
+   *   }
+   *
+   *   public static void configClientListBuckets() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListBucketsRequest request =
+   *           ListBucketsRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       ApiFuture future = configClient.listBucketsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (LogBucket element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -411,23 +566,41 @@ public final ListBucketsPagedResponse listBuckets(ListBucketsRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListBucketsRequest request =
-   *       ListBucketsRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   while (true) {
-   *     ListBucketsResponse response = configClient.listBucketsCallable().call(request);
-   *     for (LogBucket element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.common.base.Strings;
+   * import com.google.logging.v2.ListBucketsRequest;
+   * import com.google.logging.v2.ListBucketsResponse;
+   * import com.google.logging.v2.LocationName;
+   * import com.google.logging.v2.LogBucket;
+   *
+   * public class ConfigClientListBuckets {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListBuckets();
+   *   }
+   *
+   *   public static void configClientListBuckets() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListBucketsRequest request =
+   *           ListBucketsRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       while (true) {
+   *         ListBucketsResponse response = configClient.listBucketsCallable().call(request);
+   *         for (LogBucket element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -444,14 +617,30 @@ public final UnaryCallable listBucketsC
    * 

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   GetBucketRequest request =
-   *       GetBucketRequest.newBuilder()
-   *           .setName(
-   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
-   *                   .toString())
-   *           .build();
-   *   LogBucket response = configClient.getBucket(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.GetBucketRequest;
+   * import com.google.logging.v2.LogBucket;
+   * import com.google.logging.v2.LogBucketName;
+   *
+   * public class ConfigClientGetBucket {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetBucket();
+   *   }
+   *
+   *   public static void configClientGetBucket() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       GetBucketRequest request =
+   *           GetBucketRequest.newBuilder()
+   *               .setName(
+   *                   LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                       .toString())
+   *               .build();
+   *       LogBucket response = configClient.getBucket(request);
+   *     }
+   *   }
    * }
    * }
* @@ -469,16 +658,33 @@ public final LogBucket getBucket(GetBucketRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   GetBucketRequest request =
-   *       GetBucketRequest.newBuilder()
-   *           .setName(
-   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future = configClient.getBucketCallable().futureCall(request);
-   *   // Do something.
-   *   LogBucket response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.GetBucketRequest;
+   * import com.google.logging.v2.LogBucket;
+   * import com.google.logging.v2.LogBucketName;
+   *
+   * public class ConfigClientGetBucket {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetBucket();
+   *   }
+   *
+   *   public static void configClientGetBucket() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       GetBucketRequest request =
+   *           GetBucketRequest.newBuilder()
+   *               .setName(
+   *                   LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future = configClient.getBucketCallable().futureCall(request);
+   *       // Do something.
+   *       LogBucket response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -494,14 +700,30 @@ public final UnaryCallable getBucketCallable() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   CreateBucketRequest request =
-   *       CreateBucketRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setBucketId("bucketId-1603305307")
-   *           .setBucket(LogBucket.newBuilder().build())
-   *           .build();
-   *   LogBucket response = configClient.createBucket(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CreateBucketRequest;
+   * import com.google.logging.v2.LocationName;
+   * import com.google.logging.v2.LogBucket;
+   *
+   * public class ConfigClientCreateBucket {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateBucket();
+   *   }
+   *
+   *   public static void configClientCreateBucket() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       CreateBucketRequest request =
+   *           CreateBucketRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setBucketId("bucketId-1603305307")
+   *               .setBucket(LogBucket.newBuilder().build())
+   *               .build();
+   *       LogBucket response = configClient.createBucket(request);
+   *     }
+   *   }
    * }
    * }
* @@ -520,16 +742,33 @@ public final LogBucket createBucket(CreateBucketRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   CreateBucketRequest request =
-   *       CreateBucketRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setBucketId("bucketId-1603305307")
-   *           .setBucket(LogBucket.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = configClient.createBucketCallable().futureCall(request);
-   *   // Do something.
-   *   LogBucket response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CreateBucketRequest;
+   * import com.google.logging.v2.LocationName;
+   * import com.google.logging.v2.LogBucket;
+   *
+   * public class ConfigClientCreateBucket {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateBucket();
+   *   }
+   *
+   *   public static void configClientCreateBucket() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       CreateBucketRequest request =
+   *           CreateBucketRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setBucketId("bucketId-1603305307")
+   *               .setBucket(LogBucket.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = configClient.createBucketCallable().futureCall(request);
+   *       // Do something.
+   *       LogBucket response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -553,16 +792,33 @@ public final UnaryCallable createBucketCallable( *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UpdateBucketRequest request =
-   *       UpdateBucketRequest.newBuilder()
-   *           .setName(
-   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
-   *                   .toString())
-   *           .setBucket(LogBucket.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   LogBucket response = configClient.updateBucket(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogBucket;
+   * import com.google.logging.v2.LogBucketName;
+   * import com.google.logging.v2.UpdateBucketRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateBucket {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateBucket();
+   *   }
+   *
+   *   public static void configClientUpdateBucket() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UpdateBucketRequest request =
+   *           UpdateBucketRequest.newBuilder()
+   *               .setName(
+   *                   LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                       .toString())
+   *               .setBucket(LogBucket.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       LogBucket response = configClient.updateBucket(request);
+   *     }
+   *   }
    * }
    * }
* @@ -589,18 +845,36 @@ public final LogBucket updateBucket(UpdateBucketRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UpdateBucketRequest request =
-   *       UpdateBucketRequest.newBuilder()
-   *           .setName(
-   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
-   *                   .toString())
-   *           .setBucket(LogBucket.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = configClient.updateBucketCallable().futureCall(request);
-   *   // Do something.
-   *   LogBucket response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogBucket;
+   * import com.google.logging.v2.LogBucketName;
+   * import com.google.logging.v2.UpdateBucketRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateBucket {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateBucket();
+   *   }
+   *
+   *   public static void configClientUpdateBucket() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UpdateBucketRequest request =
+   *           UpdateBucketRequest.newBuilder()
+   *               .setName(
+   *                   LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                       .toString())
+   *               .setBucket(LogBucket.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = configClient.updateBucketCallable().futureCall(request);
+   *       // Do something.
+   *       LogBucket response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -616,14 +890,30 @@ public final UnaryCallable updateBucketCallable( *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   DeleteBucketRequest request =
-   *       DeleteBucketRequest.newBuilder()
-   *           .setName(
-   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
-   *                   .toString())
-   *           .build();
-   *   configClient.deleteBucket(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.DeleteBucketRequest;
+   * import com.google.logging.v2.LogBucketName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteBucket {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteBucket();
+   *   }
+   *
+   *   public static void configClientDeleteBucket() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       DeleteBucketRequest request =
+   *           DeleteBucketRequest.newBuilder()
+   *               .setName(
+   *                   LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                       .toString())
+   *               .build();
+   *       configClient.deleteBucket(request);
+   *     }
+   *   }
    * }
    * }
* @@ -642,16 +932,33 @@ public final void deleteBucket(DeleteBucketRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   DeleteBucketRequest request =
-   *       DeleteBucketRequest.newBuilder()
-   *           .setName(
-   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future = configClient.deleteBucketCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.DeleteBucketRequest;
+   * import com.google.logging.v2.LogBucketName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteBucket {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteBucket();
+   *   }
+   *
+   *   public static void configClientDeleteBucket() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       DeleteBucketRequest request =
+   *           DeleteBucketRequest.newBuilder()
+   *               .setName(
+   *                   LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future = configClient.deleteBucketCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -667,14 +974,30 @@ public final UnaryCallable deleteBucketCallable() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UndeleteBucketRequest request =
-   *       UndeleteBucketRequest.newBuilder()
-   *           .setName(
-   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
-   *                   .toString())
-   *           .build();
-   *   configClient.undeleteBucket(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogBucketName;
+   * import com.google.logging.v2.UndeleteBucketRequest;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientUndeleteBucket {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUndeleteBucket();
+   *   }
+   *
+   *   public static void configClientUndeleteBucket() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UndeleteBucketRequest request =
+   *           UndeleteBucketRequest.newBuilder()
+   *               .setName(
+   *                   LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                       .toString())
+   *               .build();
+   *       configClient.undeleteBucket(request);
+   *     }
+   *   }
    * }
    * }
* @@ -693,16 +1016,33 @@ public final void undeleteBucket(UndeleteBucketRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UndeleteBucketRequest request =
-   *       UndeleteBucketRequest.newBuilder()
-   *           .setName(
-   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future = configClient.undeleteBucketCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogBucketName;
+   * import com.google.logging.v2.UndeleteBucketRequest;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientUndeleteBucket {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUndeleteBucket();
+   *   }
+   *
+   *   public static void configClientUndeleteBucket() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UndeleteBucketRequest request =
+   *           UndeleteBucketRequest.newBuilder()
+   *               .setName(
+   *                   LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future = configClient.undeleteBucketCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -717,10 +1057,24 @@ public final UnaryCallable undeleteBucketCallable( *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String parent = "parent-995424086";
-   *   for (LogView element : configClient.listViews(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogView;
+   *
+   * public class ConfigClientListViews {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListViews();
+   *   }
+   *
+   *   public static void configClientListViews() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String parent = "parent-995424086";
+   *       for (LogView element : configClient.listViews(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -741,15 +1095,30 @@ public final ListViewsPagedResponse listViews(String parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListViewsRequest request =
-   *       ListViewsRequest.newBuilder()
-   *           .setParent("parent-995424086")
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   for (LogView element : configClient.listViews(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.ListViewsRequest;
+   * import com.google.logging.v2.LogView;
+   *
+   * public class ConfigClientListViews {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListViews();
+   *   }
+   *
+   *   public static void configClientListViews() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListViewsRequest request =
+   *           ListViewsRequest.newBuilder()
+   *               .setParent("parent-995424086")
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       for (LogView element : configClient.listViews(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -768,17 +1137,33 @@ public final ListViewsPagedResponse listViews(ListViewsRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListViewsRequest request =
-   *       ListViewsRequest.newBuilder()
-   *           .setParent("parent-995424086")
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   ApiFuture future = configClient.listViewsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (LogView element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.ListViewsRequest;
+   * import com.google.logging.v2.LogView;
+   *
+   * public class ConfigClientListViews {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListViews();
+   *   }
+   *
+   *   public static void configClientListViews() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListViewsRequest request =
+   *           ListViewsRequest.newBuilder()
+   *               .setParent("parent-995424086")
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       ApiFuture future = configClient.listViewsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (LogView element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -794,23 +1179,40 @@ public final UnaryCallable listViewsPa *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListViewsRequest request =
-   *       ListViewsRequest.newBuilder()
-   *           .setParent("parent-995424086")
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   while (true) {
-   *     ListViewsResponse response = configClient.listViewsCallable().call(request);
-   *     for (LogView element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.common.base.Strings;
+   * import com.google.logging.v2.ListViewsRequest;
+   * import com.google.logging.v2.ListViewsResponse;
+   * import com.google.logging.v2.LogView;
+   *
+   * public class ConfigClientListViews {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListViews();
+   *   }
+   *
+   *   public static void configClientListViews() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListViewsRequest request =
+   *           ListViewsRequest.newBuilder()
+   *               .setParent("parent-995424086")
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       while (true) {
+   *         ListViewsResponse response = configClient.listViewsCallable().call(request);
+   *         for (LogView element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -827,15 +1229,31 @@ public final UnaryCallable listViewsCallabl
    * 

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   GetViewRequest request =
-   *       GetViewRequest.newBuilder()
-   *           .setName(
-   *               LogViewName.ofProjectLocationBucketViewName(
-   *                       "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
-   *                   .toString())
-   *           .build();
-   *   LogView response = configClient.getView(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.GetViewRequest;
+   * import com.google.logging.v2.LogView;
+   * import com.google.logging.v2.LogViewName;
+   *
+   * public class ConfigClientGetView {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetView();
+   *   }
+   *
+   *   public static void configClientGetView() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       GetViewRequest request =
+   *           GetViewRequest.newBuilder()
+   *               .setName(
+   *                   LogViewName.ofProjectLocationBucketViewName(
+   *                           "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
+   *                       .toString())
+   *               .build();
+   *       LogView response = configClient.getView(request);
+   *     }
+   *   }
    * }
    * }
* @@ -853,17 +1271,34 @@ public final LogView getView(GetViewRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   GetViewRequest request =
-   *       GetViewRequest.newBuilder()
-   *           .setName(
-   *               LogViewName.ofProjectLocationBucketViewName(
-   *                       "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future = configClient.getViewCallable().futureCall(request);
-   *   // Do something.
-   *   LogView response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.GetViewRequest;
+   * import com.google.logging.v2.LogView;
+   * import com.google.logging.v2.LogViewName;
+   *
+   * public class ConfigClientGetView {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetView();
+   *   }
+   *
+   *   public static void configClientGetView() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       GetViewRequest request =
+   *           GetViewRequest.newBuilder()
+   *               .setName(
+   *                   LogViewName.ofProjectLocationBucketViewName(
+   *                           "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future = configClient.getViewCallable().futureCall(request);
+   *       // Do something.
+   *       LogView response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -878,14 +1313,29 @@ public final UnaryCallable getViewCallable() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   CreateViewRequest request =
-   *       CreateViewRequest.newBuilder()
-   *           .setParent("parent-995424086")
-   *           .setViewId("viewId-816632160")
-   *           .setView(LogView.newBuilder().build())
-   *           .build();
-   *   LogView response = configClient.createView(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CreateViewRequest;
+   * import com.google.logging.v2.LogView;
+   *
+   * public class ConfigClientCreateView {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateView();
+   *   }
+   *
+   *   public static void configClientCreateView() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       CreateViewRequest request =
+   *           CreateViewRequest.newBuilder()
+   *               .setParent("parent-995424086")
+   *               .setViewId("viewId-816632160")
+   *               .setView(LogView.newBuilder().build())
+   *               .build();
+   *       LogView response = configClient.createView(request);
+   *     }
+   *   }
    * }
    * }
* @@ -903,16 +1353,32 @@ public final LogView createView(CreateViewRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   CreateViewRequest request =
-   *       CreateViewRequest.newBuilder()
-   *           .setParent("parent-995424086")
-   *           .setViewId("viewId-816632160")
-   *           .setView(LogView.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = configClient.createViewCallable().futureCall(request);
-   *   // Do something.
-   *   LogView response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CreateViewRequest;
+   * import com.google.logging.v2.LogView;
+   *
+   * public class ConfigClientCreateView {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateView();
+   *   }
+   *
+   *   public static void configClientCreateView() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       CreateViewRequest request =
+   *           CreateViewRequest.newBuilder()
+   *               .setParent("parent-995424086")
+   *               .setViewId("viewId-816632160")
+   *               .setView(LogView.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = configClient.createViewCallable().futureCall(request);
+   *       // Do something.
+   *       LogView response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -928,14 +1394,30 @@ public final UnaryCallable createViewCallable() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UpdateViewRequest request =
-   *       UpdateViewRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setView(LogView.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   LogView response = configClient.updateView(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogView;
+   * import com.google.logging.v2.UpdateViewRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateView {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateView();
+   *   }
+   *
+   *   public static void configClientUpdateView() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UpdateViewRequest request =
+   *           UpdateViewRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setView(LogView.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       LogView response = configClient.updateView(request);
+   *     }
+   *   }
    * }
    * }
* @@ -954,16 +1436,33 @@ public final LogView updateView(UpdateViewRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UpdateViewRequest request =
-   *       UpdateViewRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setView(LogView.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = configClient.updateViewCallable().futureCall(request);
-   *   // Do something.
-   *   LogView response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogView;
+   * import com.google.logging.v2.UpdateViewRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateView {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateView();
+   *   }
+   *
+   *   public static void configClientUpdateView() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UpdateViewRequest request =
+   *           UpdateViewRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setView(LogView.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = configClient.updateViewCallable().futureCall(request);
+   *       // Do something.
+   *       LogView response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -978,15 +1477,31 @@ public final UnaryCallable updateViewCallable() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   DeleteViewRequest request =
-   *       DeleteViewRequest.newBuilder()
-   *           .setName(
-   *               LogViewName.ofProjectLocationBucketViewName(
-   *                       "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
-   *                   .toString())
-   *           .build();
-   *   configClient.deleteView(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.DeleteViewRequest;
+   * import com.google.logging.v2.LogViewName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteView {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteView();
+   *   }
+   *
+   *   public static void configClientDeleteView() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       DeleteViewRequest request =
+   *           DeleteViewRequest.newBuilder()
+   *               .setName(
+   *                   LogViewName.ofProjectLocationBucketViewName(
+   *                           "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
+   *                       .toString())
+   *               .build();
+   *       configClient.deleteView(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1004,17 +1519,34 @@ public final void deleteView(DeleteViewRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   DeleteViewRequest request =
-   *       DeleteViewRequest.newBuilder()
-   *           .setName(
-   *               LogViewName.ofProjectLocationBucketViewName(
-   *                       "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
-   *                   .toString())
-   *           .build();
-   *   ApiFuture future = configClient.deleteViewCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.DeleteViewRequest;
+   * import com.google.logging.v2.LogViewName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteView {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteView();
+   *   }
+   *
+   *   public static void configClientDeleteView() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       DeleteViewRequest request =
+   *           DeleteViewRequest.newBuilder()
+   *               .setName(
+   *                   LogViewName.ofProjectLocationBucketViewName(
+   *                           "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
+   *                       .toString())
+   *               .build();
+   *       ApiFuture future = configClient.deleteViewCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1029,10 +1561,25 @@ public final UnaryCallable deleteViewCallable() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
-   *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.BillingAccountName;
+   * import com.google.logging.v2.LogSink;
+   *
+   * public class ConfigClientListSinks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListSinks();
+   *   }
+   *
+   *   public static void configClientListSinks() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *       for (LogSink element : configClient.listSinks(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1055,10 +1602,25 @@ public final ListSinksPagedResponse listSinks(BillingAccountName parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   FolderName parent = FolderName.of("[FOLDER]");
-   *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.FolderName;
+   * import com.google.logging.v2.LogSink;
+   *
+   * public class ConfigClientListSinks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListSinks();
+   *   }
+   *
+   *   public static void configClientListSinks() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       FolderName parent = FolderName.of("[FOLDER]");
+   *       for (LogSink element : configClient.listSinks(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1081,10 +1643,25 @@ public final ListSinksPagedResponse listSinks(FolderName parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
-   *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.OrganizationName;
+   *
+   * public class ConfigClientListSinks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListSinks();
+   *   }
+   *
+   *   public static void configClientListSinks() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *       for (LogSink element : configClient.listSinks(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1107,10 +1684,25 @@ public final ListSinksPagedResponse listSinks(OrganizationName parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientListSinks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListSinks();
+   *   }
+   *
+   *   public static void configClientListSinks() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ProjectName parent = ProjectName.of("[PROJECT]");
+   *       for (LogSink element : configClient.listSinks(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1133,10 +1725,25 @@ public final ListSinksPagedResponse listSinks(ProjectName parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String parent = ProjectName.of("[PROJECT]").toString();
-   *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientListSinks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListSinks();
+   *   }
+   *
+   *   public static void configClientListSinks() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String parent = ProjectName.of("[PROJECT]").toString();
+   *       for (LogSink element : configClient.listSinks(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1158,15 +1765,31 @@ public final ListSinksPagedResponse listSinks(String parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListSinksRequest request =
-   *       ListSinksRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   for (LogSink element : configClient.listSinks(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.ListSinksRequest;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientListSinks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListSinks();
+   *   }
+   *
+   *   public static void configClientListSinks() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListSinksRequest request =
+   *           ListSinksRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       for (LogSink element : configClient.listSinks(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1185,17 +1808,34 @@ public final ListSinksPagedResponse listSinks(ListSinksRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListSinksRequest request =
-   *       ListSinksRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   ApiFuture future = configClient.listSinksPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (LogSink element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.ListSinksRequest;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientListSinks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListSinks();
+   *   }
+   *
+   *   public static void configClientListSinks() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListSinksRequest request =
+   *           ListSinksRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       ApiFuture future = configClient.listSinksPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (LogSink element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1211,23 +1851,41 @@ public final UnaryCallable listSinksPa *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListSinksRequest request =
-   *       ListSinksRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   while (true) {
-   *     ListSinksResponse response = configClient.listSinksCallable().call(request);
-   *     for (LogSink element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.common.base.Strings;
+   * import com.google.logging.v2.ListSinksRequest;
+   * import com.google.logging.v2.ListSinksResponse;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientListSinks {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListSinks();
+   *   }
+   *
+   *   public static void configClientListSinks() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListSinksRequest request =
+   *           ListSinksRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       while (true) {
+   *         ListSinksResponse response = configClient.listSinksCallable().call(request);
+   *         for (LogSink element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -1244,9 +1902,24 @@ public final UnaryCallable listSinksCallabl
    * 

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
-   *   LogSink response = configClient.getSink(sinkName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.LogSinkName;
+   *
+   * public class ConfigClientGetSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetSink();
+   *   }
+   *
+   *   public static void configClientGetSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+   *       LogSink response = configClient.getSink(sinkName);
+   *     }
+   *   }
    * }
    * }
* @@ -1273,9 +1946,24 @@ public final LogSink getSink(LogSinkName sinkName) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
-   *   LogSink response = configClient.getSink(sinkName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.LogSinkName;
+   *
+   * public class ConfigClientGetSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetSink();
+   *   }
+   *
+   *   public static void configClientGetSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
+   *       LogSink response = configClient.getSink(sinkName);
+   *     }
+   *   }
    * }
    * }
* @@ -1299,12 +1987,28 @@ public final LogSink getSink(String sinkName) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   GetSinkRequest request =
-   *       GetSinkRequest.newBuilder()
-   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
-   *           .build();
-   *   LogSink response = configClient.getSink(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.GetSinkRequest;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.LogSinkName;
+   *
+   * public class ConfigClientGetSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetSink();
+   *   }
+   *
+   *   public static void configClientGetSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       GetSinkRequest request =
+   *           GetSinkRequest.newBuilder()
+   *               .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *               .build();
+   *       LogSink response = configClient.getSink(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1322,14 +2026,31 @@ public final LogSink getSink(GetSinkRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   GetSinkRequest request =
-   *       GetSinkRequest.newBuilder()
-   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
-   *           .build();
-   *   ApiFuture future = configClient.getSinkCallable().futureCall(request);
-   *   // Do something.
-   *   LogSink response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.GetSinkRequest;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.LogSinkName;
+   *
+   * public class ConfigClientGetSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetSink();
+   *   }
+   *
+   *   public static void configClientGetSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       GetSinkRequest request =
+   *           GetSinkRequest.newBuilder()
+   *               .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *               .build();
+   *       ApiFuture future = configClient.getSinkCallable().futureCall(request);
+   *       // Do something.
+   *       LogSink response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1347,10 +2068,25 @@ public final UnaryCallable getSinkCallable() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
-   *   LogSink sink = LogSink.newBuilder().build();
-   *   LogSink response = configClient.createSink(parent, sink);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.BillingAccountName;
+   * import com.google.logging.v2.LogSink;
+   *
+   * public class ConfigClientCreateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateSink();
+   *   }
+   *
+   *   public static void configClientCreateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *       LogSink sink = LogSink.newBuilder().build();
+   *       LogSink response = configClient.createSink(parent, sink);
+   *     }
+   *   }
    * }
    * }
* @@ -1381,10 +2117,25 @@ public final LogSink createSink(BillingAccountName parent, LogSink sink) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   FolderName parent = FolderName.of("[FOLDER]");
-   *   LogSink sink = LogSink.newBuilder().build();
-   *   LogSink response = configClient.createSink(parent, sink);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.FolderName;
+   * import com.google.logging.v2.LogSink;
+   *
+   * public class ConfigClientCreateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateSink();
+   *   }
+   *
+   *   public static void configClientCreateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       FolderName parent = FolderName.of("[FOLDER]");
+   *       LogSink sink = LogSink.newBuilder().build();
+   *       LogSink response = configClient.createSink(parent, sink);
+   *     }
+   *   }
    * }
    * }
* @@ -1415,10 +2166,25 @@ public final LogSink createSink(FolderName parent, LogSink sink) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
-   *   LogSink sink = LogSink.newBuilder().build();
-   *   LogSink response = configClient.createSink(parent, sink);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.OrganizationName;
+   *
+   * public class ConfigClientCreateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateSink();
+   *   }
+   *
+   *   public static void configClientCreateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *       LogSink sink = LogSink.newBuilder().build();
+   *       LogSink response = configClient.createSink(parent, sink);
+   *     }
+   *   }
    * }
    * }
* @@ -1449,10 +2215,25 @@ public final LogSink createSink(OrganizationName parent, LogSink sink) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   LogSink sink = LogSink.newBuilder().build();
-   *   LogSink response = configClient.createSink(parent, sink);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientCreateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateSink();
+   *   }
+   *
+   *   public static void configClientCreateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ProjectName parent = ProjectName.of("[PROJECT]");
+   *       LogSink sink = LogSink.newBuilder().build();
+   *       LogSink response = configClient.createSink(parent, sink);
+   *     }
+   *   }
    * }
    * }
* @@ -1483,10 +2264,25 @@ public final LogSink createSink(ProjectName parent, LogSink sink) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String parent = ProjectName.of("[PROJECT]").toString();
-   *   LogSink sink = LogSink.newBuilder().build();
-   *   LogSink response = configClient.createSink(parent, sink);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientCreateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateSink();
+   *   }
+   *
+   *   public static void configClientCreateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String parent = ProjectName.of("[PROJECT]").toString();
+   *       LogSink sink = LogSink.newBuilder().build();
+   *       LogSink response = configClient.createSink(parent, sink);
+   *     }
+   *   }
    * }
    * }
* @@ -1514,14 +2310,30 @@ public final LogSink createSink(String parent, LogSink sink) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   CreateSinkRequest request =
-   *       CreateSinkRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setSink(LogSink.newBuilder().build())
-   *           .setUniqueWriterIdentity(true)
-   *           .build();
-   *   LogSink response = configClient.createSink(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CreateSinkRequest;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientCreateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateSink();
+   *   }
+   *
+   *   public static void configClientCreateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       CreateSinkRequest request =
+   *           CreateSinkRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setSink(LogSink.newBuilder().build())
+   *               .setUniqueWriterIdentity(true)
+   *               .build();
+   *       LogSink response = configClient.createSink(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1542,16 +2354,33 @@ public final LogSink createSink(CreateSinkRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   CreateSinkRequest request =
-   *       CreateSinkRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setSink(LogSink.newBuilder().build())
-   *           .setUniqueWriterIdentity(true)
-   *           .build();
-   *   ApiFuture future = configClient.createSinkCallable().futureCall(request);
-   *   // Do something.
-   *   LogSink response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CreateSinkRequest;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientCreateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateSink();
+   *   }
+   *
+   *   public static void configClientCreateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       CreateSinkRequest request =
+   *           CreateSinkRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setSink(LogSink.newBuilder().build())
+   *               .setUniqueWriterIdentity(true)
+   *               .build();
+   *       ApiFuture future = configClient.createSinkCallable().futureCall(request);
+   *       // Do something.
+   *       LogSink response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1570,10 +2399,25 @@ public final UnaryCallable createSinkCallable() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
-   *   LogSink sink = LogSink.newBuilder().build();
-   *   LogSink response = configClient.updateSink(sinkName, sink);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.LogSinkName;
+   *
+   * public class ConfigClientUpdateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateSink();
+   *   }
+   *
+   *   public static void configClientUpdateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+   *       LogSink sink = LogSink.newBuilder().build();
+   *       LogSink response = configClient.updateSink(sinkName, sink);
+   *     }
+   *   }
    * }
    * }
* @@ -1608,10 +2452,25 @@ public final LogSink updateSink(LogSinkName sinkName, LogSink sink) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
-   *   LogSink sink = LogSink.newBuilder().build();
-   *   LogSink response = configClient.updateSink(sinkName, sink);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.LogSinkName;
+   *
+   * public class ConfigClientUpdateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateSink();
+   *   }
+   *
+   *   public static void configClientUpdateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
+   *       LogSink sink = LogSink.newBuilder().build();
+   *       LogSink response = configClient.updateSink(sinkName, sink);
+   *     }
+   *   }
    * }
    * }
* @@ -1643,11 +2502,27 @@ public final LogSink updateSink(String sinkName, LogSink sink) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
-   *   LogSink sink = LogSink.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   LogSink response = configClient.updateSink(sinkName, sink, updateMask);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.LogSinkName;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateSink();
+   *   }
+   *
+   *   public static void configClientUpdateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+   *       LogSink sink = LogSink.newBuilder().build();
+   *       FieldMask updateMask = FieldMask.newBuilder().build();
+   *       LogSink response = configClient.updateSink(sinkName, sink, updateMask);
+   *     }
+   *   }
    * }
    * }
* @@ -1689,14 +2564,30 @@ public final LogSink updateSink(LogSinkName sinkName, LogSink sink, FieldMask up *

The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` * field. * - *

Sample code: + *

Sample code: + * + *

{@code
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.LogSinkName;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateSink();
+   *   }
    *
-   * 
{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
-   *   LogSink sink = LogSink.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   LogSink response = configClient.updateSink(sinkName, sink, updateMask);
+   *   public static void configClientUpdateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
+   *       LogSink sink = LogSink.newBuilder().build();
+   *       FieldMask updateMask = FieldMask.newBuilder().build();
+   *       LogSink response = configClient.updateSink(sinkName, sink, updateMask);
+   *     }
+   *   }
    * }
    * }
* @@ -1741,15 +2632,32 @@ public final LogSink updateSink(String sinkName, LogSink sink, FieldMask updateM *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UpdateSinkRequest request =
-   *       UpdateSinkRequest.newBuilder()
-   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
-   *           .setSink(LogSink.newBuilder().build())
-   *           .setUniqueWriterIdentity(true)
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   LogSink response = configClient.updateSink(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.LogSinkName;
+   * import com.google.logging.v2.UpdateSinkRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateSink();
+   *   }
+   *
+   *   public static void configClientUpdateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UpdateSinkRequest request =
+   *           UpdateSinkRequest.newBuilder()
+   *               .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *               .setSink(LogSink.newBuilder().build())
+   *               .setUniqueWriterIdentity(true)
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       LogSink response = configClient.updateSink(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1771,17 +2679,35 @@ public final LogSink updateSink(UpdateSinkRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UpdateSinkRequest request =
-   *       UpdateSinkRequest.newBuilder()
-   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
-   *           .setSink(LogSink.newBuilder().build())
-   *           .setUniqueWriterIdentity(true)
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = configClient.updateSinkCallable().futureCall(request);
-   *   // Do something.
-   *   LogSink response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSink;
+   * import com.google.logging.v2.LogSinkName;
+   * import com.google.logging.v2.UpdateSinkRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateSink();
+   *   }
+   *
+   *   public static void configClientUpdateSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UpdateSinkRequest request =
+   *           UpdateSinkRequest.newBuilder()
+   *               .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *               .setSink(LogSink.newBuilder().build())
+   *               .setUniqueWriterIdentity(true)
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = configClient.updateSinkCallable().futureCall(request);
+   *       // Do something.
+   *       LogSink response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1797,9 +2723,24 @@ public final UnaryCallable updateSinkCallable() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
-   *   configClient.deleteSink(sinkName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSinkName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteSink();
+   *   }
+   *
+   *   public static void configClientDeleteSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+   *       configClient.deleteSink(sinkName);
+   *     }
+   *   }
    * }
    * }
* @@ -1828,9 +2769,24 @@ public final void deleteSink(LogSinkName sinkName) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
-   *   configClient.deleteSink(sinkName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogSinkName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteSink();
+   *   }
+   *
+   *   public static void configClientDeleteSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
+   *       configClient.deleteSink(sinkName);
+   *     }
+   *   }
    * }
    * }
* @@ -1856,12 +2812,28 @@ public final void deleteSink(String sinkName) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   DeleteSinkRequest request =
-   *       DeleteSinkRequest.newBuilder()
-   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
-   *           .build();
-   *   configClient.deleteSink(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.DeleteSinkRequest;
+   * import com.google.logging.v2.LogSinkName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteSink();
+   *   }
+   *
+   *   public static void configClientDeleteSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       DeleteSinkRequest request =
+   *           DeleteSinkRequest.newBuilder()
+   *               .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *               .build();
+   *       configClient.deleteSink(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1880,14 +2852,31 @@ public final void deleteSink(DeleteSinkRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   DeleteSinkRequest request =
-   *       DeleteSinkRequest.newBuilder()
-   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
-   *           .build();
-   *   ApiFuture future = configClient.deleteSinkCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.DeleteSinkRequest;
+   * import com.google.logging.v2.LogSinkName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteSink {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteSink();
+   *   }
+   *
+   *   public static void configClientDeleteSink() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       DeleteSinkRequest request =
+   *           DeleteSinkRequest.newBuilder()
+   *               .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *               .build();
+   *       ApiFuture future = configClient.deleteSinkCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1902,10 +2891,25 @@ public final UnaryCallable deleteSinkCallable() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
-   *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.BillingAccountName;
+   * import com.google.logging.v2.LogExclusion;
+   *
+   * public class ConfigClientListExclusions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListExclusions();
+   *   }
+   *
+   *   public static void configClientListExclusions() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *       for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1930,10 +2934,25 @@ public final ListExclusionsPagedResponse listExclusions(BillingAccountName paren *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   FolderName parent = FolderName.of("[FOLDER]");
-   *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.FolderName;
+   * import com.google.logging.v2.LogExclusion;
+   *
+   * public class ConfigClientListExclusions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListExclusions();
+   *   }
+   *
+   *   public static void configClientListExclusions() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       FolderName parent = FolderName.of("[FOLDER]");
+   *       for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1958,10 +2977,25 @@ public final ListExclusionsPagedResponse listExclusions(FolderName parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
-   *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.OrganizationName;
+   *
+   * public class ConfigClientListExclusions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListExclusions();
+   *   }
+   *
+   *   public static void configClientListExclusions() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *       for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1986,10 +3020,25 @@ public final ListExclusionsPagedResponse listExclusions(OrganizationName parent) *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientListExclusions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListExclusions();
+   *   }
+   *
+   *   public static void configClientListExclusions() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ProjectName parent = ProjectName.of("[PROJECT]");
+   *       for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -2014,10 +3063,25 @@ public final ListExclusionsPagedResponse listExclusions(ProjectName parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String parent = ProjectName.of("[PROJECT]").toString();
-   *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientListExclusions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListExclusions();
+   *   }
+   *
+   *   public static void configClientListExclusions() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String parent = ProjectName.of("[PROJECT]").toString();
+   *       for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -2039,15 +3103,31 @@ public final ListExclusionsPagedResponse listExclusions(String parent) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListExclusionsRequest request =
-   *       ListExclusionsRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   for (LogExclusion element : configClient.listExclusions(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.ListExclusionsRequest;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientListExclusions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListExclusions();
+   *   }
+   *
+   *   public static void configClientListExclusions() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListExclusionsRequest request =
+   *           ListExclusionsRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       for (LogExclusion element : configClient.listExclusions(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -2066,18 +3146,35 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListExclusionsRequest request =
-   *       ListExclusionsRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   ApiFuture future =
-   *       configClient.listExclusionsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (LogExclusion element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.ListExclusionsRequest;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientListExclusions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListExclusions();
+   *   }
+   *
+   *   public static void configClientListExclusions() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListExclusionsRequest request =
+   *           ListExclusionsRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       ApiFuture future =
+   *           configClient.listExclusionsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (LogExclusion element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -2094,23 +3191,41 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ListExclusionsRequest request =
-   *       ListExclusionsRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   while (true) {
-   *     ListExclusionsResponse response = configClient.listExclusionsCallable().call(request);
-   *     for (LogExclusion element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.common.base.Strings;
+   * import com.google.logging.v2.ListExclusionsRequest;
+   * import com.google.logging.v2.ListExclusionsResponse;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientListExclusions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientListExclusions();
+   *   }
+   *
+   *   public static void configClientListExclusions() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ListExclusionsRequest request =
+   *           ListExclusionsRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       while (true) {
+   *         ListExclusionsResponse response = configClient.listExclusionsCallable().call(request);
+   *         for (LogExclusion element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -2128,9 +3243,24 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re
    * 

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
-   *   LogExclusion response = configClient.getExclusion(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.LogExclusionName;
+   *
+   * public class ConfigClientGetExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetExclusion();
+   *   }
+   *
+   *   public static void configClientGetExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+   *       LogExclusion response = configClient.getExclusion(name);
+   *     }
+   *   }
    * }
    * }
* @@ -2155,9 +3285,24 @@ public final LogExclusion getExclusion(LogExclusionName name) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
-   *   LogExclusion response = configClient.getExclusion(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.LogExclusionName;
+   *
+   * public class ConfigClientGetExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetExclusion();
+   *   }
+   *
+   *   public static void configClientGetExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
+   *       LogExclusion response = configClient.getExclusion(name);
+   *     }
+   *   }
    * }
    * }
* @@ -2181,13 +3326,29 @@ public final LogExclusion getExclusion(String name) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   GetExclusionRequest request =
-   *       GetExclusionRequest.newBuilder()
-   *           .setName(
-   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
-   *           .build();
-   *   LogExclusion response = configClient.getExclusion(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.GetExclusionRequest;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.LogExclusionName;
+   *
+   * public class ConfigClientGetExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetExclusion();
+   *   }
+   *
+   *   public static void configClientGetExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       GetExclusionRequest request =
+   *           GetExclusionRequest.newBuilder()
+   *               .setName(
+   *                   LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *               .build();
+   *       LogExclusion response = configClient.getExclusion(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2205,15 +3366,32 @@ public final LogExclusion getExclusion(GetExclusionRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   GetExclusionRequest request =
-   *       GetExclusionRequest.newBuilder()
-   *           .setName(
-   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
-   *           .build();
-   *   ApiFuture future = configClient.getExclusionCallable().futureCall(request);
-   *   // Do something.
-   *   LogExclusion response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.GetExclusionRequest;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.LogExclusionName;
+   *
+   * public class ConfigClientGetExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetExclusion();
+   *   }
+   *
+   *   public static void configClientGetExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       GetExclusionRequest request =
+   *           GetExclusionRequest.newBuilder()
+   *               .setName(
+   *                   LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *               .build();
+   *       ApiFuture future = configClient.getExclusionCallable().futureCall(request);
+   *       // Do something.
+   *       LogExclusion response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2229,10 +3407,25 @@ public final UnaryCallable getExclusionCallab *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
-   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
-   *   LogExclusion response = configClient.createExclusion(parent, exclusion);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.BillingAccountName;
+   * import com.google.logging.v2.LogExclusion;
+   *
+   * public class ConfigClientCreateExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateExclusion();
+   *   }
+   *
+   *   public static void configClientCreateExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *       LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *       LogExclusion response = configClient.createExclusion(parent, exclusion);
+   *     }
+   *   }
    * }
    * }
* @@ -2261,10 +3454,25 @@ public final LogExclusion createExclusion(BillingAccountName parent, LogExclusio *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   FolderName parent = FolderName.of("[FOLDER]");
-   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
-   *   LogExclusion response = configClient.createExclusion(parent, exclusion);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.FolderName;
+   * import com.google.logging.v2.LogExclusion;
+   *
+   * public class ConfigClientCreateExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateExclusion();
+   *   }
+   *
+   *   public static void configClientCreateExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       FolderName parent = FolderName.of("[FOLDER]");
+   *       LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *       LogExclusion response = configClient.createExclusion(parent, exclusion);
+   *     }
+   *   }
    * }
    * }
* @@ -2293,10 +3501,25 @@ public final LogExclusion createExclusion(FolderName parent, LogExclusion exclus *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
-   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
-   *   LogExclusion response = configClient.createExclusion(parent, exclusion);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.OrganizationName;
+   *
+   * public class ConfigClientCreateExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateExclusion();
+   *   }
+   *
+   *   public static void configClientCreateExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *       LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *       LogExclusion response = configClient.createExclusion(parent, exclusion);
+   *     }
+   *   }
    * }
    * }
* @@ -2325,10 +3548,25 @@ public final LogExclusion createExclusion(OrganizationName parent, LogExclusion *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
-   *   LogExclusion response = configClient.createExclusion(parent, exclusion);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientCreateExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateExclusion();
+   *   }
+   *
+   *   public static void configClientCreateExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       ProjectName parent = ProjectName.of("[PROJECT]");
+   *       LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *       LogExclusion response = configClient.createExclusion(parent, exclusion);
+   *     }
+   *   }
    * }
    * }
* @@ -2357,10 +3595,25 @@ public final LogExclusion createExclusion(ProjectName parent, LogExclusion exclu *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String parent = ProjectName.of("[PROJECT]").toString();
-   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
-   *   LogExclusion response = configClient.createExclusion(parent, exclusion);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientCreateExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateExclusion();
+   *   }
+   *
+   *   public static void configClientCreateExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String parent = ProjectName.of("[PROJECT]").toString();
+   *       LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *       LogExclusion response = configClient.createExclusion(parent, exclusion);
+   *     }
+   *   }
    * }
    * }
* @@ -2386,13 +3639,29 @@ public final LogExclusion createExclusion(String parent, LogExclusion exclusion) *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   CreateExclusionRequest request =
-   *       CreateExclusionRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setExclusion(LogExclusion.newBuilder().build())
-   *           .build();
-   *   LogExclusion response = configClient.createExclusion(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CreateExclusionRequest;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientCreateExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateExclusion();
+   *   }
+   *
+   *   public static void configClientCreateExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       CreateExclusionRequest request =
+   *           CreateExclusionRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setExclusion(LogExclusion.newBuilder().build())
+   *               .build();
+   *       LogExclusion response = configClient.createExclusion(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2411,15 +3680,32 @@ public final LogExclusion createExclusion(CreateExclusionRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   CreateExclusionRequest request =
-   *       CreateExclusionRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setExclusion(LogExclusion.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = configClient.createExclusionCallable().futureCall(request);
-   *   // Do something.
-   *   LogExclusion response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CreateExclusionRequest;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class ConfigClientCreateExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientCreateExclusion();
+   *   }
+   *
+   *   public static void configClientCreateExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       CreateExclusionRequest request =
+   *           CreateExclusionRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setExclusion(LogExclusion.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = configClient.createExclusionCallable().futureCall(request);
+   *       // Do something.
+   *       LogExclusion response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2434,11 +3720,27 @@ public final UnaryCallable createExclusion *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
-   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   LogExclusion response = configClient.updateExclusion(name, exclusion, updateMask);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.LogExclusionName;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateExclusion();
+   *   }
+   *
+   *   public static void configClientUpdateExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+   *       LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *       FieldMask updateMask = FieldMask.newBuilder().build();
+   *       LogExclusion response = configClient.updateExclusion(name, exclusion, updateMask);
+   *     }
+   *   }
    * }
    * }
* @@ -2476,11 +3778,27 @@ public final LogExclusion updateExclusion( *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
-   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   LogExclusion response = configClient.updateExclusion(name, exclusion, updateMask);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.LogExclusionName;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateExclusion();
+   *   }
+   *
+   *   public static void configClientUpdateExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
+   *       LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *       FieldMask updateMask = FieldMask.newBuilder().build();
+   *       LogExclusion response = configClient.updateExclusion(name, exclusion, updateMask);
+   *     }
+   *   }
    * }
    * }
* @@ -2518,15 +3836,32 @@ public final LogExclusion updateExclusion( *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UpdateExclusionRequest request =
-   *       UpdateExclusionRequest.newBuilder()
-   *           .setName(
-   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
-   *           .setExclusion(LogExclusion.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   LogExclusion response = configClient.updateExclusion(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.LogExclusionName;
+   * import com.google.logging.v2.UpdateExclusionRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateExclusion();
+   *   }
+   *
+   *   public static void configClientUpdateExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UpdateExclusionRequest request =
+   *           UpdateExclusionRequest.newBuilder()
+   *               .setName(
+   *                   LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *               .setExclusion(LogExclusion.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       LogExclusion response = configClient.updateExclusion(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2544,17 +3879,35 @@ public final LogExclusion updateExclusion(UpdateExclusionRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UpdateExclusionRequest request =
-   *       UpdateExclusionRequest.newBuilder()
-   *           .setName(
-   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
-   *           .setExclusion(LogExclusion.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = configClient.updateExclusionCallable().futureCall(request);
-   *   // Do something.
-   *   LogExclusion response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusion;
+   * import com.google.logging.v2.LogExclusionName;
+   * import com.google.logging.v2.UpdateExclusionRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateExclusion();
+   *   }
+   *
+   *   public static void configClientUpdateExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UpdateExclusionRequest request =
+   *           UpdateExclusionRequest.newBuilder()
+   *               .setName(
+   *                   LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *               .setExclusion(LogExclusion.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = configClient.updateExclusionCallable().futureCall(request);
+   *       // Do something.
+   *       LogExclusion response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2569,9 +3922,24 @@ public final UnaryCallable updateExclusion *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
-   *   configClient.deleteExclusion(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusionName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteExclusion();
+   *   }
+   *
+   *   public static void configClientDeleteExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+   *       configClient.deleteExclusion(name);
+   *     }
+   *   }
    * }
    * }
* @@ -2596,9 +3964,24 @@ public final void deleteExclusion(LogExclusionName name) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
-   *   configClient.deleteExclusion(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.LogExclusionName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteExclusion();
+   *   }
+   *
+   *   public static void configClientDeleteExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
+   *       configClient.deleteExclusion(name);
+   *     }
+   *   }
    * }
    * }
* @@ -2622,13 +4005,29 @@ public final void deleteExclusion(String name) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   DeleteExclusionRequest request =
-   *       DeleteExclusionRequest.newBuilder()
-   *           .setName(
-   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
-   *           .build();
-   *   configClient.deleteExclusion(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.DeleteExclusionRequest;
+   * import com.google.logging.v2.LogExclusionName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteExclusion();
+   *   }
+   *
+   *   public static void configClientDeleteExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       DeleteExclusionRequest request =
+   *           DeleteExclusionRequest.newBuilder()
+   *               .setName(
+   *                   LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *               .build();
+   *       configClient.deleteExclusion(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2646,15 +4045,32 @@ public final void deleteExclusion(DeleteExclusionRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   DeleteExclusionRequest request =
-   *       DeleteExclusionRequest.newBuilder()
-   *           .setName(
-   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
-   *           .build();
-   *   ApiFuture future = configClient.deleteExclusionCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.DeleteExclusionRequest;
+   * import com.google.logging.v2.LogExclusionName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class ConfigClientDeleteExclusion {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientDeleteExclusion();
+   *   }
+   *
+   *   public static void configClientDeleteExclusion() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       DeleteExclusionRequest request =
+   *           DeleteExclusionRequest.newBuilder()
+   *               .setName(
+   *                   LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *               .build();
+   *       ApiFuture future = configClient.deleteExclusionCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2675,12 +4091,28 @@ public final UnaryCallable deleteExclusionCallabl *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   GetCmekSettingsRequest request =
-   *       GetCmekSettingsRequest.newBuilder()
-   *           .setName(CmekSettingsName.ofProjectName("[PROJECT]").toString())
-   *           .build();
-   *   CmekSettings response = configClient.getCmekSettings(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CmekSettings;
+   * import com.google.logging.v2.CmekSettingsName;
+   * import com.google.logging.v2.GetCmekSettingsRequest;
+   *
+   * public class ConfigClientGetCmekSettings {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetCmekSettings();
+   *   }
+   *
+   *   public static void configClientGetCmekSettings() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       GetCmekSettingsRequest request =
+   *           GetCmekSettingsRequest.newBuilder()
+   *               .setName(CmekSettingsName.ofProjectName("[PROJECT]").toString())
+   *               .build();
+   *       CmekSettings response = configClient.getCmekSettings(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2704,14 +4136,31 @@ public final CmekSettings getCmekSettings(GetCmekSettingsRequest request) { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   GetCmekSettingsRequest request =
-   *       GetCmekSettingsRequest.newBuilder()
-   *           .setName(CmekSettingsName.ofProjectName("[PROJECT]").toString())
-   *           .build();
-   *   ApiFuture future = configClient.getCmekSettingsCallable().futureCall(request);
-   *   // Do something.
-   *   CmekSettings response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CmekSettings;
+   * import com.google.logging.v2.CmekSettingsName;
+   * import com.google.logging.v2.GetCmekSettingsRequest;
+   *
+   * public class ConfigClientGetCmekSettings {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientGetCmekSettings();
+   *   }
+   *
+   *   public static void configClientGetCmekSettings() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       GetCmekSettingsRequest request =
+   *           GetCmekSettingsRequest.newBuilder()
+   *               .setName(CmekSettingsName.ofProjectName("[PROJECT]").toString())
+   *               .build();
+   *       ApiFuture future = configClient.getCmekSettingsCallable().futureCall(request);
+   *       // Do something.
+   *       CmekSettings response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2737,14 +4186,30 @@ public final UnaryCallable getCmekSettings *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UpdateCmekSettingsRequest request =
-   *       UpdateCmekSettingsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setCmekSettings(CmekSettings.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   CmekSettings response = configClient.updateCmekSettings(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CmekSettings;
+   * import com.google.logging.v2.UpdateCmekSettingsRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateCmekSettings {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateCmekSettings();
+   *   }
+   *
+   *   public static void configClientUpdateCmekSettings() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UpdateCmekSettingsRequest request =
+   *           UpdateCmekSettingsRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setCmekSettings(CmekSettings.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       CmekSettings response = configClient.updateCmekSettings(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2773,17 +4238,34 @@ public final CmekSettings updateCmekSettings(UpdateCmekSettingsRequest request) *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   UpdateCmekSettingsRequest request =
-   *       UpdateCmekSettingsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setCmekSettings(CmekSettings.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       configClient.updateCmekSettingsCallable().futureCall(request);
-   *   // Do something.
-   *   CmekSettings response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.ConfigClient;
+   * import com.google.logging.v2.CmekSettings;
+   * import com.google.logging.v2.UpdateCmekSettingsRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class ConfigClientUpdateCmekSettings {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     configClientUpdateCmekSettings();
+   *   }
+   *
+   *   public static void configClientUpdateCmekSettings() throws Exception {
+   *     try (ConfigClient configClient = ConfigClient.create()) {
+   *       UpdateCmekSettingsRequest request =
+   *           UpdateCmekSettingsRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setCmekSettings(CmekSettings.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           configClient.updateCmekSettingsCallable().futureCall(request);
+   *       // Do something.
+   *       CmekSettings response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/ConfigSettings.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/ConfigSettings.java index 1c57850ec1..fd6141d372 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/ConfigSettings.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/ConfigSettings.java @@ -89,17 +89,31 @@ *

For example, to set the total timeout of getBucket to 30 seconds: * *

{@code
- * ConfigSettings.Builder configSettingsBuilder = ConfigSettings.newBuilder();
- * configSettingsBuilder
- *     .getBucketSettings()
- *     .setRetrySettings(
- *         configSettingsBuilder
- *             .getBucketSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * ConfigSettings configSettings = configSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.ConfigSettings;
+ * import java.time.Duration;
+ *
+ * public class ConfigSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     configSettings();
+ *   }
+ *
+ *   public static void configSettings() throws Exception {
+ *     ConfigSettings.Builder configSettingsBuilder = ConfigSettings.newBuilder();
+ *     configSettingsBuilder
+ *         .getBucketSettings()
+ *         .setRetrySettings(
+ *             configSettingsBuilder
+ *                 .getBucketSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     ConfigSettings configSettings = configSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/LoggingClient.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/LoggingClient.java index 01da1d3ed5..019d1f1332 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/LoggingClient.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/LoggingClient.java @@ -63,9 +63,24 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (LoggingClient loggingClient = LoggingClient.create()) {
- *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
- *   loggingClient.deleteLog(logName);
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.LoggingClient;
+ * import com.google.logging.v2.LogName;
+ * import com.google.protobuf.Empty;
+ *
+ * public class LoggingClientDeleteLog {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     loggingClientDeleteLog();
+ *   }
+ *
+ *   public static void loggingClientDeleteLog() throws Exception {
+ *     try (LoggingClient loggingClient = LoggingClient.create()) {
+ *       LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ *       loggingClient.deleteLog(logName);
+ *     }
+ *   }
  * }
  * }
* @@ -98,18 +113,49 @@ *

To customize credentials: * *

{@code
- * LoggingSettings loggingSettings =
- *     LoggingSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * LoggingClient loggingClient = LoggingClient.create(loggingSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.logging.v2.LoggingClient;
+ * import com.google.cloud.logging.v2.LoggingSettings;
+ * import com.google.cloud.logging.v2.myCredentials;
+ *
+ * public class LoggingClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     loggingClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void loggingClientSetCredentialsProvider() throws Exception {
+ *     LoggingSettings loggingSettings =
+ *         LoggingSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     LoggingClient loggingClient = LoggingClient.create(loggingSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * LoggingSettings loggingSettings = LoggingSettings.newBuilder().setEndpoint(myEndpoint).build();
- * LoggingClient loggingClient = LoggingClient.create(loggingSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.LoggingClient;
+ * import com.google.cloud.logging.v2.LoggingSettings;
+ * import com.google.cloud.logging.v2.myEndpoint;
+ *
+ * public class LoggingClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     loggingClientSetEndpoint();
+ *   }
+ *
+ *   public static void loggingClientSetEndpoint() throws Exception {
+ *     LoggingSettings loggingSettings = LoggingSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     LoggingClient loggingClient = LoggingClient.create(loggingSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -174,9 +220,24 @@ public LoggingServiceV2Stub getStub() { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
-   *   loggingClient.deleteLog(logName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.LogName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LoggingClientDeleteLog {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientDeleteLog();
+   *   }
+   *
+   *   public static void loggingClientDeleteLog() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+   *       loggingClient.deleteLog(logName);
+   *     }
+   *   }
    * }
    * }
* @@ -205,9 +266,24 @@ public final void deleteLog(LogName logName) { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   String logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString();
-   *   loggingClient.deleteLog(logName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.LogName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LoggingClientDeleteLog {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientDeleteLog();
+   *   }
+   *
+   *   public static void loggingClientDeleteLog() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       String logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString();
+   *       loggingClient.deleteLog(logName);
+   *     }
+   *   }
    * }
    * }
* @@ -233,12 +309,28 @@ public final void deleteLog(String logName) { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   DeleteLogRequest request =
-   *       DeleteLogRequest.newBuilder()
-   *           .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
-   *           .build();
-   *   loggingClient.deleteLog(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.DeleteLogRequest;
+   * import com.google.logging.v2.LogName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LoggingClientDeleteLog {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientDeleteLog();
+   *   }
+   *
+   *   public static void loggingClientDeleteLog() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       DeleteLogRequest request =
+   *           DeleteLogRequest.newBuilder()
+   *               .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
+   *               .build();
+   *       loggingClient.deleteLog(request);
+   *     }
+   *   }
    * }
    * }
* @@ -258,14 +350,31 @@ public final void deleteLog(DeleteLogRequest request) { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   DeleteLogRequest request =
-   *       DeleteLogRequest.newBuilder()
-   *           .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
-   *           .build();
-   *   ApiFuture future = loggingClient.deleteLogCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.DeleteLogRequest;
+   * import com.google.logging.v2.LogName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class LoggingClientDeleteLog {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientDeleteLog();
+   *   }
+   *
+   *   public static void loggingClientDeleteLog() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       DeleteLogRequest request =
+   *           DeleteLogRequest.newBuilder()
+   *               .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
+   *               .build();
+   *       ApiFuture future = loggingClient.deleteLogCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -283,13 +392,34 @@ public final UnaryCallable deleteLogCallable() { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
-   *   MonitoredResource resource = MonitoredResource.newBuilder().build();
-   *   Map labels = new HashMap<>();
-   *   List entries = new ArrayList<>();
-   *   WriteLogEntriesResponse response =
-   *       loggingClient.writeLogEntries(logName, resource, labels, entries);
+   * package com.google.example;
+   *
+   * import com.google.api.MonitoredResource;
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.LogEntry;
+   * import com.google.logging.v2.LogName;
+   * import com.google.logging.v2.WriteLogEntriesResponse;
+   * import java.util.ArrayList;
+   * import java.util.HashMap;
+   * import java.util.List;
+   * import java.util.Map;
+   *
+   * public class LoggingClientWriteLogEntries {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientWriteLogEntries();
+   *   }
+   *
+   *   public static void loggingClientWriteLogEntries() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+   *       MonitoredResource resource = MonitoredResource.newBuilder().build();
+   *       Map labels = new HashMap<>();
+   *       List entries = new ArrayList<>();
+   *       WriteLogEntriesResponse response =
+   *           loggingClient.writeLogEntries(logName, resource, labels, entries);
+   *     }
+   *   }
    * }
    * }
* @@ -358,13 +488,34 @@ public final WriteLogEntriesResponse writeLogEntries( *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   String logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString();
-   *   MonitoredResource resource = MonitoredResource.newBuilder().build();
-   *   Map labels = new HashMap<>();
-   *   List entries = new ArrayList<>();
-   *   WriteLogEntriesResponse response =
-   *       loggingClient.writeLogEntries(logName, resource, labels, entries);
+   * package com.google.example;
+   *
+   * import com.google.api.MonitoredResource;
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.LogEntry;
+   * import com.google.logging.v2.LogName;
+   * import com.google.logging.v2.WriteLogEntriesResponse;
+   * import java.util.ArrayList;
+   * import java.util.HashMap;
+   * import java.util.List;
+   * import java.util.Map;
+   *
+   * public class LoggingClientWriteLogEntries {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientWriteLogEntries();
+   *   }
+   *
+   *   public static void loggingClientWriteLogEntries() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       String logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString();
+   *       MonitoredResource resource = MonitoredResource.newBuilder().build();
+   *       Map labels = new HashMap<>();
+   *       List entries = new ArrayList<>();
+   *       WriteLogEntriesResponse response =
+   *           loggingClient.writeLogEntries(logName, resource, labels, entries);
+   *     }
+   *   }
    * }
    * }
* @@ -433,17 +584,37 @@ public final WriteLogEntriesResponse writeLogEntries( *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   WriteLogEntriesRequest request =
-   *       WriteLogEntriesRequest.newBuilder()
-   *           .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
-   *           .setResource(MonitoredResource.newBuilder().build())
-   *           .putAllLabels(new HashMap())
-   *           .addAllEntries(new ArrayList())
-   *           .setPartialSuccess(true)
-   *           .setDryRun(true)
-   *           .build();
-   *   WriteLogEntriesResponse response = loggingClient.writeLogEntries(request);
+   * package com.google.example;
+   *
+   * import com.google.api.MonitoredResource;
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.LogEntry;
+   * import com.google.logging.v2.LogName;
+   * import com.google.logging.v2.WriteLogEntriesRequest;
+   * import com.google.logging.v2.WriteLogEntriesResponse;
+   * import java.util.ArrayList;
+   * import java.util.HashMap;
+   *
+   * public class LoggingClientWriteLogEntries {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientWriteLogEntries();
+   *   }
+   *
+   *   public static void loggingClientWriteLogEntries() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       WriteLogEntriesRequest request =
+   *           WriteLogEntriesRequest.newBuilder()
+   *               .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
+   *               .setResource(MonitoredResource.newBuilder().build())
+   *               .putAllLabels(new HashMap())
+   *               .addAllEntries(new ArrayList())
+   *               .setPartialSuccess(true)
+   *               .setDryRun(true)
+   *               .build();
+   *       WriteLogEntriesResponse response = loggingClient.writeLogEntries(request);
+   *     }
+   *   }
    * }
    * }
* @@ -464,20 +635,41 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   WriteLogEntriesRequest request =
-   *       WriteLogEntriesRequest.newBuilder()
-   *           .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
-   *           .setResource(MonitoredResource.newBuilder().build())
-   *           .putAllLabels(new HashMap())
-   *           .addAllEntries(new ArrayList())
-   *           .setPartialSuccess(true)
-   *           .setDryRun(true)
-   *           .build();
-   *   ApiFuture future =
-   *       loggingClient.writeLogEntriesCallable().futureCall(request);
-   *   // Do something.
-   *   WriteLogEntriesResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.MonitoredResource;
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.LogEntry;
+   * import com.google.logging.v2.LogName;
+   * import com.google.logging.v2.WriteLogEntriesRequest;
+   * import com.google.logging.v2.WriteLogEntriesResponse;
+   * import java.util.ArrayList;
+   * import java.util.HashMap;
+   *
+   * public class LoggingClientWriteLogEntries {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientWriteLogEntries();
+   *   }
+   *
+   *   public static void loggingClientWriteLogEntries() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       WriteLogEntriesRequest request =
+   *           WriteLogEntriesRequest.newBuilder()
+   *               .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
+   *               .setResource(MonitoredResource.newBuilder().build())
+   *               .putAllLabels(new HashMap())
+   *               .addAllEntries(new ArrayList())
+   *               .setPartialSuccess(true)
+   *               .setDryRun(true)
+   *               .build();
+   *       ApiFuture future =
+   *           loggingClient.writeLogEntriesCallable().futureCall(request);
+   *       // Do something.
+   *       WriteLogEntriesResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -495,13 +687,29 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   List resourceNames = new ArrayList<>();
-   *   String filter = "filter-1274492040";
-   *   String orderBy = "orderBy-1207110587";
-   *   for (LogEntry element :
-   *       loggingClient.listLogEntries(resourceNames, filter, orderBy).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.LogEntry;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class LoggingClientListLogEntries {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogEntries();
+   *   }
+   *
+   *   public static void loggingClientListLogEntries() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       List resourceNames = new ArrayList<>();
+   *       String filter = "filter-1274492040";
+   *       String orderBy = "orderBy-1207110587";
+   *       for (LogEntry element :
+   *           loggingClient.listLogEntries(resourceNames, filter, orderBy).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -549,17 +757,33 @@ public final ListLogEntriesPagedResponse listLogEntries( *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   ListLogEntriesRequest request =
-   *       ListLogEntriesRequest.newBuilder()
-   *           .addAllResourceNames(new ArrayList())
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (LogEntry element : loggingClient.listLogEntries(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.ListLogEntriesRequest;
+   * import com.google.logging.v2.LogEntry;
+   * import java.util.ArrayList;
+   *
+   * public class LoggingClientListLogEntries {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogEntries();
+   *   }
+   *
+   *   public static void loggingClientListLogEntries() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       ListLogEntriesRequest request =
+   *           ListLogEntriesRequest.newBuilder()
+   *               .addAllResourceNames(new ArrayList())
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (LogEntry element : loggingClient.listLogEntries(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -580,19 +804,36 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   ListLogEntriesRequest request =
-   *       ListLogEntriesRequest.newBuilder()
-   *           .addAllResourceNames(new ArrayList())
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = loggingClient.listLogEntriesPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (LogEntry element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.ListLogEntriesRequest;
+   * import com.google.logging.v2.LogEntry;
+   * import java.util.ArrayList;
+   *
+   * public class LoggingClientListLogEntries {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogEntries();
+   *   }
+   *
+   *   public static void loggingClientListLogEntries() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       ListLogEntriesRequest request =
+   *           ListLogEntriesRequest.newBuilder()
+   *               .addAllResourceNames(new ArrayList())
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future = loggingClient.listLogEntriesPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (LogEntry element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -611,25 +852,43 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   ListLogEntriesRequest request =
-   *       ListLogEntriesRequest.newBuilder()
-   *           .addAllResourceNames(new ArrayList())
-   *           .setFilter("filter-1274492040")
-   *           .setOrderBy("orderBy-1207110587")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListLogEntriesResponse response = loggingClient.listLogEntriesCallable().call(request);
-   *     for (LogEntry element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.common.base.Strings;
+   * import com.google.logging.v2.ListLogEntriesRequest;
+   * import com.google.logging.v2.ListLogEntriesResponse;
+   * import com.google.logging.v2.LogEntry;
+   * import java.util.ArrayList;
+   *
+   * public class LoggingClientListLogEntries {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogEntries();
+   *   }
+   *
+   *   public static void loggingClientListLogEntries() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       ListLogEntriesRequest request =
+   *           ListLogEntriesRequest.newBuilder()
+   *               .addAllResourceNames(new ArrayList())
+   *               .setFilter("filter-1274492040")
+   *               .setOrderBy("orderBy-1207110587")
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListLogEntriesResponse response = loggingClient.listLogEntriesCallable().call(request);
+   *         for (LogEntry element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -647,15 +906,30 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
    * 

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   ListMonitoredResourceDescriptorsRequest request =
-   *       ListMonitoredResourceDescriptorsRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (MonitoredResourceDescriptor element :
-   *       loggingClient.listMonitoredResourceDescriptors(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.MonitoredResourceDescriptor;
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.ListMonitoredResourceDescriptorsRequest;
+   *
+   * public class LoggingClientListMonitoredResourceDescriptors {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListMonitoredResourceDescriptors();
+   *   }
+   *
+   *   public static void loggingClientListMonitoredResourceDescriptors() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       ListMonitoredResourceDescriptorsRequest request =
+   *           ListMonitoredResourceDescriptorsRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (MonitoredResourceDescriptor element :
+   *           loggingClient.listMonitoredResourceDescriptors(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -675,17 +949,33 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   ListMonitoredResourceDescriptorsRequest request =
-   *       ListMonitoredResourceDescriptorsRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future =
-   *       loggingClient.listMonitoredResourceDescriptorsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (MonitoredResourceDescriptor element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.MonitoredResourceDescriptor;
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.ListMonitoredResourceDescriptorsRequest;
+   *
+   * public class LoggingClientListMonitoredResourceDescriptors {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListMonitoredResourceDescriptors();
+   *   }
+   *
+   *   public static void loggingClientListMonitoredResourceDescriptors() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       ListMonitoredResourceDescriptorsRequest request =
+   *           ListMonitoredResourceDescriptorsRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future =
+   *           loggingClient.listMonitoredResourceDescriptorsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (MonitoredResourceDescriptor element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -703,23 +993,40 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   ListMonitoredResourceDescriptorsRequest request =
-   *       ListMonitoredResourceDescriptorsRequest.newBuilder()
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListMonitoredResourceDescriptorsResponse response =
-   *         loggingClient.listMonitoredResourceDescriptorsCallable().call(request);
-   *     for (MonitoredResourceDescriptor element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.api.MonitoredResourceDescriptor;
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.common.base.Strings;
+   * import com.google.logging.v2.ListMonitoredResourceDescriptorsRequest;
+   * import com.google.logging.v2.ListMonitoredResourceDescriptorsResponse;
+   *
+   * public class LoggingClientListMonitoredResourceDescriptors {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListMonitoredResourceDescriptors();
+   *   }
+   *
+   *   public static void loggingClientListMonitoredResourceDescriptors() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       ListMonitoredResourceDescriptorsRequest request =
+   *           ListMonitoredResourceDescriptorsRequest.newBuilder()
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListMonitoredResourceDescriptorsResponse response =
+   *             loggingClient.listMonitoredResourceDescriptorsCallable().call(request);
+   *         for (MonitoredResourceDescriptor element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -739,10 +1046,24 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource
    * 

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
-   *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.BillingAccountName;
+   *
+   * public class LoggingClientListLogs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogs();
+   *   }
+   *
+   *   public static void loggingClientListLogs() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *       for (String element : loggingClient.listLogs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -766,10 +1087,24 @@ public final ListLogsPagedResponse listLogs(BillingAccountName parent) { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   FolderName parent = FolderName.of("[FOLDER]");
-   *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.FolderName;
+   *
+   * public class LoggingClientListLogs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogs();
+   *   }
+   *
+   *   public static void loggingClientListLogs() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       FolderName parent = FolderName.of("[FOLDER]");
+   *       for (String element : loggingClient.listLogs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -793,10 +1128,24 @@ public final ListLogsPagedResponse listLogs(FolderName parent) { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
-   *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.OrganizationName;
+   *
+   * public class LoggingClientListLogs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogs();
+   *   }
+   *
+   *   public static void loggingClientListLogs() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *       for (String element : loggingClient.listLogs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -820,10 +1169,24 @@ public final ListLogsPagedResponse listLogs(OrganizationName parent) { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class LoggingClientListLogs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogs();
+   *   }
+   *
+   *   public static void loggingClientListLogs() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       ProjectName parent = ProjectName.of("[PROJECT]");
+   *       for (String element : loggingClient.listLogs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -847,10 +1210,24 @@ public final ListLogsPagedResponse listLogs(ProjectName parent) { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   String parent = ProjectName.of("[PROJECT]").toString();
-   *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class LoggingClientListLogs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogs();
+   *   }
+   *
+   *   public static void loggingClientListLogs() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       String parent = ProjectName.of("[PROJECT]").toString();
+   *       for (String element : loggingClient.listLogs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -873,16 +1250,32 @@ public final ListLogsPagedResponse listLogs(String parent) { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   ListLogsRequest request =
-   *       ListLogsRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .addAllResourceNames(new ArrayList())
-   *           .build();
-   *   for (String element : loggingClient.listLogs(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.ListLogsRequest;
+   * import com.google.logging.v2.ProjectName;
+   * import java.util.ArrayList;
+   *
+   * public class LoggingClientListLogs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogs();
+   *   }
+   *
+   *   public static void loggingClientListLogs() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       ListLogsRequest request =
+   *           ListLogsRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .addAllResourceNames(new ArrayList())
+   *               .build();
+   *       for (String element : loggingClient.listLogs(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -902,18 +1295,35 @@ public final ListLogsPagedResponse listLogs(ListLogsRequest request) { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   ListLogsRequest request =
-   *       ListLogsRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .addAllResourceNames(new ArrayList())
-   *           .build();
-   *   ApiFuture future = loggingClient.listLogsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (String element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.ListLogsRequest;
+   * import com.google.logging.v2.ProjectName;
+   * import java.util.ArrayList;
+   *
+   * public class LoggingClientListLogs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogs();
+   *   }
+   *
+   *   public static void loggingClientListLogs() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       ListLogsRequest request =
+   *           ListLogsRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .addAllResourceNames(new ArrayList())
+   *               .build();
+   *       ApiFuture future = loggingClient.listLogsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (String element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -930,24 +1340,42 @@ public final UnaryCallable listLogsPaged *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   ListLogsRequest request =
-   *       ListLogsRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .addAllResourceNames(new ArrayList())
-   *           .build();
-   *   while (true) {
-   *     ListLogsResponse response = loggingClient.listLogsCallable().call(request);
-   *     for (String element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.common.base.Strings;
+   * import com.google.logging.v2.ListLogsRequest;
+   * import com.google.logging.v2.ListLogsResponse;
+   * import com.google.logging.v2.ProjectName;
+   * import java.util.ArrayList;
+   *
+   * public class LoggingClientListLogs {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientListLogs();
+   *   }
+   *
+   *   public static void loggingClientListLogs() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       ListLogsRequest request =
+   *           ListLogsRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .addAllResourceNames(new ArrayList())
+   *               .build();
+   *       while (true) {
+   *         ListLogsResponse response = loggingClient.listLogsCallable().call(request);
+   *         for (String element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -965,18 +1393,36 @@ public final UnaryCallable listLogsCallable()
    * 

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   BidiStream bidiStream =
-   *       loggingClient.tailLogEntriesCallable().call();
-   *   TailLogEntriesRequest request =
-   *       TailLogEntriesRequest.newBuilder()
-   *           .addAllResourceNames(new ArrayList())
-   *           .setFilter("filter-1274492040")
-   *           .setBufferWindow(Duration.newBuilder().build())
-   *           .build();
-   *   bidiStream.send(request);
-   *   for (TailLogEntriesResponse response : bidiStream) {
-   *     // Do something when a response is received.
+   * package com.google.example;
+   *
+   * import com.google.api.gax.rpc.BidiStream;
+   * import com.google.cloud.logging.v2.LoggingClient;
+   * import com.google.logging.v2.TailLogEntriesRequest;
+   * import com.google.logging.v2.TailLogEntriesResponse;
+   * import com.google.protobuf.Duration;
+   * import java.util.ArrayList;
+   *
+   * public class LoggingClientTailLogEntries {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     loggingClientTailLogEntries();
+   *   }
+   *
+   *   public static void loggingClientTailLogEntries() throws Exception {
+   *     try (LoggingClient loggingClient = LoggingClient.create()) {
+   *       BidiStream bidiStream =
+   *           loggingClient.tailLogEntriesCallable().call();
+   *       TailLogEntriesRequest request =
+   *           TailLogEntriesRequest.newBuilder()
+   *               .addAllResourceNames(new ArrayList())
+   *               .setFilter("filter-1274492040")
+   *               .setBufferWindow(Duration.newBuilder().build())
+   *               .build();
+   *       bidiStream.send(request);
+   *       for (TailLogEntriesResponse response : bidiStream) {
+   *         // Do something when a response is received.
+   *       }
+   *     }
    *   }
    * }
    * }
diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/LoggingSettings.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/LoggingSettings.java index f7bba757b0..66fc5445c2 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/LoggingSettings.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/LoggingSettings.java @@ -69,17 +69,31 @@ *

For example, to set the total timeout of deleteLog to 30 seconds: * *

{@code
- * LoggingSettings.Builder loggingSettingsBuilder = LoggingSettings.newBuilder();
- * loggingSettingsBuilder
- *     .deleteLogSettings()
- *     .setRetrySettings(
- *         loggingSettingsBuilder
- *             .deleteLogSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * LoggingSettings loggingSettings = loggingSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.LoggingSettings;
+ * import java.time.Duration;
+ *
+ * public class LoggingSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     loggingSettings();
+ *   }
+ *
+ *   public static void loggingSettings() throws Exception {
+ *     LoggingSettings.Builder loggingSettingsBuilder = LoggingSettings.newBuilder();
+ *     loggingSettingsBuilder
+ *         .deleteLogSettings()
+ *         .setRetrySettings(
+ *             loggingSettingsBuilder
+ *                 .deleteLogSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     LoggingSettings loggingSettings = loggingSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsClient.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsClient.java index 15bec75716..296adf4ccf 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsClient.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsClient.java @@ -51,9 +51,24 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (MetricsClient metricsClient = MetricsClient.create()) {
- *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
- *   LogMetric response = metricsClient.getLogMetric(metricName);
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.MetricsClient;
+ * import com.google.logging.v2.LogMetric;
+ * import com.google.logging.v2.LogMetricName;
+ *
+ * public class MetricsClientGetLogMetric {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     metricsClientGetLogMetric();
+ *   }
+ *
+ *   public static void metricsClientGetLogMetric() throws Exception {
+ *     try (MetricsClient metricsClient = MetricsClient.create()) {
+ *       LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ *       LogMetric response = metricsClient.getLogMetric(metricName);
+ *     }
+ *   }
  * }
  * }
* @@ -86,18 +101,49 @@ *

To customize credentials: * *

{@code
- * MetricsSettings metricsSettings =
- *     MetricsSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * MetricsClient metricsClient = MetricsClient.create(metricsSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.logging.v2.MetricsClient;
+ * import com.google.cloud.logging.v2.MetricsSettings;
+ * import com.google.cloud.logging.v2.myCredentials;
+ *
+ * public class MetricsClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     metricsClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void metricsClientSetCredentialsProvider() throws Exception {
+ *     MetricsSettings metricsSettings =
+ *         MetricsSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     MetricsClient metricsClient = MetricsClient.create(metricsSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * MetricsSettings metricsSettings = MetricsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * MetricsClient metricsClient = MetricsClient.create(metricsSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.MetricsClient;
+ * import com.google.cloud.logging.v2.MetricsSettings;
+ * import com.google.cloud.logging.v2.myEndpoint;
+ *
+ * public class MetricsClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     metricsClientSetEndpoint();
+ *   }
+ *
+ *   public static void metricsClientSetEndpoint() throws Exception {
+ *     MetricsSettings metricsSettings = MetricsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     MetricsClient metricsClient = MetricsClient.create(metricsSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -160,10 +206,25 @@ public MetricsServiceV2Stub getStub() { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class MetricsClientListLogMetrics {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientListLogMetrics();
+   *   }
+   *
+   *   public static void metricsClientListLogMetrics() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       ProjectName parent = ProjectName.of("[PROJECT]");
+   *       for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -187,10 +248,25 @@ public final ListLogMetricsPagedResponse listLogMetrics(ProjectName parent) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   String parent = ProjectName.of("[PROJECT]").toString();
-   *   for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class MetricsClientListLogMetrics {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientListLogMetrics();
+   *   }
+   *
+   *   public static void metricsClientListLogMetrics() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       String parent = ProjectName.of("[PROJECT]").toString();
+   *       for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -211,15 +287,31 @@ public final ListLogMetricsPagedResponse listLogMetrics(String parent) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   ListLogMetricsRequest request =
-   *       ListLogMetricsRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   for (LogMetric element : metricsClient.listLogMetrics(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.ListLogMetricsRequest;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class MetricsClientListLogMetrics {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientListLogMetrics();
+   *   }
+   *
+   *   public static void metricsClientListLogMetrics() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       ListLogMetricsRequest request =
+   *           ListLogMetricsRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       for (LogMetric element : metricsClient.listLogMetrics(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -238,17 +330,34 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   ListLogMetricsRequest request =
-   *       ListLogMetricsRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   ApiFuture future = metricsClient.listLogMetricsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (LogMetric element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.ListLogMetricsRequest;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class MetricsClientListLogMetrics {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientListLogMetrics();
+   *   }
+   *
+   *   public static void metricsClientListLogMetrics() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       ListLogMetricsRequest request =
+   *           ListLogMetricsRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       ApiFuture future = metricsClient.listLogMetricsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (LogMetric element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -265,23 +374,41 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   ListLogMetricsRequest request =
-   *       ListLogMetricsRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setPageToken("pageToken873572522")
-   *           .setPageSize(883849137)
-   *           .build();
-   *   while (true) {
-   *     ListLogMetricsResponse response = metricsClient.listLogMetricsCallable().call(request);
-   *     for (LogMetric element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.common.base.Strings;
+   * import com.google.logging.v2.ListLogMetricsRequest;
+   * import com.google.logging.v2.ListLogMetricsResponse;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class MetricsClientListLogMetrics {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientListLogMetrics();
+   *   }
+   *
+   *   public static void metricsClientListLogMetrics() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       ListLogMetricsRequest request =
+   *           ListLogMetricsRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setPageToken("pageToken873572522")
+   *               .setPageSize(883849137)
+   *               .build();
+   *       while (true) {
+   *         ListLogMetricsResponse response = metricsClient.listLogMetricsCallable().call(request);
+   *         for (LogMetric element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -299,9 +426,24 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re
    * 

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
-   *   LogMetric response = metricsClient.getLogMetric(metricName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.LogMetricName;
+   *
+   * public class MetricsClientGetLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientGetLogMetric();
+   *   }
+   *
+   *   public static void metricsClientGetLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+   *       LogMetric response = metricsClient.getLogMetric(metricName);
+   *     }
+   *   }
    * }
    * }
* @@ -324,9 +466,24 @@ public final LogMetric getLogMetric(LogMetricName metricName) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
-   *   LogMetric response = metricsClient.getLogMetric(metricName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.LogMetricName;
+   *
+   * public class MetricsClientGetLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientGetLogMetric();
+   *   }
+   *
+   *   public static void metricsClientGetLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
+   *       LogMetric response = metricsClient.getLogMetric(metricName);
+   *     }
+   *   }
    * }
    * }
* @@ -347,12 +504,28 @@ public final LogMetric getLogMetric(String metricName) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   GetLogMetricRequest request =
-   *       GetLogMetricRequest.newBuilder()
-   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
-   *           .build();
-   *   LogMetric response = metricsClient.getLogMetric(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.GetLogMetricRequest;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.LogMetricName;
+   *
+   * public class MetricsClientGetLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientGetLogMetric();
+   *   }
+   *
+   *   public static void metricsClientGetLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       GetLogMetricRequest request =
+   *           GetLogMetricRequest.newBuilder()
+   *               .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *               .build();
+   *       LogMetric response = metricsClient.getLogMetric(request);
+   *     }
+   *   }
    * }
    * }
* @@ -370,14 +543,31 @@ public final LogMetric getLogMetric(GetLogMetricRequest request) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   GetLogMetricRequest request =
-   *       GetLogMetricRequest.newBuilder()
-   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
-   *           .build();
-   *   ApiFuture future = metricsClient.getLogMetricCallable().futureCall(request);
-   *   // Do something.
-   *   LogMetric response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.GetLogMetricRequest;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.LogMetricName;
+   *
+   * public class MetricsClientGetLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientGetLogMetric();
+   *   }
+   *
+   *   public static void metricsClientGetLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       GetLogMetricRequest request =
+   *           GetLogMetricRequest.newBuilder()
+   *               .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *               .build();
+   *       ApiFuture future = metricsClient.getLogMetricCallable().futureCall(request);
+   *       // Do something.
+   *       LogMetric response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -392,10 +582,25 @@ public final UnaryCallable getLogMetricCallable( *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   LogMetric metric = LogMetric.newBuilder().build();
-   *   LogMetric response = metricsClient.createLogMetric(parent, metric);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class MetricsClientCreateLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientCreateLogMetric();
+   *   }
+   *
+   *   public static void metricsClientCreateLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       ProjectName parent = ProjectName.of("[PROJECT]");
+   *       LogMetric metric = LogMetric.newBuilder().build();
+   *       LogMetric response = metricsClient.createLogMetric(parent, metric);
+   *     }
+   *   }
    * }
    * }
* @@ -422,10 +627,25 @@ public final LogMetric createLogMetric(ProjectName parent, LogMetric metric) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   String parent = ProjectName.of("[PROJECT]").toString();
-   *   LogMetric metric = LogMetric.newBuilder().build();
-   *   LogMetric response = metricsClient.createLogMetric(parent, metric);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class MetricsClientCreateLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientCreateLogMetric();
+   *   }
+   *
+   *   public static void metricsClientCreateLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       String parent = ProjectName.of("[PROJECT]").toString();
+   *       LogMetric metric = LogMetric.newBuilder().build();
+   *       LogMetric response = metricsClient.createLogMetric(parent, metric);
+   *     }
+   *   }
    * }
    * }
* @@ -449,13 +669,29 @@ public final LogMetric createLogMetric(String parent, LogMetric metric) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   CreateLogMetricRequest request =
-   *       CreateLogMetricRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setMetric(LogMetric.newBuilder().build())
-   *           .build();
-   *   LogMetric response = metricsClient.createLogMetric(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.CreateLogMetricRequest;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class MetricsClientCreateLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientCreateLogMetric();
+   *   }
+   *
+   *   public static void metricsClientCreateLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       CreateLogMetricRequest request =
+   *           CreateLogMetricRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setMetric(LogMetric.newBuilder().build())
+   *               .build();
+   *       LogMetric response = metricsClient.createLogMetric(request);
+   *     }
+   *   }
    * }
    * }
* @@ -473,15 +709,32 @@ public final LogMetric createLogMetric(CreateLogMetricRequest request) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   CreateLogMetricRequest request =
-   *       CreateLogMetricRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setMetric(LogMetric.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = metricsClient.createLogMetricCallable().futureCall(request);
-   *   // Do something.
-   *   LogMetric response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.CreateLogMetricRequest;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.ProjectName;
+   *
+   * public class MetricsClientCreateLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientCreateLogMetric();
+   *   }
+   *
+   *   public static void metricsClientCreateLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       CreateLogMetricRequest request =
+   *           CreateLogMetricRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setMetric(LogMetric.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = metricsClient.createLogMetricCallable().futureCall(request);
+   *       // Do something.
+   *       LogMetric response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -496,10 +749,25 @@ public final UnaryCallable createLogMetricCal *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
-   *   LogMetric metric = LogMetric.newBuilder().build();
-   *   LogMetric response = metricsClient.updateLogMetric(metricName, metric);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.LogMetricName;
+   *
+   * public class MetricsClientUpdateLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientUpdateLogMetric();
+   *   }
+   *
+   *   public static void metricsClientUpdateLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+   *       LogMetric metric = LogMetric.newBuilder().build();
+   *       LogMetric response = metricsClient.updateLogMetric(metricName, metric);
+   *     }
+   *   }
    * }
    * }
* @@ -527,10 +795,25 @@ public final LogMetric updateLogMetric(LogMetricName metricName, LogMetric metri *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
-   *   LogMetric metric = LogMetric.newBuilder().build();
-   *   LogMetric response = metricsClient.updateLogMetric(metricName, metric);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.LogMetricName;
+   *
+   * public class MetricsClientUpdateLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientUpdateLogMetric();
+   *   }
+   *
+   *   public static void metricsClientUpdateLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
+   *       LogMetric metric = LogMetric.newBuilder().build();
+   *       LogMetric response = metricsClient.updateLogMetric(metricName, metric);
+   *     }
+   *   }
    * }
    * }
* @@ -555,13 +838,29 @@ public final LogMetric updateLogMetric(String metricName, LogMetric metric) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   UpdateLogMetricRequest request =
-   *       UpdateLogMetricRequest.newBuilder()
-   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
-   *           .setMetric(LogMetric.newBuilder().build())
-   *           .build();
-   *   LogMetric response = metricsClient.updateLogMetric(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.LogMetricName;
+   * import com.google.logging.v2.UpdateLogMetricRequest;
+   *
+   * public class MetricsClientUpdateLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientUpdateLogMetric();
+   *   }
+   *
+   *   public static void metricsClientUpdateLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       UpdateLogMetricRequest request =
+   *           UpdateLogMetricRequest.newBuilder()
+   *               .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *               .setMetric(LogMetric.newBuilder().build())
+   *               .build();
+   *       LogMetric response = metricsClient.updateLogMetric(request);
+   *     }
+   *   }
    * }
    * }
* @@ -579,15 +878,32 @@ public final LogMetric updateLogMetric(UpdateLogMetricRequest request) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   UpdateLogMetricRequest request =
-   *       UpdateLogMetricRequest.newBuilder()
-   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
-   *           .setMetric(LogMetric.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = metricsClient.updateLogMetricCallable().futureCall(request);
-   *   // Do something.
-   *   LogMetric response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetric;
+   * import com.google.logging.v2.LogMetricName;
+   * import com.google.logging.v2.UpdateLogMetricRequest;
+   *
+   * public class MetricsClientUpdateLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientUpdateLogMetric();
+   *   }
+   *
+   *   public static void metricsClientUpdateLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       UpdateLogMetricRequest request =
+   *           UpdateLogMetricRequest.newBuilder()
+   *               .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *               .setMetric(LogMetric.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = metricsClient.updateLogMetricCallable().futureCall(request);
+   *       // Do something.
+   *       LogMetric response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -602,9 +918,24 @@ public final UnaryCallable updateLogMetricCal *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
-   *   metricsClient.deleteLogMetric(metricName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetricName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class MetricsClientDeleteLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientDeleteLogMetric();
+   *   }
+   *
+   *   public static void metricsClientDeleteLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+   *       metricsClient.deleteLogMetric(metricName);
+   *     }
+   *   }
    * }
    * }
* @@ -627,9 +958,24 @@ public final void deleteLogMetric(LogMetricName metricName) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
-   *   metricsClient.deleteLogMetric(metricName);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.LogMetricName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class MetricsClientDeleteLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientDeleteLogMetric();
+   *   }
+   *
+   *   public static void metricsClientDeleteLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
+   *       metricsClient.deleteLogMetric(metricName);
+   *     }
+   *   }
    * }
    * }
* @@ -650,12 +996,28 @@ public final void deleteLogMetric(String metricName) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   DeleteLogMetricRequest request =
-   *       DeleteLogMetricRequest.newBuilder()
-   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
-   *           .build();
-   *   metricsClient.deleteLogMetric(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.DeleteLogMetricRequest;
+   * import com.google.logging.v2.LogMetricName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class MetricsClientDeleteLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientDeleteLogMetric();
+   *   }
+   *
+   *   public static void metricsClientDeleteLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       DeleteLogMetricRequest request =
+   *           DeleteLogMetricRequest.newBuilder()
+   *               .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *               .build();
+   *       metricsClient.deleteLogMetric(request);
+   *     }
+   *   }
    * }
    * }
* @@ -673,14 +1035,31 @@ public final void deleteLogMetric(DeleteLogMetricRequest request) { *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   DeleteLogMetricRequest request =
-   *       DeleteLogMetricRequest.newBuilder()
-   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
-   *           .build();
-   *   ApiFuture future = metricsClient.deleteLogMetricCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.logging.v2.MetricsClient;
+   * import com.google.logging.v2.DeleteLogMetricRequest;
+   * import com.google.logging.v2.LogMetricName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class MetricsClientDeleteLogMetric {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     metricsClientDeleteLogMetric();
+   *   }
+   *
+   *   public static void metricsClientDeleteLogMetric() throws Exception {
+   *     try (MetricsClient metricsClient = MetricsClient.create()) {
+   *       DeleteLogMetricRequest request =
+   *           DeleteLogMetricRequest.newBuilder()
+   *               .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *               .build();
+   *       ApiFuture future = metricsClient.deleteLogMetricCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsSettings.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsSettings.java index 1b7765bda7..b9d7aaffcc 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsSettings.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsSettings.java @@ -61,17 +61,31 @@ *

For example, to set the total timeout of getLogMetric to 30 seconds: * *

{@code
- * MetricsSettings.Builder metricsSettingsBuilder = MetricsSettings.newBuilder();
- * metricsSettingsBuilder
- *     .getLogMetricSettings()
- *     .setRetrySettings(
- *         metricsSettingsBuilder
- *             .getLogMetricSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * MetricsSettings metricsSettings = metricsSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.MetricsSettings;
+ * import java.time.Duration;
+ *
+ * public class MetricsSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     metricsSettings();
+ *   }
+ *
+ *   public static void metricsSettings() throws Exception {
+ *     MetricsSettings.Builder metricsSettingsBuilder = MetricsSettings.newBuilder();
+ *     metricsSettingsBuilder
+ *         .getLogMetricSettings()
+ *         .setRetrySettings(
+ *             metricsSettingsBuilder
+ *                 .getLogMetricSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     MetricsSettings metricsSettings = metricsSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/package-info.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/package-info.java index c9561f16e9..ddbd268f33 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/package-info.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/package-info.java @@ -24,9 +24,24 @@ *

Sample for LoggingClient: * *

{@code
- * try (LoggingClient loggingClient = LoggingClient.create()) {
- *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
- *   loggingClient.deleteLog(logName);
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.LoggingClient;
+ * import com.google.logging.v2.LogName;
+ * import com.google.protobuf.Empty;
+ *
+ * public class LoggingClientDeleteLog {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     loggingClientDeleteLog();
+ *   }
+ *
+ *   public static void loggingClientDeleteLog() throws Exception {
+ *     try (LoggingClient loggingClient = LoggingClient.create()) {
+ *       LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ *       loggingClient.deleteLog(logName);
+ *     }
+ *   }
  * }
  * }
* @@ -37,14 +52,30 @@ *

Sample for ConfigClient: * *

{@code
- * try (ConfigClient configClient = ConfigClient.create()) {
- *   GetBucketRequest request =
- *       GetBucketRequest.newBuilder()
- *           .setName(
- *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
- *                   .toString())
- *           .build();
- *   LogBucket response = configClient.getBucket(request);
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.ConfigClient;
+ * import com.google.logging.v2.GetBucketRequest;
+ * import com.google.logging.v2.LogBucket;
+ * import com.google.logging.v2.LogBucketName;
+ *
+ * public class ConfigClientGetBucket {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     configClientGetBucket();
+ *   }
+ *
+ *   public static void configClientGetBucket() throws Exception {
+ *     try (ConfigClient configClient = ConfigClient.create()) {
+ *       GetBucketRequest request =
+ *           GetBucketRequest.newBuilder()
+ *               .setName(
+ *                   LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+ *                       .toString())
+ *               .build();
+ *       LogBucket response = configClient.getBucket(request);
+ *     }
+ *   }
  * }
  * }
* @@ -55,9 +86,24 @@ *

Sample for MetricsClient: * *

{@code
- * try (MetricsClient metricsClient = MetricsClient.create()) {
- *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
- *   LogMetric response = metricsClient.getLogMetric(metricName);
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.MetricsClient;
+ * import com.google.logging.v2.LogMetric;
+ * import com.google.logging.v2.LogMetricName;
+ *
+ * public class MetricsClientGetLogMetric {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     metricsClientGetLogMetric();
+ *   }
+ *
+ *   public static void metricsClientGetLogMetric() throws Exception {
+ *     try (MetricsClient metricsClient = MetricsClient.create()) {
+ *       LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ *       LogMetric response = metricsClient.getLogMetric(metricName);
+ *     }
+ *   }
  * }
  * }
*/ diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java index faf8137eea..418063629c 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java @@ -103,18 +103,32 @@ *

For example, to set the total timeout of getBucket to 30 seconds: * *

{@code
- * ConfigServiceV2StubSettings.Builder configSettingsBuilder =
- *     ConfigServiceV2StubSettings.newBuilder();
- * configSettingsBuilder
- *     .getBucketSettings()
- *     .setRetrySettings(
- *         configSettingsBuilder
- *             .getBucketSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * ConfigServiceV2StubSettings configSettings = configSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.stub.ConfigServiceV2StubSettings;
+ * import java.time.Duration;
+ *
+ * public class ConfigSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     configSettings();
+ *   }
+ *
+ *   public static void configSettings() throws Exception {
+ *     ConfigServiceV2StubSettings.Builder configSettingsBuilder =
+ *         ConfigServiceV2StubSettings.newBuilder();
+ *     configSettingsBuilder
+ *         .getBucketSettings()
+ *         .setRetrySettings(
+ *             configSettingsBuilder
+ *                 .getBucketSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     ConfigServiceV2StubSettings configSettings = configSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java index 3f3b507702..a86b32c77c 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java @@ -93,18 +93,32 @@ *

For example, to set the total timeout of deleteLog to 30 seconds: * *

{@code
- * LoggingServiceV2StubSettings.Builder loggingSettingsBuilder =
- *     LoggingServiceV2StubSettings.newBuilder();
- * loggingSettingsBuilder
- *     .deleteLogSettings()
- *     .setRetrySettings(
- *         loggingSettingsBuilder
- *             .deleteLogSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * LoggingServiceV2StubSettings loggingSettings = loggingSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.stub.LoggingServiceV2StubSettings;
+ * import java.time.Duration;
+ *
+ * public class LoggingSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     loggingSettings();
+ *   }
+ *
+ *   public static void loggingSettings() throws Exception {
+ *     LoggingServiceV2StubSettings.Builder loggingSettingsBuilder =
+ *         LoggingServiceV2StubSettings.newBuilder();
+ *     loggingSettingsBuilder
+ *         .deleteLogSettings()
+ *         .setRetrySettings(
+ *             loggingSettingsBuilder
+ *                 .deleteLogSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     LoggingServiceV2StubSettings loggingSettings = loggingSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java index 3cf4be8d73..98e09aaa59 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java @@ -75,18 +75,32 @@ *

For example, to set the total timeout of getLogMetric to 30 seconds: * *

{@code
- * MetricsServiceV2StubSettings.Builder metricsSettingsBuilder =
- *     MetricsServiceV2StubSettings.newBuilder();
- * metricsSettingsBuilder
- *     .getLogMetricSettings()
- *     .setRetrySettings(
- *         metricsSettingsBuilder
- *             .getLogMetricSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * MetricsServiceV2StubSettings metricsSettings = metricsSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.logging.v2.stub.MetricsServiceV2StubSettings;
+ * import java.time.Duration;
+ *
+ * public class MetricsSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     metricsSettings();
+ *   }
+ *
+ *   public static void metricsSettings() throws Exception {
+ *     MetricsServiceV2StubSettings.Builder metricsSettingsBuilder =
+ *         MetricsServiceV2StubSettings.newBuilder();
+ *     metricsSettingsBuilder
+ *         .getLogMetricSettings()
+ *         .setRetrySettings(
+ *             metricsSettingsBuilder
+ *                 .getLogMetricSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     MetricsServiceV2StubSettings metricsSettings = metricsSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceClient.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceClient.java index 562debea05..fdf1576fd8 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceClient.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceClient.java @@ -59,11 +59,26 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
- *   ProjectName parent = ProjectName.of("[PROJECT]");
- *   Schema schema = Schema.newBuilder().build();
- *   String schemaId = "schemaId-697673060";
- *   Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+ * import com.google.pubsub.v1.ProjectName;
+ * import com.google.pubsub.v1.Schema;
+ *
+ * public class SchemaServiceClientCreateSchema {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     schemaServiceClientCreateSchema();
+ *   }
+ *
+ *   public static void schemaServiceClientCreateSchema() throws Exception {
+ *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+ *       ProjectName parent = ProjectName.of("[PROJECT]");
+ *       Schema schema = Schema.newBuilder().build();
+ *       String schemaId = "schemaId-697673060";
+ *       Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
+ *     }
+ *   }
  * }
  * }
* @@ -96,19 +111,50 @@ *

To customize credentials: * *

{@code
- * SchemaServiceSettings schemaServiceSettings =
- *     SchemaServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+ * import com.google.cloud.pubsub.v1.SchemaServiceSettings;
+ * import com.google.cloud.pubsub.v1.myCredentials;
+ *
+ * public class SchemaServiceClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     schemaServiceClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void schemaServiceClientSetCredentialsProvider() throws Exception {
+ *     SchemaServiceSettings schemaServiceSettings =
+ *         SchemaServiceSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * SchemaServiceSettings schemaServiceSettings =
- *     SchemaServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+ * import com.google.cloud.pubsub.v1.SchemaServiceSettings;
+ * import com.google.cloud.pubsub.v1.myEndpoint;
+ *
+ * public class SchemaServiceClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     schemaServiceClientSetEndpoint();
+ *   }
+ *
+ *   public static void schemaServiceClientSetEndpoint() throws Exception {
+ *     SchemaServiceSettings schemaServiceSettings =
+ *         SchemaServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -173,11 +219,26 @@ public SchemaServiceStub getStub() { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Schema schema = Schema.newBuilder().build();
-   *   String schemaId = "schemaId-697673060";
-   *   Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   *
+   * public class SchemaServiceClientCreateSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientCreateSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientCreateSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       ProjectName parent = ProjectName.of("[PROJECT]");
+   *       Schema schema = Schema.newBuilder().build();
+   *       String schemaId = "schemaId-697673060";
+   *       Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
+   *     }
+   *   }
    * }
    * }
* @@ -209,11 +270,26 @@ public final Schema createSchema(ProjectName parent, Schema schema, String schem *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   String parent = ProjectName.of("[PROJECT]").toString();
-   *   Schema schema = Schema.newBuilder().build();
-   *   String schemaId = "schemaId-697673060";
-   *   Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   *
+   * public class SchemaServiceClientCreateSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientCreateSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientCreateSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       String parent = ProjectName.of("[PROJECT]").toString();
+   *       Schema schema = Schema.newBuilder().build();
+   *       String schemaId = "schemaId-697673060";
+   *       Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
+   *     }
+   *   }
    * }
    * }
* @@ -245,14 +321,30 @@ public final Schema createSchema(String parent, Schema schema, String schemaId) *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   CreateSchemaRequest request =
-   *       CreateSchemaRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setSchema(Schema.newBuilder().build())
-   *           .setSchemaId("schemaId-697673060")
-   *           .build();
-   *   Schema response = schemaServiceClient.createSchema(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.CreateSchemaRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   *
+   * public class SchemaServiceClientCreateSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientCreateSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientCreateSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       CreateSchemaRequest request =
+   *           CreateSchemaRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setSchema(Schema.newBuilder().build())
+   *               .setSchemaId("schemaId-697673060")
+   *               .build();
+   *       Schema response = schemaServiceClient.createSchema(request);
+   *     }
+   *   }
    * }
    * }
* @@ -270,16 +362,33 @@ public final Schema createSchema(CreateSchemaRequest request) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   CreateSchemaRequest request =
-   *       CreateSchemaRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setSchema(Schema.newBuilder().build())
-   *           .setSchemaId("schemaId-697673060")
-   *           .build();
-   *   ApiFuture future = schemaServiceClient.createSchemaCallable().futureCall(request);
-   *   // Do something.
-   *   Schema response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.CreateSchemaRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   *
+   * public class SchemaServiceClientCreateSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientCreateSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientCreateSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       CreateSchemaRequest request =
+   *           CreateSchemaRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setSchema(Schema.newBuilder().build())
+   *               .setSchemaId("schemaId-697673060")
+   *               .build();
+   *       ApiFuture future = schemaServiceClient.createSchemaCallable().futureCall(request);
+   *       // Do something.
+   *       Schema response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -294,9 +403,24 @@ public final UnaryCallable createSchemaCallable() { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
-   *   Schema response = schemaServiceClient.getSchema(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.Schema;
+   * import com.google.pubsub.v1.SchemaName;
+   *
+   * public class SchemaServiceClientGetSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientGetSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientGetSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
+   *       Schema response = schemaServiceClient.getSchema(name);
+   *     }
+   *   }
    * }
    * }
* @@ -317,9 +441,24 @@ public final Schema getSchema(SchemaName name) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
-   *   Schema response = schemaServiceClient.getSchema(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.Schema;
+   * import com.google.pubsub.v1.SchemaName;
+   *
+   * public class SchemaServiceClientGetSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientGetSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientGetSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
+   *       Schema response = schemaServiceClient.getSchema(name);
+   *     }
+   *   }
    * }
    * }
* @@ -339,13 +478,30 @@ public final Schema getSchema(String name) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   GetSchemaRequest request =
-   *       GetSchemaRequest.newBuilder()
-   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
-   *           .setView(SchemaView.forNumber(0))
-   *           .build();
-   *   Schema response = schemaServiceClient.getSchema(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.GetSchemaRequest;
+   * import com.google.pubsub.v1.Schema;
+   * import com.google.pubsub.v1.SchemaName;
+   * import com.google.pubsub.v1.SchemaView;
+   *
+   * public class SchemaServiceClientGetSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientGetSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientGetSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       GetSchemaRequest request =
+   *           GetSchemaRequest.newBuilder()
+   *               .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *               .setView(SchemaView.forNumber(0))
+   *               .build();
+   *       Schema response = schemaServiceClient.getSchema(request);
+   *     }
+   *   }
    * }
    * }
* @@ -363,15 +519,33 @@ public final Schema getSchema(GetSchemaRequest request) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   GetSchemaRequest request =
-   *       GetSchemaRequest.newBuilder()
-   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
-   *           .setView(SchemaView.forNumber(0))
-   *           .build();
-   *   ApiFuture future = schemaServiceClient.getSchemaCallable().futureCall(request);
-   *   // Do something.
-   *   Schema response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.GetSchemaRequest;
+   * import com.google.pubsub.v1.Schema;
+   * import com.google.pubsub.v1.SchemaName;
+   * import com.google.pubsub.v1.SchemaView;
+   *
+   * public class SchemaServiceClientGetSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientGetSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientGetSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       GetSchemaRequest request =
+   *           GetSchemaRequest.newBuilder()
+   *               .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *               .setView(SchemaView.forNumber(0))
+   *               .build();
+   *       ApiFuture future = schemaServiceClient.getSchemaCallable().futureCall(request);
+   *       // Do something.
+   *       Schema response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -386,10 +560,25 @@ public final UnaryCallable getSchemaCallable() { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   *
+   * public class SchemaServiceClientListSchemas {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientListSchemas();
+   *   }
+   *
+   *   public static void schemaServiceClientListSchemas() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       ProjectName parent = ProjectName.of("[PROJECT]");
+   *       for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -413,10 +602,25 @@ public final ListSchemasPagedResponse listSchemas(ProjectName parent) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   String parent = ProjectName.of("[PROJECT]").toString();
-   *   for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   *
+   * public class SchemaServiceClientListSchemas {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientListSchemas();
+   *   }
+   *
+   *   public static void schemaServiceClientListSchemas() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       String parent = ProjectName.of("[PROJECT]").toString();
+   *       for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -437,16 +641,33 @@ public final ListSchemasPagedResponse listSchemas(String parent) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ListSchemasRequest request =
-   *       ListSchemasRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setView(SchemaView.forNumber(0))
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Schema element : schemaServiceClient.listSchemas(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.ListSchemasRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   * import com.google.pubsub.v1.SchemaView;
+   *
+   * public class SchemaServiceClientListSchemas {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientListSchemas();
+   *   }
+   *
+   *   public static void schemaServiceClientListSchemas() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       ListSchemasRequest request =
+   *           ListSchemasRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setView(SchemaView.forNumber(0))
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (Schema element : schemaServiceClient.listSchemas(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -465,18 +686,36 @@ public final ListSchemasPagedResponse listSchemas(ListSchemasRequest request) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ListSchemasRequest request =
-   *       ListSchemasRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setView(SchemaView.forNumber(0))
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = schemaServiceClient.listSchemasPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Schema element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.ListSchemasRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   * import com.google.pubsub.v1.SchemaView;
+   *
+   * public class SchemaServiceClientListSchemas {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientListSchemas();
+   *   }
+   *
+   *   public static void schemaServiceClientListSchemas() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       ListSchemasRequest request =
+   *           ListSchemasRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setView(SchemaView.forNumber(0))
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future = schemaServiceClient.listSchemasPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Schema element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -493,24 +732,43 @@ public final ListSchemasPagedResponse listSchemas(ListSchemasRequest request) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ListSchemasRequest request =
-   *       ListSchemasRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setView(SchemaView.forNumber(0))
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListSchemasResponse response = schemaServiceClient.listSchemasCallable().call(request);
-   *     for (Schema element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.common.base.Strings;
+   * import com.google.pubsub.v1.ListSchemasRequest;
+   * import com.google.pubsub.v1.ListSchemasResponse;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   * import com.google.pubsub.v1.SchemaView;
+   *
+   * public class SchemaServiceClientListSchemas {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientListSchemas();
+   *   }
+   *
+   *   public static void schemaServiceClientListSchemas() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       ListSchemasRequest request =
+   *           ListSchemasRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setView(SchemaView.forNumber(0))
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListSchemasResponse response = schemaServiceClient.listSchemasCallable().call(request);
+   *         for (Schema element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -527,9 +785,24 @@ public final UnaryCallable listSchemasC
    * 

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
-   *   schemaServiceClient.deleteSchema(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.SchemaName;
+   *
+   * public class SchemaServiceClientDeleteSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientDeleteSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientDeleteSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
+   *       schemaServiceClient.deleteSchema(name);
+   *     }
+   *   }
    * }
    * }
* @@ -550,9 +823,24 @@ public final void deleteSchema(SchemaName name) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
-   *   schemaServiceClient.deleteSchema(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.SchemaName;
+   *
+   * public class SchemaServiceClientDeleteSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientDeleteSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientDeleteSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
+   *       schemaServiceClient.deleteSchema(name);
+   *     }
+   *   }
    * }
    * }
* @@ -572,12 +860,28 @@ public final void deleteSchema(String name) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   DeleteSchemaRequest request =
-   *       DeleteSchemaRequest.newBuilder()
-   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
-   *           .build();
-   *   schemaServiceClient.deleteSchema(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.DeleteSchemaRequest;
+   * import com.google.pubsub.v1.SchemaName;
+   *
+   * public class SchemaServiceClientDeleteSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientDeleteSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientDeleteSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       DeleteSchemaRequest request =
+   *           DeleteSchemaRequest.newBuilder()
+   *               .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *               .build();
+   *       schemaServiceClient.deleteSchema(request);
+   *     }
+   *   }
    * }
    * }
* @@ -595,14 +899,31 @@ public final void deleteSchema(DeleteSchemaRequest request) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   DeleteSchemaRequest request =
-   *       DeleteSchemaRequest.newBuilder()
-   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
-   *           .build();
-   *   ApiFuture future = schemaServiceClient.deleteSchemaCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.DeleteSchemaRequest;
+   * import com.google.pubsub.v1.SchemaName;
+   *
+   * public class SchemaServiceClientDeleteSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientDeleteSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientDeleteSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       DeleteSchemaRequest request =
+   *           DeleteSchemaRequest.newBuilder()
+   *               .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *               .build();
+   *       ApiFuture future = schemaServiceClient.deleteSchemaCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -617,10 +938,26 @@ public final UnaryCallable deleteSchemaCallable() { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Schema schema = Schema.newBuilder().build();
-   *   ValidateSchemaResponse response = schemaServiceClient.validateSchema(parent, schema);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   * import com.google.pubsub.v1.ValidateSchemaResponse;
+   *
+   * public class SchemaServiceClientValidateSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientValidateSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientValidateSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       ProjectName parent = ProjectName.of("[PROJECT]");
+   *       Schema schema = Schema.newBuilder().build();
+   *       ValidateSchemaResponse response = schemaServiceClient.validateSchema(parent, schema);
+   *     }
+   *   }
    * }
    * }
* @@ -645,10 +982,26 @@ public final ValidateSchemaResponse validateSchema(ProjectName parent, Schema sc *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   String parent = ProjectName.of("[PROJECT]").toString();
-   *   Schema schema = Schema.newBuilder().build();
-   *   ValidateSchemaResponse response = schemaServiceClient.validateSchema(parent, schema);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   * import com.google.pubsub.v1.ValidateSchemaResponse;
+   *
+   * public class SchemaServiceClientValidateSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientValidateSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientValidateSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       String parent = ProjectName.of("[PROJECT]").toString();
+   *       Schema schema = Schema.newBuilder().build();
+   *       ValidateSchemaResponse response = schemaServiceClient.validateSchema(parent, schema);
+   *     }
+   *   }
    * }
    * }
* @@ -670,13 +1023,30 @@ public final ValidateSchemaResponse validateSchema(String parent, Schema schema) *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ValidateSchemaRequest request =
-   *       ValidateSchemaRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setSchema(Schema.newBuilder().build())
-   *           .build();
-   *   ValidateSchemaResponse response = schemaServiceClient.validateSchema(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   * import com.google.pubsub.v1.ValidateSchemaRequest;
+   * import com.google.pubsub.v1.ValidateSchemaResponse;
+   *
+   * public class SchemaServiceClientValidateSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientValidateSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientValidateSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       ValidateSchemaRequest request =
+   *           ValidateSchemaRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setSchema(Schema.newBuilder().build())
+   *               .build();
+   *       ValidateSchemaResponse response = schemaServiceClient.validateSchema(request);
+   *     }
+   *   }
    * }
    * }
* @@ -694,16 +1064,34 @@ public final ValidateSchemaResponse validateSchema(ValidateSchemaRequest request *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ValidateSchemaRequest request =
-   *       ValidateSchemaRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setSchema(Schema.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       schemaServiceClient.validateSchemaCallable().futureCall(request);
-   *   // Do something.
-   *   ValidateSchemaResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Schema;
+   * import com.google.pubsub.v1.ValidateSchemaRequest;
+   * import com.google.pubsub.v1.ValidateSchemaResponse;
+   *
+   * public class SchemaServiceClientValidateSchema {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientValidateSchema();
+   *   }
+   *
+   *   public static void schemaServiceClientValidateSchema() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       ValidateSchemaRequest request =
+   *           ValidateSchemaRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setSchema(Schema.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           schemaServiceClient.validateSchemaCallable().futureCall(request);
+   *       // Do something.
+   *       ValidateSchemaResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -719,14 +1107,32 @@ public final ValidateSchemaResponse validateSchema(ValidateSchemaRequest request *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ValidateMessageRequest request =
-   *       ValidateMessageRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setMessage(ByteString.EMPTY)
-   *           .setEncoding(Encoding.forNumber(0))
-   *           .build();
-   *   ValidateMessageResponse response = schemaServiceClient.validateMessage(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.protobuf.ByteString;
+   * import com.google.pubsub.v1.Encoding;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.ValidateMessageRequest;
+   * import com.google.pubsub.v1.ValidateMessageResponse;
+   *
+   * public class SchemaServiceClientValidateMessage {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientValidateMessage();
+   *   }
+   *
+   *   public static void schemaServiceClientValidateMessage() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       ValidateMessageRequest request =
+   *           ValidateMessageRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setMessage(ByteString.EMPTY)
+   *               .setEncoding(Encoding.forNumber(0))
+   *               .build();
+   *       ValidateMessageResponse response = schemaServiceClient.validateMessage(request);
+   *     }
+   *   }
    * }
    * }
* @@ -744,17 +1150,36 @@ public final ValidateMessageResponse validateMessage(ValidateMessageRequest requ *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ValidateMessageRequest request =
-   *       ValidateMessageRequest.newBuilder()
-   *           .setParent(ProjectName.of("[PROJECT]").toString())
-   *           .setMessage(ByteString.EMPTY)
-   *           .setEncoding(Encoding.forNumber(0))
-   *           .build();
-   *   ApiFuture future =
-   *       schemaServiceClient.validateMessageCallable().futureCall(request);
-   *   // Do something.
-   *   ValidateMessageResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.protobuf.ByteString;
+   * import com.google.pubsub.v1.Encoding;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.ValidateMessageRequest;
+   * import com.google.pubsub.v1.ValidateMessageResponse;
+   *
+   * public class SchemaServiceClientValidateMessage {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientValidateMessage();
+   *   }
+   *
+   *   public static void schemaServiceClientValidateMessage() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       ValidateMessageRequest request =
+   *           ValidateMessageRequest.newBuilder()
+   *               .setParent(ProjectName.of("[PROJECT]").toString())
+   *               .setMessage(ByteString.EMPTY)
+   *               .setEncoding(Encoding.forNumber(0))
+   *               .build();
+   *       ApiFuture future =
+   *           schemaServiceClient.validateMessageCallable().futureCall(request);
+   *       // Do something.
+   *       ValidateMessageResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -772,13 +1197,29 @@ public final ValidateMessageResponse validateMessage(ValidateMessageRequest requ *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   SetIamPolicyRequest request =
-   *       SetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setPolicy(Policy.newBuilder().build())
-   *           .build();
-   *   Policy response = schemaServiceClient.setIamPolicy(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.iam.v1.Policy;
+   * import com.google.iam.v1.SetIamPolicyRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class SchemaServiceClientSetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientSetIamPolicy();
+   *   }
+   *
+   *   public static void schemaServiceClientSetIamPolicy() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       SetIamPolicyRequest request =
+   *           SetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setPolicy(Policy.newBuilder().build())
+   *               .build();
+   *       Policy response = schemaServiceClient.setIamPolicy(request);
+   *     }
+   *   }
    * }
    * }
* @@ -798,15 +1239,32 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   SetIamPolicyRequest request =
-   *       SetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setPolicy(Policy.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = schemaServiceClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   Policy response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.iam.v1.Policy;
+   * import com.google.iam.v1.SetIamPolicyRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class SchemaServiceClientSetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientSetIamPolicy();
+   *   }
+   *
+   *   public static void schemaServiceClientSetIamPolicy() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       SetIamPolicyRequest request =
+   *           SetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setPolicy(Policy.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = schemaServiceClient.setIamPolicyCallable().futureCall(request);
+   *       // Do something.
+   *       Policy response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -822,13 +1280,30 @@ public final UnaryCallable setIamPolicyCallable() { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   Policy response = schemaServiceClient.getIamPolicy(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.iam.v1.GetIamPolicyRequest;
+   * import com.google.iam.v1.GetPolicyOptions;
+   * import com.google.iam.v1.Policy;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class SchemaServiceClientGetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientGetIamPolicy();
+   *   }
+   *
+   *   public static void schemaServiceClientGetIamPolicy() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       GetIamPolicyRequest request =
+   *           GetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setOptions(GetPolicyOptions.newBuilder().build())
+   *               .build();
+   *       Policy response = schemaServiceClient.getIamPolicy(request);
+   *     }
+   *   }
    * }
    * }
* @@ -847,15 +1322,33 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = schemaServiceClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   Policy response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.iam.v1.GetIamPolicyRequest;
+   * import com.google.iam.v1.GetPolicyOptions;
+   * import com.google.iam.v1.Policy;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class SchemaServiceClientGetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientGetIamPolicy();
+   *   }
+   *
+   *   public static void schemaServiceClientGetIamPolicy() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       GetIamPolicyRequest request =
+   *           GetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setOptions(GetPolicyOptions.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = schemaServiceClient.getIamPolicyCallable().futureCall(request);
+   *       // Do something.
+   *       Policy response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -875,13 +1368,30 @@ public final UnaryCallable getIamPolicyCallable() { *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   TestIamPermissionsResponse response = schemaServiceClient.testIamPermissions(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.iam.v1.TestIamPermissionsRequest;
+   * import com.google.iam.v1.TestIamPermissionsResponse;
+   * import com.google.pubsub.v1.ProjectName;
+   * import java.util.ArrayList;
+   *
+   * public class SchemaServiceClientTestIamPermissions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientTestIamPermissions();
+   *   }
+   *
+   *   public static void schemaServiceClientTestIamPermissions() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       TestIamPermissionsRequest request =
+   *           TestIamPermissionsRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .addAllPermissions(new ArrayList())
+   *               .build();
+   *       TestIamPermissionsResponse response = schemaServiceClient.testIamPermissions(request);
+   *     }
+   *   }
    * }
    * }
* @@ -904,16 +1414,34 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq *

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   ApiFuture future =
-   *       schemaServiceClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something.
-   *   TestIamPermissionsResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+   * import com.google.iam.v1.TestIamPermissionsRequest;
+   * import com.google.iam.v1.TestIamPermissionsResponse;
+   * import com.google.pubsub.v1.ProjectName;
+   * import java.util.ArrayList;
+   *
+   * public class SchemaServiceClientTestIamPermissions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     schemaServiceClientTestIamPermissions();
+   *   }
+   *
+   *   public static void schemaServiceClientTestIamPermissions() throws Exception {
+   *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *       TestIamPermissionsRequest request =
+   *           TestIamPermissionsRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .addAllPermissions(new ArrayList())
+   *               .build();
+   *       ApiFuture future =
+   *           schemaServiceClient.testIamPermissionsCallable().futureCall(request);
+   *       // Do something.
+   *       TestIamPermissionsResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceSettings.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceSettings.java index 4f7dfdda43..0b8e1fbd7a 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceSettings.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceSettings.java @@ -69,17 +69,31 @@ *

For example, to set the total timeout of createSchema to 30 seconds: * *

{@code
- * SchemaServiceSettings.Builder schemaServiceSettingsBuilder = SchemaServiceSettings.newBuilder();
- * schemaServiceSettingsBuilder
- *     .createSchemaSettings()
- *     .setRetrySettings(
- *         schemaServiceSettingsBuilder
- *             .createSchemaSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * SchemaServiceSettings schemaServiceSettings = schemaServiceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.SchemaServiceSettings;
+ * import java.time.Duration;
+ *
+ * public class SchemaServiceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     schemaServiceSettings();
+ *   }
+ *
+ *   public static void schemaServiceSettings() throws Exception {
+ *     SchemaServiceSettings.Builder schemaServiceSettingsBuilder = SchemaServiceSettings.newBuilder();
+ *     schemaServiceSettingsBuilder
+ *         .createSchemaSettings()
+ *         .setRetrySettings(
+ *             schemaServiceSettingsBuilder
+ *                 .createSchemaSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     SchemaServiceSettings schemaServiceSettings = schemaServiceSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java index 01e6bd03a6..911870ad49 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java @@ -77,13 +77,30 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
- *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
- *   PushConfig pushConfig = PushConfig.newBuilder().build();
- *   int ackDeadlineSeconds = 2135351438;
- *   Subscription response =
- *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+ * import com.google.pubsub.v1.PushConfig;
+ * import com.google.pubsub.v1.Subscription;
+ * import com.google.pubsub.v1.SubscriptionName;
+ * import com.google.pubsub.v1.TopicName;
+ *
+ * public class SubscriptionAdminClientCreateSubscription {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     subscriptionAdminClientCreateSubscription();
+ *   }
+ *
+ *   public static void subscriptionAdminClientCreateSubscription() throws Exception {
+ *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ *       SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ *       TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ *       PushConfig pushConfig = PushConfig.newBuilder().build();
+ *       int ackDeadlineSeconds = 2135351438;
+ *       Subscription response =
+ *           subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ *     }
+ *   }
  * }
  * }
* @@ -117,21 +134,52 @@ *

To customize credentials: * *

{@code
- * SubscriptionAdminSettings subscriptionAdminSettings =
- *     SubscriptionAdminSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * SubscriptionAdminClient subscriptionAdminClient =
- *     SubscriptionAdminClient.create(subscriptionAdminSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+ * import com.google.cloud.pubsub.v1.SubscriptionAdminSettings;
+ * import com.google.cloud.pubsub.v1.myCredentials;
+ *
+ * public class SubscriptionAdminClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     subscriptionAdminClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void subscriptionAdminClientSetCredentialsProvider() throws Exception {
+ *     SubscriptionAdminSettings subscriptionAdminSettings =
+ *         SubscriptionAdminSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     SubscriptionAdminClient subscriptionAdminClient =
+ *         SubscriptionAdminClient.create(subscriptionAdminSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * SubscriptionAdminSettings subscriptionAdminSettings =
- *     SubscriptionAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
- * SubscriptionAdminClient subscriptionAdminClient =
- *     SubscriptionAdminClient.create(subscriptionAdminSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+ * import com.google.cloud.pubsub.v1.SubscriptionAdminSettings;
+ * import com.google.cloud.pubsub.v1.myEndpoint;
+ *
+ * public class SubscriptionAdminClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     subscriptionAdminClientSetEndpoint();
+ *   }
+ *
+ *   public static void subscriptionAdminClientSetEndpoint() throws Exception {
+ *     SubscriptionAdminSettings subscriptionAdminSettings =
+ *         SubscriptionAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     SubscriptionAdminClient subscriptionAdminClient =
+ *         SubscriptionAdminClient.create(subscriptionAdminSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -205,13 +253,30 @@ public SubscriberStub getStub() { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   PushConfig pushConfig = PushConfig.newBuilder().build();
-   *   int ackDeadlineSeconds = 2135351438;
-   *   Subscription response =
-   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.PushConfig;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class SubscriptionAdminClientCreateSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *       TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+   *       PushConfig pushConfig = PushConfig.newBuilder().build();
+   *       int ackDeadlineSeconds = 2135351438;
+   *       Subscription response =
+   *           subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+   *     }
+   *   }
    * }
    * }
* @@ -271,13 +336,30 @@ public final Subscription createSubscription( *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
-   *   PushConfig pushConfig = PushConfig.newBuilder().build();
-   *   int ackDeadlineSeconds = 2135351438;
-   *   Subscription response =
-   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.PushConfig;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class SubscriptionAdminClientCreateSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *       String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *       PushConfig pushConfig = PushConfig.newBuilder().build();
+   *       int ackDeadlineSeconds = 2135351438;
+   *       Subscription response =
+   *           subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+   *     }
+   *   }
    * }
    * }
* @@ -337,13 +419,30 @@ public final Subscription createSubscription( *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   PushConfig pushConfig = PushConfig.newBuilder().build();
-   *   int ackDeadlineSeconds = 2135351438;
-   *   Subscription response =
-   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.PushConfig;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class SubscriptionAdminClientCreateSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *       TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+   *       PushConfig pushConfig = PushConfig.newBuilder().build();
+   *       int ackDeadlineSeconds = 2135351438;
+   *       Subscription response =
+   *           subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+   *     }
+   *   }
    * }
    * }
* @@ -403,13 +502,30 @@ public final Subscription createSubscription( *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
-   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
-   *   PushConfig pushConfig = PushConfig.newBuilder().build();
-   *   int ackDeadlineSeconds = 2135351438;
-   *   Subscription response =
-   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.PushConfig;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class SubscriptionAdminClientCreateSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *       String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *       PushConfig pushConfig = PushConfig.newBuilder().build();
+   *       int ackDeadlineSeconds = 2135351438;
+   *       Subscription response =
+   *           subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+   *     }
+   *   }
    * }
    * }
* @@ -469,25 +585,47 @@ public final Subscription createSubscription( *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   Subscription request =
-   *       Subscription.newBuilder()
-   *           .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .setPushConfig(PushConfig.newBuilder().build())
-   *           .setAckDeadlineSeconds(2135351438)
-   *           .setRetainAckedMessages(true)
-   *           .setMessageRetentionDuration(Duration.newBuilder().build())
-   *           .putAllLabels(new HashMap())
-   *           .setEnableMessageOrdering(true)
-   *           .setExpirationPolicy(ExpirationPolicy.newBuilder().build())
-   *           .setFilter("filter-1274492040")
-   *           .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build())
-   *           .setRetryPolicy(RetryPolicy.newBuilder().build())
-   *           .setDetached(true)
-   *           .setTopicMessageRetentionDuration(Duration.newBuilder().build())
-   *           .build();
-   *   Subscription response = subscriptionAdminClient.createSubscription(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Duration;
+   * import com.google.pubsub.v1.DeadLetterPolicy;
+   * import com.google.pubsub.v1.ExpirationPolicy;
+   * import com.google.pubsub.v1.PushConfig;
+   * import com.google.pubsub.v1.RetryPolicy;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import com.google.pubsub.v1.TopicName;
+   * import java.util.HashMap;
+   *
+   * public class SubscriptionAdminClientCreateSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       Subscription request =
+   *           Subscription.newBuilder()
+   *               .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .setPushConfig(PushConfig.newBuilder().build())
+   *               .setAckDeadlineSeconds(2135351438)
+   *               .setRetainAckedMessages(true)
+   *               .setMessageRetentionDuration(Duration.newBuilder().build())
+   *               .putAllLabels(new HashMap())
+   *               .setEnableMessageOrdering(true)
+   *               .setExpirationPolicy(ExpirationPolicy.newBuilder().build())
+   *               .setFilter("filter-1274492040")
+   *               .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build())
+   *               .setRetryPolicy(RetryPolicy.newBuilder().build())
+   *               .setDetached(true)
+   *               .setTopicMessageRetentionDuration(Duration.newBuilder().build())
+   *               .build();
+   *       Subscription response = subscriptionAdminClient.createSubscription(request);
+   *     }
+   *   }
    * }
    * }
* @@ -514,28 +652,51 @@ public final Subscription createSubscription(Subscription request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   Subscription request =
-   *       Subscription.newBuilder()
-   *           .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .setPushConfig(PushConfig.newBuilder().build())
-   *           .setAckDeadlineSeconds(2135351438)
-   *           .setRetainAckedMessages(true)
-   *           .setMessageRetentionDuration(Duration.newBuilder().build())
-   *           .putAllLabels(new HashMap())
-   *           .setEnableMessageOrdering(true)
-   *           .setExpirationPolicy(ExpirationPolicy.newBuilder().build())
-   *           .setFilter("filter-1274492040")
-   *           .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build())
-   *           .setRetryPolicy(RetryPolicy.newBuilder().build())
-   *           .setDetached(true)
-   *           .setTopicMessageRetentionDuration(Duration.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.createSubscriptionCallable().futureCall(request);
-   *   // Do something.
-   *   Subscription response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Duration;
+   * import com.google.pubsub.v1.DeadLetterPolicy;
+   * import com.google.pubsub.v1.ExpirationPolicy;
+   * import com.google.pubsub.v1.PushConfig;
+   * import com.google.pubsub.v1.RetryPolicy;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import com.google.pubsub.v1.TopicName;
+   * import java.util.HashMap;
+   *
+   * public class SubscriptionAdminClientCreateSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       Subscription request =
+   *           Subscription.newBuilder()
+   *               .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .setPushConfig(PushConfig.newBuilder().build())
+   *               .setAckDeadlineSeconds(2135351438)
+   *               .setRetainAckedMessages(true)
+   *               .setMessageRetentionDuration(Duration.newBuilder().build())
+   *               .putAllLabels(new HashMap())
+   *               .setEnableMessageOrdering(true)
+   *               .setExpirationPolicy(ExpirationPolicy.newBuilder().build())
+   *               .setFilter("filter-1274492040")
+   *               .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build())
+   *               .setRetryPolicy(RetryPolicy.newBuilder().build())
+   *               .setDetached(true)
+   *               .setTopicMessageRetentionDuration(Duration.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.createSubscriptionCallable().futureCall(request);
+   *       // Do something.
+   *       Subscription response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -550,9 +711,24 @@ public final UnaryCallable createSubscriptionCallabl *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   Subscription response = subscriptionAdminClient.getSubscription(subscription);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientGetSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientGetSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientGetSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *       Subscription response = subscriptionAdminClient.getSubscription(subscription);
+   *     }
+   *   }
    * }
    * }
* @@ -575,9 +751,24 @@ public final Subscription getSubscription(SubscriptionName subscription) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
-   *   Subscription response = subscriptionAdminClient.getSubscription(subscription);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientGetSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientGetSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientGetSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *       Subscription response = subscriptionAdminClient.getSubscription(subscription);
+   *     }
+   *   }
    * }
    * }
* @@ -598,12 +789,28 @@ public final Subscription getSubscription(String subscription) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   GetSubscriptionRequest request =
-   *       GetSubscriptionRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .build();
-   *   Subscription response = subscriptionAdminClient.getSubscription(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.GetSubscriptionRequest;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientGetSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientGetSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientGetSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       GetSubscriptionRequest request =
+   *           GetSubscriptionRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .build();
+   *       Subscription response = subscriptionAdminClient.getSubscription(request);
+   *     }
+   *   }
    * }
    * }
* @@ -621,15 +828,32 @@ public final Subscription getSubscription(GetSubscriptionRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   GetSubscriptionRequest request =
-   *       GetSubscriptionRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.getSubscriptionCallable().futureCall(request);
-   *   // Do something.
-   *   Subscription response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.GetSubscriptionRequest;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientGetSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientGetSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientGetSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       GetSubscriptionRequest request =
+   *           GetSubscriptionRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.getSubscriptionCallable().futureCall(request);
+   *       // Do something.
+   *       Subscription response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -645,13 +869,29 @@ public final UnaryCallable getSubscription *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   UpdateSubscriptionRequest request =
-   *       UpdateSubscriptionRequest.newBuilder()
-   *           .setSubscription(Subscription.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   Subscription response = subscriptionAdminClient.updateSubscription(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.FieldMask;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.UpdateSubscriptionRequest;
+   *
+   * public class SubscriptionAdminClientUpdateSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientUpdateSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientUpdateSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       UpdateSubscriptionRequest request =
+   *           UpdateSubscriptionRequest.newBuilder()
+   *               .setSubscription(Subscription.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       Subscription response = subscriptionAdminClient.updateSubscription(request);
+   *     }
+   *   }
    * }
    * }
* @@ -670,16 +910,33 @@ public final Subscription updateSubscription(UpdateSubscriptionRequest request) *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   UpdateSubscriptionRequest request =
-   *       UpdateSubscriptionRequest.newBuilder()
-   *           .setSubscription(Subscription.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.updateSubscriptionCallable().futureCall(request);
-   *   // Do something.
-   *   Subscription response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.FieldMask;
+   * import com.google.pubsub.v1.Subscription;
+   * import com.google.pubsub.v1.UpdateSubscriptionRequest;
+   *
+   * public class SubscriptionAdminClientUpdateSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientUpdateSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientUpdateSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       UpdateSubscriptionRequest request =
+   *           UpdateSubscriptionRequest.newBuilder()
+   *               .setSubscription(Subscription.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.updateSubscriptionCallable().futureCall(request);
+   *       // Do something.
+   *       Subscription response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -694,10 +951,25 @@ public final UnaryCallable updateSubscr *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Subscription;
+   *
+   * public class SubscriptionAdminClientListSubscriptions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientListSubscriptions();
+   *   }
+   *
+   *   public static void subscriptionAdminClientListSubscriptions() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ProjectName project = ProjectName.of("[PROJECT]");
+   *       for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -721,10 +993,25 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ProjectName projec *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String project = ProjectName.of("[PROJECT]").toString();
-   *   for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Subscription;
+   *
+   * public class SubscriptionAdminClientListSubscriptions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientListSubscriptions();
+   *   }
+   *
+   *   public static void subscriptionAdminClientListSubscriptions() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String project = ProjectName.of("[PROJECT]").toString();
+   *       for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -746,15 +1033,31 @@ public final ListSubscriptionsPagedResponse listSubscriptions(String project) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ListSubscriptionsRequest request =
-   *       ListSubscriptionsRequest.newBuilder()
-   *           .setProject(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Subscription element : subscriptionAdminClient.listSubscriptions(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.ListSubscriptionsRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Subscription;
+   *
+   * public class SubscriptionAdminClientListSubscriptions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientListSubscriptions();
+   *   }
+   *
+   *   public static void subscriptionAdminClientListSubscriptions() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ListSubscriptionsRequest request =
+   *           ListSubscriptionsRequest.newBuilder()
+   *               .setProject(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (Subscription element : subscriptionAdminClient.listSubscriptions(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -773,18 +1076,35 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ListSubscriptionsRequest request =
-   *       ListSubscriptionsRequest.newBuilder()
-   *           .setProject(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.listSubscriptionsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Subscription element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.ListSubscriptionsRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Subscription;
+   *
+   * public class SubscriptionAdminClientListSubscriptions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientListSubscriptions();
+   *   }
+   *
+   *   public static void subscriptionAdminClientListSubscriptions() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ListSubscriptionsRequest request =
+   *           ListSubscriptionsRequest.newBuilder()
+   *               .setProject(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.listSubscriptionsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Subscription element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -801,24 +1121,42 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ListSubscriptionsRequest request =
-   *       ListSubscriptionsRequest.newBuilder()
-   *           .setProject(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListSubscriptionsResponse response =
-   *         subscriptionAdminClient.listSubscriptionsCallable().call(request);
-   *     for (Subscription element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.common.base.Strings;
+   * import com.google.pubsub.v1.ListSubscriptionsRequest;
+   * import com.google.pubsub.v1.ListSubscriptionsResponse;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Subscription;
+   *
+   * public class SubscriptionAdminClientListSubscriptions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientListSubscriptions();
+   *   }
+   *
+   *   public static void subscriptionAdminClientListSubscriptions() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ListSubscriptionsRequest request =
+   *           ListSubscriptionsRequest.newBuilder()
+   *               .setProject(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListSubscriptionsResponse response =
+   *             subscriptionAdminClient.listSubscriptionsCallable().call(request);
+   *         for (Subscription element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -839,9 +1177,24 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR
    * 

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   subscriptionAdminClient.deleteSubscription(subscription);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientDeleteSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientDeleteSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientDeleteSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *       subscriptionAdminClient.deleteSubscription(subscription);
+   *     }
+   *   }
    * }
    * }
* @@ -867,9 +1220,24 @@ public final void deleteSubscription(SubscriptionName subscription) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
-   *   subscriptionAdminClient.deleteSubscription(subscription);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientDeleteSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientDeleteSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientDeleteSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *       subscriptionAdminClient.deleteSubscription(subscription);
+   *     }
+   *   }
    * }
    * }
* @@ -893,12 +1261,28 @@ public final void deleteSubscription(String subscription) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   DeleteSubscriptionRequest request =
-   *       DeleteSubscriptionRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .build();
-   *   subscriptionAdminClient.deleteSubscription(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.DeleteSubscriptionRequest;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientDeleteSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientDeleteSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientDeleteSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       DeleteSubscriptionRequest request =
+   *           DeleteSubscriptionRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .build();
+   *       subscriptionAdminClient.deleteSubscription(request);
+   *     }
+   *   }
    * }
    * }
* @@ -919,15 +1303,32 @@ public final void deleteSubscription(DeleteSubscriptionRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   DeleteSubscriptionRequest request =
-   *       DeleteSubscriptionRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.deleteSubscriptionCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.DeleteSubscriptionRequest;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientDeleteSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientDeleteSubscription();
+   *   }
+   *
+   *   public static void subscriptionAdminClientDeleteSubscription() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       DeleteSubscriptionRequest request =
+   *           DeleteSubscriptionRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.deleteSubscriptionCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -945,11 +1346,28 @@ public final UnaryCallable deleteSubscriptionC *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   List ackIds = new ArrayList<>();
-   *   int ackDeadlineSeconds = 2135351438;
-   *   subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class SubscriptionAdminClientModifyAckDeadline {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientModifyAckDeadline();
+   *   }
+   *
+   *   public static void subscriptionAdminClientModifyAckDeadline() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *       List ackIds = new ArrayList<>();
+   *       int ackDeadlineSeconds = 2135351438;
+   *       subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
+   *     }
+   *   }
    * }
    * }
* @@ -986,11 +1404,28 @@ public final void modifyAckDeadline( *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
-   *   List ackIds = new ArrayList<>();
-   *   int ackDeadlineSeconds = 2135351438;
-   *   subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class SubscriptionAdminClientModifyAckDeadline {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientModifyAckDeadline();
+   *   }
+   *
+   *   public static void subscriptionAdminClientModifyAckDeadline() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *       List ackIds = new ArrayList<>();
+   *       int ackDeadlineSeconds = 2135351438;
+   *       subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
+   *     }
+   *   }
    * }
    * }
* @@ -1027,14 +1462,31 @@ public final void modifyAckDeadline( *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ModifyAckDeadlineRequest request =
-   *       ModifyAckDeadlineRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .addAllAckIds(new ArrayList())
-   *           .setAckDeadlineSeconds(2135351438)
-   *           .build();
-   *   subscriptionAdminClient.modifyAckDeadline(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.ModifyAckDeadlineRequest;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import java.util.ArrayList;
+   *
+   * public class SubscriptionAdminClientModifyAckDeadline {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientModifyAckDeadline();
+   *   }
+   *
+   *   public static void subscriptionAdminClientModifyAckDeadline() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ModifyAckDeadlineRequest request =
+   *           ModifyAckDeadlineRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .addAllAckIds(new ArrayList())
+   *               .setAckDeadlineSeconds(2135351438)
+   *               .build();
+   *       subscriptionAdminClient.modifyAckDeadline(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1055,17 +1507,35 @@ public final void modifyAckDeadline(ModifyAckDeadlineRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ModifyAckDeadlineRequest request =
-   *       ModifyAckDeadlineRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .addAllAckIds(new ArrayList())
-   *           .setAckDeadlineSeconds(2135351438)
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.modifyAckDeadlineCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.ModifyAckDeadlineRequest;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import java.util.ArrayList;
+   *
+   * public class SubscriptionAdminClientModifyAckDeadline {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientModifyAckDeadline();
+   *   }
+   *
+   *   public static void subscriptionAdminClientModifyAckDeadline() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ModifyAckDeadlineRequest request =
+   *           ModifyAckDeadlineRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .addAllAckIds(new ArrayList())
+   *               .setAckDeadlineSeconds(2135351438)
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.modifyAckDeadlineCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1084,10 +1554,27 @@ public final UnaryCallable modifyAckDeadlineCal *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   List ackIds = new ArrayList<>();
-   *   subscriptionAdminClient.acknowledge(subscription, ackIds);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class SubscriptionAdminClientAcknowledge {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientAcknowledge();
+   *   }
+   *
+   *   public static void subscriptionAdminClientAcknowledge() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *       List ackIds = new ArrayList<>();
+   *       subscriptionAdminClient.acknowledge(subscription, ackIds);
+   *     }
+   *   }
    * }
    * }
* @@ -1117,10 +1604,27 @@ public final void acknowledge(SubscriptionName subscription, List ackIds *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
-   *   List ackIds = new ArrayList<>();
-   *   subscriptionAdminClient.acknowledge(subscription, ackIds);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class SubscriptionAdminClientAcknowledge {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientAcknowledge();
+   *   }
+   *
+   *   public static void subscriptionAdminClientAcknowledge() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *       List ackIds = new ArrayList<>();
+   *       subscriptionAdminClient.acknowledge(subscription, ackIds);
+   *     }
+   *   }
    * }
    * }
* @@ -1147,13 +1651,30 @@ public final void acknowledge(String subscription, List ackIds) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   AcknowledgeRequest request =
-   *       AcknowledgeRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .addAllAckIds(new ArrayList())
-   *           .build();
-   *   subscriptionAdminClient.acknowledge(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.AcknowledgeRequest;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import java.util.ArrayList;
+   *
+   * public class SubscriptionAdminClientAcknowledge {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientAcknowledge();
+   *   }
+   *
+   *   public static void subscriptionAdminClientAcknowledge() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       AcknowledgeRequest request =
+   *           AcknowledgeRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .addAllAckIds(new ArrayList())
+   *               .build();
+   *       subscriptionAdminClient.acknowledge(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1175,15 +1696,33 @@ public final void acknowledge(AcknowledgeRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   AcknowledgeRequest request =
-   *       AcknowledgeRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .addAllAckIds(new ArrayList())
-   *           .build();
-   *   ApiFuture future = subscriptionAdminClient.acknowledgeCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.AcknowledgeRequest;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import java.util.ArrayList;
+   *
+   * public class SubscriptionAdminClientAcknowledge {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientAcknowledge();
+   *   }
+   *
+   *   public static void subscriptionAdminClientAcknowledge() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       AcknowledgeRequest request =
+   *           AcknowledgeRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .addAllAckIds(new ArrayList())
+   *               .build();
+   *       ApiFuture future = subscriptionAdminClient.acknowledgeCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1199,10 +1738,25 @@ public final UnaryCallable acknowledgeCallable() { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   int maxMessages = 496131527;
-   *   PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.PullResponse;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientPull {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientPull();
+   *   }
+   *
+   *   public static void subscriptionAdminClientPull() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *       int maxMessages = 496131527;
+   *       PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
+   *     }
+   *   }
    * }
    * }
* @@ -1229,10 +1783,25 @@ public final PullResponse pull(SubscriptionName subscription, int maxMessages) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
-   *   int maxMessages = 496131527;
-   *   PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.PullResponse;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientPull {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientPull();
+   *   }
+   *
+   *   public static void subscriptionAdminClientPull() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *       int maxMessages = 496131527;
+   *       PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
+   *     }
+   *   }
    * }
    * }
* @@ -1256,12 +1825,27 @@ public final PullResponse pull(String subscription, int maxMessages) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   boolean returnImmediately = true;
-   *   int maxMessages = 496131527;
-   *   PullResponse response =
-   *       subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.PullResponse;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientPull {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientPull();
+   *   }
+   *
+   *   public static void subscriptionAdminClientPull() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *       boolean returnImmediately = true;
+   *       int maxMessages = 496131527;
+   *       PullResponse response =
+   *           subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
+   *     }
+   *   }
    * }
    * }
* @@ -1296,12 +1880,27 @@ public final PullResponse pull( *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
-   *   boolean returnImmediately = true;
-   *   int maxMessages = 496131527;
-   *   PullResponse response =
-   *       subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.PullResponse;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientPull {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientPull();
+   *   }
+   *
+   *   public static void subscriptionAdminClientPull() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *       boolean returnImmediately = true;
+   *       int maxMessages = 496131527;
+   *       PullResponse response =
+   *           subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
+   *     }
+   *   }
    * }
    * }
* @@ -1335,14 +1934,30 @@ public final PullResponse pull(String subscription, boolean returnImmediately, i *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   PullRequest request =
-   *       PullRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .setReturnImmediately(true)
-   *           .setMaxMessages(496131527)
-   *           .build();
-   *   PullResponse response = subscriptionAdminClient.pull(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.PullRequest;
+   * import com.google.pubsub.v1.PullResponse;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientPull {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientPull();
+   *   }
+   *
+   *   public static void subscriptionAdminClientPull() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       PullRequest request =
+   *           PullRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .setReturnImmediately(true)
+   *               .setMaxMessages(496131527)
+   *               .build();
+   *       PullResponse response = subscriptionAdminClient.pull(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1361,16 +1976,33 @@ public final PullResponse pull(PullRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   PullRequest request =
-   *       PullRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .setReturnImmediately(true)
-   *           .setMaxMessages(496131527)
-   *           .build();
-   *   ApiFuture future = subscriptionAdminClient.pullCallable().futureCall(request);
-   *   // Do something.
-   *   PullResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.PullRequest;
+   * import com.google.pubsub.v1.PullResponse;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientPull {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientPull();
+   *   }
+   *
+   *   public static void subscriptionAdminClientPull() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       PullRequest request =
+   *           PullRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .setReturnImmediately(true)
+   *               .setMaxMessages(496131527)
+   *               .build();
+   *       ApiFuture future = subscriptionAdminClient.pullCallable().futureCall(request);
+   *       // Do something.
+   *       PullResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1390,23 +2022,41 @@ public final UnaryCallable pullCallable() { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   BidiStream bidiStream =
-   *       subscriptionAdminClient.streamingPullCallable().call();
-   *   StreamingPullRequest request =
-   *       StreamingPullRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .addAllAckIds(new ArrayList())
-   *           .addAllModifyDeadlineSeconds(new ArrayList())
-   *           .addAllModifyDeadlineAckIds(new ArrayList())
-   *           .setStreamAckDeadlineSeconds(1875467245)
-   *           .setClientId("clientId908408390")
-   *           .setMaxOutstandingMessages(-1315266996)
-   *           .setMaxOutstandingBytes(-2103098517)
-   *           .build();
-   *   bidiStream.send(request);
-   *   for (StreamingPullResponse response : bidiStream) {
-   *     // Do something when a response is received.
+   * package com.google.example;
+   *
+   * import com.google.api.gax.rpc.BidiStream;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.StreamingPullRequest;
+   * import com.google.pubsub.v1.StreamingPullResponse;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import java.util.ArrayList;
+   *
+   * public class SubscriptionAdminClientStreamingPull {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientStreamingPull();
+   *   }
+   *
+   *   public static void subscriptionAdminClientStreamingPull() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       BidiStream bidiStream =
+   *           subscriptionAdminClient.streamingPullCallable().call();
+   *       StreamingPullRequest request =
+   *           StreamingPullRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .addAllAckIds(new ArrayList())
+   *               .addAllModifyDeadlineSeconds(new ArrayList())
+   *               .addAllModifyDeadlineAckIds(new ArrayList())
+   *               .setStreamAckDeadlineSeconds(1875467245)
+   *               .setClientId("clientId908408390")
+   *               .setMaxOutstandingMessages(-1315266996)
+   *               .setMaxOutstandingBytes(-2103098517)
+   *               .build();
+   *       bidiStream.send(request);
+   *       for (StreamingPullResponse response : bidiStream) {
+   *         // Do something when a response is received.
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1428,10 +2078,26 @@ public final UnaryCallable pullCallable() { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   PushConfig pushConfig = PushConfig.newBuilder().build();
-   *   subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.PushConfig;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientModifyPushConfig {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientModifyPushConfig();
+   *   }
+   *
+   *   public static void subscriptionAdminClientModifyPushConfig() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *       PushConfig pushConfig = PushConfig.newBuilder().build();
+   *       subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
+   *     }
+   *   }
    * }
    * }
* @@ -1464,10 +2130,26 @@ public final void modifyPushConfig(SubscriptionName subscription, PushConfig pus *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
-   *   PushConfig pushConfig = PushConfig.newBuilder().build();
-   *   subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.PushConfig;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientModifyPushConfig {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientModifyPushConfig();
+   *   }
+   *
+   *   public static void subscriptionAdminClientModifyPushConfig() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *       PushConfig pushConfig = PushConfig.newBuilder().build();
+   *       subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
+   *     }
+   *   }
    * }
    * }
* @@ -1500,13 +2182,30 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ModifyPushConfigRequest request =
-   *       ModifyPushConfigRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .setPushConfig(PushConfig.newBuilder().build())
-   *           .build();
-   *   subscriptionAdminClient.modifyPushConfig(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.ModifyPushConfigRequest;
+   * import com.google.pubsub.v1.PushConfig;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientModifyPushConfig {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientModifyPushConfig();
+   *   }
+   *
+   *   public static void subscriptionAdminClientModifyPushConfig() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ModifyPushConfigRequest request =
+   *           ModifyPushConfigRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .setPushConfig(PushConfig.newBuilder().build())
+   *               .build();
+   *       subscriptionAdminClient.modifyPushConfig(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1529,16 +2228,34 @@ public final void modifyPushConfig(ModifyPushConfigRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ModifyPushConfigRequest request =
-   *       ModifyPushConfigRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .setPushConfig(PushConfig.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.modifyPushConfigCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.ModifyPushConfigRequest;
+   * import com.google.pubsub.v1.PushConfig;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientModifyPushConfig {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientModifyPushConfig();
+   *   }
+   *
+   *   public static void subscriptionAdminClientModifyPushConfig() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ModifyPushConfigRequest request =
+   *           ModifyPushConfigRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .setPushConfig(PushConfig.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.modifyPushConfigCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1556,9 +2273,24 @@ public final UnaryCallable modifyPushConfigCalla *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.SnapshotName;
+   *
+   * public class SubscriptionAdminClientGetSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientGetSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientGetSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *       Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
+   *     }
+   *   }
    * }
    * }
* @@ -1584,9 +2316,24 @@ public final Snapshot getSnapshot(SnapshotName snapshot) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
-   *   Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.SnapshotName;
+   *
+   * public class SubscriptionAdminClientGetSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientGetSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientGetSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
+   *       Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
+   *     }
+   *   }
    * }
    * }
* @@ -1609,12 +2356,28 @@ public final Snapshot getSnapshot(String snapshot) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   GetSnapshotRequest request =
-   *       GetSnapshotRequest.newBuilder()
-   *           .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
-   *           .build();
-   *   Snapshot response = subscriptionAdminClient.getSnapshot(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.GetSnapshotRequest;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.SnapshotName;
+   *
+   * public class SubscriptionAdminClientGetSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientGetSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientGetSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       GetSnapshotRequest request =
+   *           GetSnapshotRequest.newBuilder()
+   *               .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
+   *               .build();
+   *       Snapshot response = subscriptionAdminClient.getSnapshot(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1635,15 +2398,32 @@ public final Snapshot getSnapshot(GetSnapshotRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   GetSnapshotRequest request =
-   *       GetSnapshotRequest.newBuilder()
-   *           .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.getSnapshotCallable().futureCall(request);
-   *   // Do something.
-   *   Snapshot response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.GetSnapshotRequest;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.SnapshotName;
+   *
+   * public class SubscriptionAdminClientGetSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientGetSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientGetSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       GetSnapshotRequest request =
+   *           GetSnapshotRequest.newBuilder()
+   *               .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.getSnapshotCallable().futureCall(request);
+   *       // Do something.
+   *       Snapshot response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1661,10 +2441,25 @@ public final UnaryCallable getSnapshotCallable() { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Snapshot;
+   *
+   * public class SubscriptionAdminClientListSnapshots {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientListSnapshots();
+   *   }
+   *
+   *   public static void subscriptionAdminClientListSnapshots() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ProjectName project = ProjectName.of("[PROJECT]");
+   *       for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1691,10 +2486,25 @@ public final ListSnapshotsPagedResponse listSnapshots(ProjectName project) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String project = ProjectName.of("[PROJECT]").toString();
-   *   for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Snapshot;
+   *
+   * public class SubscriptionAdminClientListSnapshots {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientListSnapshots();
+   *   }
+   *
+   *   public static void subscriptionAdminClientListSnapshots() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String project = ProjectName.of("[PROJECT]").toString();
+   *       for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1718,15 +2528,31 @@ public final ListSnapshotsPagedResponse listSnapshots(String project) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ListSnapshotsRequest request =
-   *       ListSnapshotsRequest.newBuilder()
-   *           .setProject(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Snapshot element : subscriptionAdminClient.listSnapshots(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.ListSnapshotsRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Snapshot;
+   *
+   * public class SubscriptionAdminClientListSnapshots {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientListSnapshots();
+   *   }
+   *
+   *   public static void subscriptionAdminClientListSnapshots() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ListSnapshotsRequest request =
+   *           ListSnapshotsRequest.newBuilder()
+   *               .setProject(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (Snapshot element : subscriptionAdminClient.listSnapshots(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1748,18 +2574,35 @@ public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest reque *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ListSnapshotsRequest request =
-   *       ListSnapshotsRequest.newBuilder()
-   *           .setProject(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.listSnapshotsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Snapshot element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.ListSnapshotsRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Snapshot;
+   *
+   * public class SubscriptionAdminClientListSnapshots {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientListSnapshots();
+   *   }
+   *
+   *   public static void subscriptionAdminClientListSnapshots() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ListSnapshotsRequest request =
+   *           ListSnapshotsRequest.newBuilder()
+   *               .setProject(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.listSnapshotsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Snapshot element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -1779,24 +2622,42 @@ public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest reque *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ListSnapshotsRequest request =
-   *       ListSnapshotsRequest.newBuilder()
-   *           .setProject(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListSnapshotsResponse response =
-   *         subscriptionAdminClient.listSnapshotsCallable().call(request);
-   *     for (Snapshot element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.common.base.Strings;
+   * import com.google.pubsub.v1.ListSnapshotsRequest;
+   * import com.google.pubsub.v1.ListSnapshotsResponse;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Snapshot;
+   *
+   * public class SubscriptionAdminClientListSnapshots {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientListSnapshots();
+   *   }
+   *
+   *   public static void subscriptionAdminClientListSnapshots() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       ListSnapshotsRequest request =
+   *           ListSnapshotsRequest.newBuilder()
+   *               .setProject(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListSnapshotsResponse response =
+   *             subscriptionAdminClient.listSnapshotsCallable().call(request);
+   *         for (Snapshot element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -1824,10 +2685,26 @@ public final UnaryCallable listSnap
    * 

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.SnapshotName;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientCreateSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *       SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *       Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+   *     }
+   *   }
    * }
    * }
* @@ -1872,10 +2749,26 @@ public final Snapshot createSnapshot(SnapshotName name, SubscriptionName subscri *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
-   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.SnapshotName;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientCreateSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *       String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *       Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+   *     }
+   *   }
    * }
    * }
* @@ -1920,10 +2813,26 @@ public final Snapshot createSnapshot(SnapshotName name, String subscription) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
-   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.SnapshotName;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientCreateSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
+   *       SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *       Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+   *     }
+   *   }
    * }
    * }
* @@ -1968,10 +2877,26 @@ public final Snapshot createSnapshot(String name, SubscriptionName subscription) *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
-   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
-   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.SnapshotName;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientCreateSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
+   *       String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *       Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+   *     }
+   *   }
    * }
    * }
* @@ -2013,14 +2938,32 @@ public final Snapshot createSnapshot(String name, String subscription) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   CreateSnapshotRequest request =
-   *       CreateSnapshotRequest.newBuilder()
-   *           .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .putAllLabels(new HashMap())
-   *           .build();
-   *   Snapshot response = subscriptionAdminClient.createSnapshot(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.CreateSnapshotRequest;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.SnapshotName;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import java.util.HashMap;
+   *
+   * public class SubscriptionAdminClientCreateSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       CreateSnapshotRequest request =
+   *           CreateSnapshotRequest.newBuilder()
+   *               .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .putAllLabels(new HashMap())
+   *               .build();
+   *       Snapshot response = subscriptionAdminClient.createSnapshot(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2049,17 +2992,36 @@ public final Snapshot createSnapshot(CreateSnapshotRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   CreateSnapshotRequest request =
-   *       CreateSnapshotRequest.newBuilder()
-   *           .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .putAllLabels(new HashMap())
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.createSnapshotCallable().futureCall(request);
-   *   // Do something.
-   *   Snapshot response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.CreateSnapshotRequest;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.SnapshotName;
+   * import com.google.pubsub.v1.SubscriptionName;
+   * import java.util.HashMap;
+   *
+   * public class SubscriptionAdminClientCreateSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientCreateSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientCreateSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       CreateSnapshotRequest request =
+   *           CreateSnapshotRequest.newBuilder()
+   *               .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .putAllLabels(new HashMap())
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.createSnapshotCallable().futureCall(request);
+   *       // Do something.
+   *       Snapshot response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2077,13 +3039,29 @@ public final UnaryCallable createSnapshotCallab *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   UpdateSnapshotRequest request =
-   *       UpdateSnapshotRequest.newBuilder()
-   *           .setSnapshot(Snapshot.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   Snapshot response = subscriptionAdminClient.updateSnapshot(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.FieldMask;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.UpdateSnapshotRequest;
+   *
+   * public class SubscriptionAdminClientUpdateSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientUpdateSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientUpdateSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       UpdateSnapshotRequest request =
+   *           UpdateSnapshotRequest.newBuilder()
+   *               .setSnapshot(Snapshot.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       Snapshot response = subscriptionAdminClient.updateSnapshot(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2104,16 +3082,33 @@ public final Snapshot updateSnapshot(UpdateSnapshotRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   UpdateSnapshotRequest request =
-   *       UpdateSnapshotRequest.newBuilder()
-   *           .setSnapshot(Snapshot.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.updateSnapshotCallable().futureCall(request);
-   *   // Do something.
-   *   Snapshot response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.FieldMask;
+   * import com.google.pubsub.v1.Snapshot;
+   * import com.google.pubsub.v1.UpdateSnapshotRequest;
+   *
+   * public class SubscriptionAdminClientUpdateSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientUpdateSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientUpdateSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       UpdateSnapshotRequest request =
+   *           UpdateSnapshotRequest.newBuilder()
+   *               .setSnapshot(Snapshot.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.updateSnapshotCallable().futureCall(request);
+   *       // Do something.
+   *       Snapshot response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2134,9 +3129,24 @@ public final UnaryCallable updateSnapshotCallab *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   subscriptionAdminClient.deleteSnapshot(snapshot);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.SnapshotName;
+   *
+   * public class SubscriptionAdminClientDeleteSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientDeleteSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientDeleteSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *       subscriptionAdminClient.deleteSnapshot(snapshot);
+   *     }
+   *   }
    * }
    * }
* @@ -2165,9 +3175,24 @@ public final void deleteSnapshot(SnapshotName snapshot) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
-   *   subscriptionAdminClient.deleteSnapshot(snapshot);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.SnapshotName;
+   *
+   * public class SubscriptionAdminClientDeleteSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientDeleteSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientDeleteSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
+   *       subscriptionAdminClient.deleteSnapshot(snapshot);
+   *     }
+   *   }
    * }
    * }
* @@ -2194,12 +3219,28 @@ public final void deleteSnapshot(String snapshot) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   DeleteSnapshotRequest request =
-   *       DeleteSnapshotRequest.newBuilder()
-   *           .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
-   *           .build();
-   *   subscriptionAdminClient.deleteSnapshot(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.DeleteSnapshotRequest;
+   * import com.google.pubsub.v1.SnapshotName;
+   *
+   * public class SubscriptionAdminClientDeleteSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientDeleteSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientDeleteSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       DeleteSnapshotRequest request =
+   *           DeleteSnapshotRequest.newBuilder()
+   *               .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
+   *               .build();
+   *       subscriptionAdminClient.deleteSnapshot(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2223,15 +3264,32 @@ public final void deleteSnapshot(DeleteSnapshotRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   DeleteSnapshotRequest request =
-   *       DeleteSnapshotRequest.newBuilder()
-   *           .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.deleteSnapshotCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.DeleteSnapshotRequest;
+   * import com.google.pubsub.v1.SnapshotName;
+   *
+   * public class SubscriptionAdminClientDeleteSnapshot {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientDeleteSnapshot();
+   *   }
+   *
+   *   public static void subscriptionAdminClientDeleteSnapshot() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       DeleteSnapshotRequest request =
+   *           DeleteSnapshotRequest.newBuilder()
+   *               .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.deleteSnapshotCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2251,12 +3309,28 @@ public final UnaryCallable deleteSnapshotCallable( *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SeekRequest request =
-   *       SeekRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .build();
-   *   SeekResponse response = subscriptionAdminClient.seek(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.SeekRequest;
+   * import com.google.pubsub.v1.SeekResponse;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientSeek {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientSeek();
+   *   }
+   *
+   *   public static void subscriptionAdminClientSeek() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SeekRequest request =
+   *           SeekRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .build();
+   *       SeekResponse response = subscriptionAdminClient.seek(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2279,14 +3353,31 @@ public final SeekResponse seek(SeekRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SeekRequest request =
-   *       SeekRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .build();
-   *   ApiFuture future = subscriptionAdminClient.seekCallable().futureCall(request);
-   *   // Do something.
-   *   SeekResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.pubsub.v1.SeekRequest;
+   * import com.google.pubsub.v1.SeekResponse;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class SubscriptionAdminClientSeek {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientSeek();
+   *   }
+   *
+   *   public static void subscriptionAdminClientSeek() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SeekRequest request =
+   *           SeekRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .build();
+   *       ApiFuture future = subscriptionAdminClient.seekCallable().futureCall(request);
+   *       // Do something.
+   *       SeekResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2303,13 +3394,29 @@ public final UnaryCallable seekCallable() { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SetIamPolicyRequest request =
-   *       SetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setPolicy(Policy.newBuilder().build())
-   *           .build();
-   *   Policy response = subscriptionAdminClient.setIamPolicy(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.iam.v1.Policy;
+   * import com.google.iam.v1.SetIamPolicyRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class SubscriptionAdminClientSetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientSetIamPolicy();
+   *   }
+   *
+   *   public static void subscriptionAdminClientSetIamPolicy() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SetIamPolicyRequest request =
+   *           SetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setPolicy(Policy.newBuilder().build())
+   *               .build();
+   *       Policy response = subscriptionAdminClient.setIamPolicy(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2329,15 +3436,32 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SetIamPolicyRequest request =
-   *       SetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setPolicy(Policy.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = subscriptionAdminClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   Policy response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.iam.v1.Policy;
+   * import com.google.iam.v1.SetIamPolicyRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class SubscriptionAdminClientSetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientSetIamPolicy();
+   *   }
+   *
+   *   public static void subscriptionAdminClientSetIamPolicy() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       SetIamPolicyRequest request =
+   *           SetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setPolicy(Policy.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = subscriptionAdminClient.setIamPolicyCallable().futureCall(request);
+   *       // Do something.
+   *       Policy response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2353,13 +3477,30 @@ public final UnaryCallable setIamPolicyCallable() { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   Policy response = subscriptionAdminClient.getIamPolicy(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.iam.v1.GetIamPolicyRequest;
+   * import com.google.iam.v1.GetPolicyOptions;
+   * import com.google.iam.v1.Policy;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class SubscriptionAdminClientGetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientGetIamPolicy();
+   *   }
+   *
+   *   public static void subscriptionAdminClientGetIamPolicy() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       GetIamPolicyRequest request =
+   *           GetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setOptions(GetPolicyOptions.newBuilder().build())
+   *               .build();
+   *       Policy response = subscriptionAdminClient.getIamPolicy(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2378,15 +3519,33 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = subscriptionAdminClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   Policy response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.iam.v1.GetIamPolicyRequest;
+   * import com.google.iam.v1.GetPolicyOptions;
+   * import com.google.iam.v1.Policy;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class SubscriptionAdminClientGetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientGetIamPolicy();
+   *   }
+   *
+   *   public static void subscriptionAdminClientGetIamPolicy() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       GetIamPolicyRequest request =
+   *           GetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setOptions(GetPolicyOptions.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = subscriptionAdminClient.getIamPolicyCallable().futureCall(request);
+   *       // Do something.
+   *       Policy response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -2406,13 +3565,30 @@ public final UnaryCallable getIamPolicyCallable() { *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   TestIamPermissionsResponse response = subscriptionAdminClient.testIamPermissions(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.iam.v1.TestIamPermissionsRequest;
+   * import com.google.iam.v1.TestIamPermissionsResponse;
+   * import com.google.pubsub.v1.ProjectName;
+   * import java.util.ArrayList;
+   *
+   * public class SubscriptionAdminClientTestIamPermissions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientTestIamPermissions();
+   *   }
+   *
+   *   public static void subscriptionAdminClientTestIamPermissions() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       TestIamPermissionsRequest request =
+   *           TestIamPermissionsRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .addAllPermissions(new ArrayList())
+   *               .build();
+   *       TestIamPermissionsResponse response = subscriptionAdminClient.testIamPermissions(request);
+   *     }
+   *   }
    * }
    * }
* @@ -2435,16 +3611,34 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   ApiFuture future =
-   *       subscriptionAdminClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something.
-   *   TestIamPermissionsResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+   * import com.google.iam.v1.TestIamPermissionsRequest;
+   * import com.google.iam.v1.TestIamPermissionsResponse;
+   * import com.google.pubsub.v1.ProjectName;
+   * import java.util.ArrayList;
+   *
+   * public class SubscriptionAdminClientTestIamPermissions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     subscriptionAdminClientTestIamPermissions();
+   *   }
+   *
+   *   public static void subscriptionAdminClientTestIamPermissions() throws Exception {
+   *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *       TestIamPermissionsRequest request =
+   *           TestIamPermissionsRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .addAllPermissions(new ArrayList())
+   *               .build();
+   *       ApiFuture future =
+   *           subscriptionAdminClient.testIamPermissionsCallable().futureCall(request);
+   *       // Do something.
+   *       TestIamPermissionsResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java index d9680d778a..1019a260a4 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java @@ -83,18 +83,32 @@ *

For example, to set the total timeout of createSubscription to 30 seconds: * *

{@code
- * SubscriptionAdminSettings.Builder subscriptionAdminSettingsBuilder =
- *     SubscriptionAdminSettings.newBuilder();
- * subscriptionAdminSettingsBuilder
- *     .createSubscriptionSettings()
- *     .setRetrySettings(
- *         subscriptionAdminSettingsBuilder
- *             .createSubscriptionSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * SubscriptionAdminSettings subscriptionAdminSettings = subscriptionAdminSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.SubscriptionAdminSettings;
+ * import java.time.Duration;
+ *
+ * public class SubscriptionAdminSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     subscriptionAdminSettings();
+ *   }
+ *
+ *   public static void subscriptionAdminSettings() throws Exception {
+ *     SubscriptionAdminSettings.Builder subscriptionAdminSettingsBuilder =
+ *         SubscriptionAdminSettings.newBuilder();
+ *     subscriptionAdminSettingsBuilder
+ *         .createSubscriptionSettings()
+ *         .setRetrySettings(
+ *             subscriptionAdminSettingsBuilder
+ *                 .createSubscriptionSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     SubscriptionAdminSettings subscriptionAdminSettings = subscriptionAdminSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/TopicAdminClient.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/TopicAdminClient.java index be0a3a2e42..1fffddb7ff 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/TopicAdminClient.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/TopicAdminClient.java @@ -65,9 +65,24 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
- *   Topic response = topicAdminClient.createTopic(name);
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.TopicAdminClient;
+ * import com.google.pubsub.v1.Topic;
+ * import com.google.pubsub.v1.TopicName;
+ *
+ * public class TopicAdminClientCreateTopic {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     topicAdminClientCreateTopic();
+ *   }
+ *
+ *   public static void topicAdminClientCreateTopic() throws Exception {
+ *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ *       TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ *       Topic response = topicAdminClient.createTopic(name);
+ *     }
+ *   }
  * }
  * }
* @@ -100,19 +115,50 @@ *

To customize credentials: * *

{@code
- * TopicAdminSettings topicAdminSettings =
- *     TopicAdminSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.pubsub.v1.TopicAdminClient;
+ * import com.google.cloud.pubsub.v1.TopicAdminSettings;
+ * import com.google.cloud.pubsub.v1.myCredentials;
+ *
+ * public class TopicAdminClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     topicAdminClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void topicAdminClientSetCredentialsProvider() throws Exception {
+ *     TopicAdminSettings topicAdminSettings =
+ *         TopicAdminSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * TopicAdminSettings topicAdminSettings =
- *     TopicAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
- * TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.TopicAdminClient;
+ * import com.google.cloud.pubsub.v1.TopicAdminSettings;
+ * import com.google.cloud.pubsub.v1.myEndpoint;
+ *
+ * public class TopicAdminClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     topicAdminClientSetEndpoint();
+ *   }
+ *
+ *   public static void topicAdminClientSetEndpoint() throws Exception {
+ *     TopicAdminSettings topicAdminSettings =
+ *         TopicAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -176,9 +222,24 @@ public PublisherStub getStub() { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   Topic response = topicAdminClient.createTopic(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.Topic;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientCreateTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientCreateTopic();
+   *   }
+   *
+   *   public static void topicAdminClientCreateTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+   *       Topic response = topicAdminClient.createTopic(name);
+   *     }
+   *   }
    * }
    * }
* @@ -202,9 +263,24 @@ public final Topic createTopic(TopicName name) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   String name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
-   *   Topic response = topicAdminClient.createTopic(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.Topic;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientCreateTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientCreateTopic();
+   *   }
+   *
+   *   public static void topicAdminClientCreateTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       String name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *       Topic response = topicAdminClient.createTopic(name);
+   *     }
+   *   }
    * }
    * }
* @@ -228,18 +304,37 @@ public final Topic createTopic(String name) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   Topic request =
-   *       Topic.newBuilder()
-   *           .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .putAllLabels(new HashMap())
-   *           .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build())
-   *           .setKmsKeyName("kmsKeyName412586233")
-   *           .setSchemaSettings(SchemaSettings.newBuilder().build())
-   *           .setSatisfiesPzs(true)
-   *           .setMessageRetentionDuration(Duration.newBuilder().build())
-   *           .build();
-   *   Topic response = topicAdminClient.createTopic(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.protobuf.Duration;
+   * import com.google.pubsub.v1.MessageStoragePolicy;
+   * import com.google.pubsub.v1.SchemaSettings;
+   * import com.google.pubsub.v1.Topic;
+   * import com.google.pubsub.v1.TopicName;
+   * import java.util.HashMap;
+   *
+   * public class TopicAdminClientCreateTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientCreateTopic();
+   *   }
+   *
+   *   public static void topicAdminClientCreateTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       Topic request =
+   *           Topic.newBuilder()
+   *               .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .putAllLabels(new HashMap())
+   *               .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build())
+   *               .setKmsKeyName("kmsKeyName412586233")
+   *               .setSchemaSettings(SchemaSettings.newBuilder().build())
+   *               .setSatisfiesPzs(true)
+   *               .setMessageRetentionDuration(Duration.newBuilder().build())
+   *               .build();
+   *       Topic response = topicAdminClient.createTopic(request);
+   *     }
+   *   }
    * }
    * }
* @@ -258,20 +353,40 @@ public final Topic createTopic(Topic request) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   Topic request =
-   *       Topic.newBuilder()
-   *           .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .putAllLabels(new HashMap())
-   *           .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build())
-   *           .setKmsKeyName("kmsKeyName412586233")
-   *           .setSchemaSettings(SchemaSettings.newBuilder().build())
-   *           .setSatisfiesPzs(true)
-   *           .setMessageRetentionDuration(Duration.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = topicAdminClient.createTopicCallable().futureCall(request);
-   *   // Do something.
-   *   Topic response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.protobuf.Duration;
+   * import com.google.pubsub.v1.MessageStoragePolicy;
+   * import com.google.pubsub.v1.SchemaSettings;
+   * import com.google.pubsub.v1.Topic;
+   * import com.google.pubsub.v1.TopicName;
+   * import java.util.HashMap;
+   *
+   * public class TopicAdminClientCreateTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientCreateTopic();
+   *   }
+   *
+   *   public static void topicAdminClientCreateTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       Topic request =
+   *           Topic.newBuilder()
+   *               .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .putAllLabels(new HashMap())
+   *               .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build())
+   *               .setKmsKeyName("kmsKeyName412586233")
+   *               .setSchemaSettings(SchemaSettings.newBuilder().build())
+   *               .setSatisfiesPzs(true)
+   *               .setMessageRetentionDuration(Duration.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = topicAdminClient.createTopicCallable().futureCall(request);
+   *       // Do something.
+   *       Topic response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -286,13 +401,29 @@ public final UnaryCallable createTopicCallable() { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   UpdateTopicRequest request =
-   *       UpdateTopicRequest.newBuilder()
-   *           .setTopic(Topic.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   Topic response = topicAdminClient.updateTopic(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.protobuf.FieldMask;
+   * import com.google.pubsub.v1.Topic;
+   * import com.google.pubsub.v1.UpdateTopicRequest;
+   *
+   * public class TopicAdminClientUpdateTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientUpdateTopic();
+   *   }
+   *
+   *   public static void topicAdminClientUpdateTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       UpdateTopicRequest request =
+   *           UpdateTopicRequest.newBuilder()
+   *               .setTopic(Topic.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       Topic response = topicAdminClient.updateTopic(request);
+   *     }
+   *   }
    * }
    * }
* @@ -310,15 +441,32 @@ public final Topic updateTopic(UpdateTopicRequest request) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   UpdateTopicRequest request =
-   *       UpdateTopicRequest.newBuilder()
-   *           .setTopic(Topic.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = topicAdminClient.updateTopicCallable().futureCall(request);
-   *   // Do something.
-   *   Topic response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.protobuf.FieldMask;
+   * import com.google.pubsub.v1.Topic;
+   * import com.google.pubsub.v1.UpdateTopicRequest;
+   *
+   * public class TopicAdminClientUpdateTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientUpdateTopic();
+   *   }
+   *
+   *   public static void topicAdminClientUpdateTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       UpdateTopicRequest request =
+   *           UpdateTopicRequest.newBuilder()
+   *               .setTopic(Topic.newBuilder().build())
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = topicAdminClient.updateTopicCallable().futureCall(request);
+   *       // Do something.
+   *       Topic response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -333,10 +481,28 @@ public final UnaryCallable updateTopicCallable() { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   List messages = new ArrayList<>();
-   *   PublishResponse response = topicAdminClient.publish(topic, messages);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.PublishResponse;
+   * import com.google.pubsub.v1.PubsubMessage;
+   * import com.google.pubsub.v1.TopicName;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class TopicAdminClientPublish {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientPublish();
+   *   }
+   *
+   *   public static void topicAdminClientPublish() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+   *       List messages = new ArrayList<>();
+   *       PublishResponse response = topicAdminClient.publish(topic, messages);
+   *     }
+   *   }
    * }
    * }
* @@ -361,10 +527,28 @@ public final PublishResponse publish(TopicName topic, List messag *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
-   *   List messages = new ArrayList<>();
-   *   PublishResponse response = topicAdminClient.publish(topic, messages);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.PublishResponse;
+   * import com.google.pubsub.v1.PubsubMessage;
+   * import com.google.pubsub.v1.TopicName;
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class TopicAdminClientPublish {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientPublish();
+   *   }
+   *
+   *   public static void topicAdminClientPublish() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *       List messages = new ArrayList<>();
+   *       PublishResponse response = topicAdminClient.publish(topic, messages);
+   *     }
+   *   }
    * }
    * }
* @@ -386,13 +570,31 @@ public final PublishResponse publish(String topic, List messages) *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   PublishRequest request =
-   *       PublishRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .addAllMessages(new ArrayList())
-   *           .build();
-   *   PublishResponse response = topicAdminClient.publish(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.PublishRequest;
+   * import com.google.pubsub.v1.PublishResponse;
+   * import com.google.pubsub.v1.PubsubMessage;
+   * import com.google.pubsub.v1.TopicName;
+   * import java.util.ArrayList;
+   *
+   * public class TopicAdminClientPublish {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientPublish();
+   *   }
+   *
+   *   public static void topicAdminClientPublish() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       PublishRequest request =
+   *           PublishRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .addAllMessages(new ArrayList())
+   *               .build();
+   *       PublishResponse response = topicAdminClient.publish(request);
+   *     }
+   *   }
    * }
    * }
* @@ -410,15 +612,34 @@ public final PublishResponse publish(PublishRequest request) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   PublishRequest request =
-   *       PublishRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .addAllMessages(new ArrayList())
-   *           .build();
-   *   ApiFuture future = topicAdminClient.publishCallable().futureCall(request);
-   *   // Do something.
-   *   PublishResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.PublishRequest;
+   * import com.google.pubsub.v1.PublishResponse;
+   * import com.google.pubsub.v1.PubsubMessage;
+   * import com.google.pubsub.v1.TopicName;
+   * import java.util.ArrayList;
+   *
+   * public class TopicAdminClientPublish {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientPublish();
+   *   }
+   *
+   *   public static void topicAdminClientPublish() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       PublishRequest request =
+   *           PublishRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .addAllMessages(new ArrayList())
+   *               .build();
+   *       ApiFuture future = topicAdminClient.publishCallable().futureCall(request);
+   *       // Do something.
+   *       PublishResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -433,9 +654,24 @@ public final UnaryCallable publishCallable() { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   Topic response = topicAdminClient.getTopic(topic);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.Topic;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientGetTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientGetTopic();
+   *   }
+   *
+   *   public static void topicAdminClientGetTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+   *       Topic response = topicAdminClient.getTopic(topic);
+   *     }
+   *   }
    * }
    * }
* @@ -456,9 +692,24 @@ public final Topic getTopic(TopicName topic) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
-   *   Topic response = topicAdminClient.getTopic(topic);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.Topic;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientGetTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientGetTopic();
+   *   }
+   *
+   *   public static void topicAdminClientGetTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *       Topic response = topicAdminClient.getTopic(topic);
+   *     }
+   *   }
    * }
    * }
* @@ -478,12 +729,28 @@ public final Topic getTopic(String topic) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   GetTopicRequest request =
-   *       GetTopicRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .build();
-   *   Topic response = topicAdminClient.getTopic(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.GetTopicRequest;
+   * import com.google.pubsub.v1.Topic;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientGetTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientGetTopic();
+   *   }
+   *
+   *   public static void topicAdminClientGetTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       GetTopicRequest request =
+   *           GetTopicRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .build();
+   *       Topic response = topicAdminClient.getTopic(request);
+   *     }
+   *   }
    * }
    * }
* @@ -501,14 +768,31 @@ public final Topic getTopic(GetTopicRequest request) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   GetTopicRequest request =
-   *       GetTopicRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .build();
-   *   ApiFuture future = topicAdminClient.getTopicCallable().futureCall(request);
-   *   // Do something.
-   *   Topic response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.GetTopicRequest;
+   * import com.google.pubsub.v1.Topic;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientGetTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientGetTopic();
+   *   }
+   *
+   *   public static void topicAdminClientGetTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       GetTopicRequest request =
+   *           GetTopicRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .build();
+   *       ApiFuture future = topicAdminClient.getTopicCallable().futureCall(request);
+   *       // Do something.
+   *       Topic response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -523,10 +807,25 @@ public final UnaryCallable getTopicCallable() { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   for (Topic element : topicAdminClient.listTopics(project).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Topic;
+   *
+   * public class TopicAdminClientListTopics {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopics();
+   *   }
+   *
+   *   public static void topicAdminClientListTopics() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       ProjectName project = ProjectName.of("[PROJECT]");
+   *       for (Topic element : topicAdminClient.listTopics(project).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -550,10 +849,25 @@ public final ListTopicsPagedResponse listTopics(ProjectName project) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   String project = ProjectName.of("[PROJECT]").toString();
-   *   for (Topic element : topicAdminClient.listTopics(project).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Topic;
+   *
+   * public class TopicAdminClientListTopics {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopics();
+   *   }
+   *
+   *   public static void topicAdminClientListTopics() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       String project = ProjectName.of("[PROJECT]").toString();
+   *       for (Topic element : topicAdminClient.listTopics(project).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -574,15 +888,31 @@ public final ListTopicsPagedResponse listTopics(String project) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ListTopicsRequest request =
-   *       ListTopicsRequest.newBuilder()
-   *           .setProject(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Topic element : topicAdminClient.listTopics(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.ListTopicsRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Topic;
+   *
+   * public class TopicAdminClientListTopics {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopics();
+   *   }
+   *
+   *   public static void topicAdminClientListTopics() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       ListTopicsRequest request =
+   *           ListTopicsRequest.newBuilder()
+   *               .setProject(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (Topic element : topicAdminClient.listTopics(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -601,17 +931,34 @@ public final ListTopicsPagedResponse listTopics(ListTopicsRequest request) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ListTopicsRequest request =
-   *       ListTopicsRequest.newBuilder()
-   *           .setProject(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = topicAdminClient.listTopicsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Topic element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.ListTopicsRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Topic;
+   *
+   * public class TopicAdminClientListTopics {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopics();
+   *   }
+   *
+   *   public static void topicAdminClientListTopics() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       ListTopicsRequest request =
+   *           ListTopicsRequest.newBuilder()
+   *               .setProject(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future = topicAdminClient.listTopicsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Topic element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -627,23 +974,41 @@ public final UnaryCallable listTopic *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ListTopicsRequest request =
-   *       ListTopicsRequest.newBuilder()
-   *           .setProject(ProjectName.of("[PROJECT]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListTopicsResponse response = topicAdminClient.listTopicsCallable().call(request);
-   *     for (Topic element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.common.base.Strings;
+   * import com.google.pubsub.v1.ListTopicsRequest;
+   * import com.google.pubsub.v1.ListTopicsResponse;
+   * import com.google.pubsub.v1.ProjectName;
+   * import com.google.pubsub.v1.Topic;
+   *
+   * public class TopicAdminClientListTopics {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopics();
+   *   }
+   *
+   *   public static void topicAdminClientListTopics() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       ListTopicsRequest request =
+   *           ListTopicsRequest.newBuilder()
+   *               .setProject(ProjectName.of("[PROJECT]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListTopicsResponse response = topicAdminClient.listTopicsCallable().call(request);
+   *         for (Topic element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -660,10 +1025,24 @@ public final UnaryCallable listTopicsCall
    * 

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   for (String element : topicAdminClient.listTopicSubscriptions(topic).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientListTopicSubscriptions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopicSubscriptions();
+   *   }
+   *
+   *   public static void topicAdminClientListTopicSubscriptions() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+   *       for (String element : topicAdminClient.listTopicSubscriptions(topic).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -687,10 +1066,24 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(TopicNam *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
-   *   for (String element : topicAdminClient.listTopicSubscriptions(topic).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientListTopicSubscriptions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopicSubscriptions();
+   *   }
+   *
+   *   public static void topicAdminClientListTopicSubscriptions() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *       for (String element : topicAdminClient.listTopicSubscriptions(topic).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -712,15 +1105,30 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(String t *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ListTopicSubscriptionsRequest request =
-   *       ListTopicSubscriptionsRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (String element : topicAdminClient.listTopicSubscriptions(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientListTopicSubscriptions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopicSubscriptions();
+   *   }
+   *
+   *   public static void topicAdminClientListTopicSubscriptions() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       ListTopicSubscriptionsRequest request =
+   *           ListTopicSubscriptionsRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (String element : topicAdminClient.listTopicSubscriptions(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -740,18 +1148,34 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions( *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ListTopicSubscriptionsRequest request =
-   *       ListTopicSubscriptionsRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future =
-   *       topicAdminClient.listTopicSubscriptionsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (String element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientListTopicSubscriptions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopicSubscriptions();
+   *   }
+   *
+   *   public static void topicAdminClientListTopicSubscriptions() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       ListTopicSubscriptionsRequest request =
+   *           ListTopicSubscriptionsRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future =
+   *           topicAdminClient.listTopicSubscriptionsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (String element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -768,24 +1192,41 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions( *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ListTopicSubscriptionsRequest request =
-   *       ListTopicSubscriptionsRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListTopicSubscriptionsResponse response =
-   *         topicAdminClient.listTopicSubscriptionsCallable().call(request);
-   *     for (String element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.common.base.Strings;
+   * import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
+   * import com.google.pubsub.v1.ListTopicSubscriptionsResponse;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientListTopicSubscriptions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopicSubscriptions();
+   *   }
+   *
+   *   public static void topicAdminClientListTopicSubscriptions() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       ListTopicSubscriptionsRequest request =
+   *           ListTopicSubscriptionsRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListTopicSubscriptionsResponse response =
+   *             topicAdminClient.listTopicSubscriptionsCallable().call(request);
+   *         for (String element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -806,10 +1247,24 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
    * 

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   for (String element : topicAdminClient.listTopicSnapshots(topic).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientListTopicSnapshots {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopicSnapshots();
+   *   }
+   *
+   *   public static void topicAdminClientListTopicSnapshots() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+   *       for (String element : topicAdminClient.listTopicSnapshots(topic).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -836,10 +1291,24 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(TopicName topic) *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
-   *   for (String element : topicAdminClient.listTopicSnapshots(topic).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientListTopicSnapshots {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopicSnapshots();
+   *   }
+   *
+   *   public static void topicAdminClientListTopicSnapshots() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *       for (String element : topicAdminClient.listTopicSnapshots(topic).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -864,15 +1333,30 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(String topic) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ListTopicSnapshotsRequest request =
-   *       ListTopicSnapshotsRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (String element : topicAdminClient.listTopicSnapshots(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.ListTopicSnapshotsRequest;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientListTopicSnapshots {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopicSnapshots();
+   *   }
+   *
+   *   public static void topicAdminClientListTopicSnapshots() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       ListTopicSnapshotsRequest request =
+   *           ListTopicSnapshotsRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (String element : topicAdminClient.listTopicSnapshots(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -895,18 +1379,34 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots( *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ListTopicSnapshotsRequest request =
-   *       ListTopicSnapshotsRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future =
-   *       topicAdminClient.listTopicSnapshotsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (String element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.ListTopicSnapshotsRequest;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientListTopicSnapshots {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopicSnapshots();
+   *   }
+   *
+   *   public static void topicAdminClientListTopicSnapshots() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       ListTopicSnapshotsRequest request =
+   *           ListTopicSnapshotsRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future =
+   *           topicAdminClient.listTopicSnapshotsPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (String element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -926,24 +1426,41 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots( *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ListTopicSnapshotsRequest request =
-   *       ListTopicSnapshotsRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListTopicSnapshotsResponse response =
-   *         topicAdminClient.listTopicSnapshotsCallable().call(request);
-   *     for (String element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.common.base.Strings;
+   * import com.google.pubsub.v1.ListTopicSnapshotsRequest;
+   * import com.google.pubsub.v1.ListTopicSnapshotsResponse;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientListTopicSnapshots {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientListTopicSnapshots();
+   *   }
+   *
+   *   public static void topicAdminClientListTopicSnapshots() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       ListTopicSnapshotsRequest request =
+   *           ListTopicSnapshotsRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListTopicSnapshotsResponse response =
+   *             topicAdminClient.listTopicSnapshotsCallable().call(request);
+   *         for (String element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -964,9 +1481,24 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(
    * 

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   topicAdminClient.deleteTopic(topic);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientDeleteTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientDeleteTopic();
+   *   }
+   *
+   *   public static void topicAdminClientDeleteTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+   *       topicAdminClient.deleteTopic(topic);
+   *     }
+   *   }
    * }
    * }
* @@ -990,9 +1522,24 @@ public final void deleteTopic(TopicName topic) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
-   *   topicAdminClient.deleteTopic(topic);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientDeleteTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientDeleteTopic();
+   *   }
+   *
+   *   public static void topicAdminClientDeleteTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *       topicAdminClient.deleteTopic(topic);
+   *     }
+   *   }
    * }
    * }
* @@ -1015,12 +1562,28 @@ public final void deleteTopic(String topic) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   DeleteTopicRequest request =
-   *       DeleteTopicRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .build();
-   *   topicAdminClient.deleteTopic(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.DeleteTopicRequest;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientDeleteTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientDeleteTopic();
+   *   }
+   *
+   *   public static void topicAdminClientDeleteTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       DeleteTopicRequest request =
+   *           DeleteTopicRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .build();
+   *       topicAdminClient.deleteTopic(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1041,14 +1604,31 @@ public final void deleteTopic(DeleteTopicRequest request) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   DeleteTopicRequest request =
-   *       DeleteTopicRequest.newBuilder()
-   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
-   *           .build();
-   *   ApiFuture future = topicAdminClient.deleteTopicCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.protobuf.Empty;
+   * import com.google.pubsub.v1.DeleteTopicRequest;
+   * import com.google.pubsub.v1.TopicName;
+   *
+   * public class TopicAdminClientDeleteTopic {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientDeleteTopic();
+   *   }
+   *
+   *   public static void topicAdminClientDeleteTopic() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       DeleteTopicRequest request =
+   *           DeleteTopicRequest.newBuilder()
+   *               .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *               .build();
+   *       ApiFuture future = topicAdminClient.deleteTopicCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1065,12 +1645,28 @@ public final UnaryCallable deleteTopicCallable() { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   DetachSubscriptionRequest request =
-   *       DetachSubscriptionRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .build();
-   *   DetachSubscriptionResponse response = topicAdminClient.detachSubscription(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.DetachSubscriptionRequest;
+   * import com.google.pubsub.v1.DetachSubscriptionResponse;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class TopicAdminClientDetachSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientDetachSubscription();
+   *   }
+   *
+   *   public static void topicAdminClientDetachSubscription() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       DetachSubscriptionRequest request =
+   *           DetachSubscriptionRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .build();
+   *       DetachSubscriptionResponse response = topicAdminClient.detachSubscription(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1090,15 +1686,32 @@ public final DetachSubscriptionResponse detachSubscription(DetachSubscriptionReq *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   DetachSubscriptionRequest request =
-   *       DetachSubscriptionRequest.newBuilder()
-   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
-   *           .build();
-   *   ApiFuture future =
-   *       topicAdminClient.detachSubscriptionCallable().futureCall(request);
-   *   // Do something.
-   *   DetachSubscriptionResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.pubsub.v1.DetachSubscriptionRequest;
+   * import com.google.pubsub.v1.DetachSubscriptionResponse;
+   * import com.google.pubsub.v1.SubscriptionName;
+   *
+   * public class TopicAdminClientDetachSubscription {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientDetachSubscription();
+   *   }
+   *
+   *   public static void topicAdminClientDetachSubscription() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       DetachSubscriptionRequest request =
+   *           DetachSubscriptionRequest.newBuilder()
+   *               .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *               .build();
+   *       ApiFuture future =
+   *           topicAdminClient.detachSubscriptionCallable().futureCall(request);
+   *       // Do something.
+   *       DetachSubscriptionResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1116,13 +1729,29 @@ public final DetachSubscriptionResponse detachSubscription(DetachSubscriptionReq *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   SetIamPolicyRequest request =
-   *       SetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setPolicy(Policy.newBuilder().build())
-   *           .build();
-   *   Policy response = topicAdminClient.setIamPolicy(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.iam.v1.Policy;
+   * import com.google.iam.v1.SetIamPolicyRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class TopicAdminClientSetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientSetIamPolicy();
+   *   }
+   *
+   *   public static void topicAdminClientSetIamPolicy() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       SetIamPolicyRequest request =
+   *           SetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setPolicy(Policy.newBuilder().build())
+   *               .build();
+   *       Policy response = topicAdminClient.setIamPolicy(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1142,15 +1771,32 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   SetIamPolicyRequest request =
-   *       SetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setPolicy(Policy.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = topicAdminClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   Policy response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.iam.v1.Policy;
+   * import com.google.iam.v1.SetIamPolicyRequest;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class TopicAdminClientSetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientSetIamPolicy();
+   *   }
+   *
+   *   public static void topicAdminClientSetIamPolicy() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       SetIamPolicyRequest request =
+   *           SetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setPolicy(Policy.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = topicAdminClient.setIamPolicyCallable().futureCall(request);
+   *       // Do something.
+   *       Policy response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1166,13 +1812,30 @@ public final UnaryCallable setIamPolicyCallable() { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   Policy response = topicAdminClient.getIamPolicy(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.iam.v1.GetIamPolicyRequest;
+   * import com.google.iam.v1.GetPolicyOptions;
+   * import com.google.iam.v1.Policy;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class TopicAdminClientGetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientGetIamPolicy();
+   *   }
+   *
+   *   public static void topicAdminClientGetIamPolicy() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       GetIamPolicyRequest request =
+   *           GetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setOptions(GetPolicyOptions.newBuilder().build())
+   *               .build();
+   *       Policy response = topicAdminClient.getIamPolicy(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1191,15 +1854,33 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = topicAdminClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   Policy response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.iam.v1.GetIamPolicyRequest;
+   * import com.google.iam.v1.GetPolicyOptions;
+   * import com.google.iam.v1.Policy;
+   * import com.google.pubsub.v1.ProjectName;
+   *
+   * public class TopicAdminClientGetIamPolicy {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientGetIamPolicy();
+   *   }
+   *
+   *   public static void topicAdminClientGetIamPolicy() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       GetIamPolicyRequest request =
+   *           GetIamPolicyRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .setOptions(GetPolicyOptions.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = topicAdminClient.getIamPolicyCallable().futureCall(request);
+   *       // Do something.
+   *       Policy response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1219,13 +1900,30 @@ public final UnaryCallable getIamPolicyCallable() { *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   TestIamPermissionsResponse response = topicAdminClient.testIamPermissions(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.iam.v1.TestIamPermissionsRequest;
+   * import com.google.iam.v1.TestIamPermissionsResponse;
+   * import com.google.pubsub.v1.ProjectName;
+   * import java.util.ArrayList;
+   *
+   * public class TopicAdminClientTestIamPermissions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientTestIamPermissions();
+   *   }
+   *
+   *   public static void topicAdminClientTestIamPermissions() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       TestIamPermissionsRequest request =
+   *           TestIamPermissionsRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .addAllPermissions(new ArrayList())
+   *               .build();
+   *       TestIamPermissionsResponse response = topicAdminClient.testIamPermissions(request);
+   *     }
+   *   }
    * }
    * }
* @@ -1248,16 +1946,34 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq *

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource(ProjectName.of("[PROJECT]").toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   ApiFuture future =
-   *       topicAdminClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something.
-   *   TestIamPermissionsResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
+   * import com.google.iam.v1.TestIamPermissionsRequest;
+   * import com.google.iam.v1.TestIamPermissionsResponse;
+   * import com.google.pubsub.v1.ProjectName;
+   * import java.util.ArrayList;
+   *
+   * public class TopicAdminClientTestIamPermissions {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     topicAdminClientTestIamPermissions();
+   *   }
+   *
+   *   public static void topicAdminClientTestIamPermissions() throws Exception {
+   *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *       TestIamPermissionsRequest request =
+   *           TestIamPermissionsRequest.newBuilder()
+   *               .setResource(ProjectName.of("[PROJECT]").toString())
+   *               .addAllPermissions(new ArrayList())
+   *               .build();
+   *       ApiFuture future =
+   *           topicAdminClient.testIamPermissionsCallable().futureCall(request);
+   *       // Do something.
+   *       TestIamPermissionsResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/TopicAdminSettings.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/TopicAdminSettings.java index e17e7237eb..080669d903 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/TopicAdminSettings.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/TopicAdminSettings.java @@ -76,17 +76,31 @@ *

For example, to set the total timeout of createTopic to 30 seconds: * *

{@code
- * TopicAdminSettings.Builder topicAdminSettingsBuilder = TopicAdminSettings.newBuilder();
- * topicAdminSettingsBuilder
- *     .createTopicSettings()
- *     .setRetrySettings(
- *         topicAdminSettingsBuilder
- *             .createTopicSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * TopicAdminSettings topicAdminSettings = topicAdminSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.TopicAdminSettings;
+ * import java.time.Duration;
+ *
+ * public class TopicAdminSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     topicAdminSettings();
+ *   }
+ *
+ *   public static void topicAdminSettings() throws Exception {
+ *     TopicAdminSettings.Builder topicAdminSettingsBuilder = TopicAdminSettings.newBuilder();
+ *     topicAdminSettingsBuilder
+ *         .createTopicSettings()
+ *         .setRetrySettings(
+ *             topicAdminSettingsBuilder
+ *                 .createTopicSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     TopicAdminSettings topicAdminSettings = topicAdminSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/package-info.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/package-info.java index 128d542475..1731effee3 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/package-info.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/package-info.java @@ -27,9 +27,24 @@ *

Sample for TopicAdminClient: * *

{@code
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
- *   Topic response = topicAdminClient.createTopic(name);
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.TopicAdminClient;
+ * import com.google.pubsub.v1.Topic;
+ * import com.google.pubsub.v1.TopicName;
+ *
+ * public class TopicAdminClientCreateTopic {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     topicAdminClientCreateTopic();
+ *   }
+ *
+ *   public static void topicAdminClientCreateTopic() throws Exception {
+ *     try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ *       TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ *       Topic response = topicAdminClient.createTopic(name);
+ *     }
+ *   }
  * }
  * }
* @@ -42,13 +57,30 @@ *

Sample for SubscriptionAdminClient: * *

{@code
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
- *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
- *   PushConfig pushConfig = PushConfig.newBuilder().build();
- *   int ackDeadlineSeconds = 2135351438;
- *   Subscription response =
- *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
+ * import com.google.pubsub.v1.PushConfig;
+ * import com.google.pubsub.v1.Subscription;
+ * import com.google.pubsub.v1.SubscriptionName;
+ * import com.google.pubsub.v1.TopicName;
+ *
+ * public class SubscriptionAdminClientCreateSubscription {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     subscriptionAdminClientCreateSubscription();
+ *   }
+ *
+ *   public static void subscriptionAdminClientCreateSubscription() throws Exception {
+ *     try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ *       SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ *       TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ *       PushConfig pushConfig = PushConfig.newBuilder().build();
+ *       int ackDeadlineSeconds = 2135351438;
+ *       Subscription response =
+ *           subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ *     }
+ *   }
  * }
  * }
* @@ -59,11 +91,26 @@ *

Sample for SchemaServiceClient: * *

{@code
- * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
- *   ProjectName parent = ProjectName.of("[PROJECT]");
- *   Schema schema = Schema.newBuilder().build();
- *   String schemaId = "schemaId-697673060";
- *   Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.SchemaServiceClient;
+ * import com.google.pubsub.v1.ProjectName;
+ * import com.google.pubsub.v1.Schema;
+ *
+ * public class SchemaServiceClientCreateSchema {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     schemaServiceClientCreateSchema();
+ *   }
+ *
+ *   public static void schemaServiceClientCreateSchema() throws Exception {
+ *     try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+ *       ProjectName parent = ProjectName.of("[PROJECT]");
+ *       Schema schema = Schema.newBuilder().build();
+ *       String schemaId = "schemaId-697673060";
+ *       Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
+ *     }
+ *   }
  * }
  * }
*/ diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java index 166775ec3c..25f5424d56 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java @@ -99,17 +99,31 @@ *

For example, to set the total timeout of createTopic to 30 seconds: * *

{@code
- * PublisherStubSettings.Builder topicAdminSettingsBuilder = PublisherStubSettings.newBuilder();
- * topicAdminSettingsBuilder
- *     .createTopicSettings()
- *     .setRetrySettings(
- *         topicAdminSettingsBuilder
- *             .createTopicSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * PublisherStubSettings topicAdminSettings = topicAdminSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.stub.PublisherStubSettings;
+ * import java.time.Duration;
+ *
+ * public class TopicAdminSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     topicAdminSettings();
+ *   }
+ *
+ *   public static void topicAdminSettings() throws Exception {
+ *     PublisherStubSettings.Builder topicAdminSettingsBuilder = PublisherStubSettings.newBuilder();
+ *     topicAdminSettingsBuilder
+ *         .createTopicSettings()
+ *         .setRetrySettings(
+ *             topicAdminSettingsBuilder
+ *                 .createTopicSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     PublisherStubSettings topicAdminSettings = topicAdminSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java index fb8a87653d..1b3f642fca 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java @@ -82,18 +82,32 @@ *

For example, to set the total timeout of createSchema to 30 seconds: * *

{@code
- * SchemaServiceStubSettings.Builder schemaServiceSettingsBuilder =
- *     SchemaServiceStubSettings.newBuilder();
- * schemaServiceSettingsBuilder
- *     .createSchemaSettings()
- *     .setRetrySettings(
- *         schemaServiceSettingsBuilder
- *             .createSchemaSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * SchemaServiceStubSettings schemaServiceSettings = schemaServiceSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.stub.SchemaServiceStubSettings;
+ * import java.time.Duration;
+ *
+ * public class SchemaServiceSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     schemaServiceSettings();
+ *   }
+ *
+ *   public static void schemaServiceSettings() throws Exception {
+ *     SchemaServiceStubSettings.Builder schemaServiceSettingsBuilder =
+ *         SchemaServiceStubSettings.newBuilder();
+ *     schemaServiceSettingsBuilder
+ *         .createSchemaSettings()
+ *         .setRetrySettings(
+ *             schemaServiceSettingsBuilder
+ *                 .createSchemaSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     SchemaServiceStubSettings schemaServiceSettings = schemaServiceSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java index 567da1624b..e2dec30abc 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java @@ -97,18 +97,32 @@ *

For example, to set the total timeout of createSubscription to 30 seconds: * *

{@code
- * SubscriberStubSettings.Builder subscriptionAdminSettingsBuilder =
- *     SubscriberStubSettings.newBuilder();
- * subscriptionAdminSettingsBuilder
- *     .createSubscriptionSettings()
- *     .setRetrySettings(
- *         subscriptionAdminSettingsBuilder
- *             .createSubscriptionSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * SubscriberStubSettings subscriptionAdminSettings = subscriptionAdminSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.pubsub.v1.stub.SubscriberStubSettings;
+ * import java.time.Duration;
+ *
+ * public class SubscriptionAdminSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     subscriptionAdminSettings();
+ *   }
+ *
+ *   public static void subscriptionAdminSettings() throws Exception {
+ *     SubscriberStubSettings.Builder subscriptionAdminSettingsBuilder =
+ *         SubscriberStubSettings.newBuilder();
+ *     subscriptionAdminSettingsBuilder
+ *         .createSubscriptionSettings()
+ *         .setRetrySettings(
+ *             subscriptionAdminSettingsBuilder
+ *                 .createSubscriptionSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     SubscriberStubSettings subscriptionAdminSettings = subscriptionAdminSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/CloudRedisClient.java b/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/CloudRedisClient.java index fe918026ed..23cd4a4353 100644 --- a/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/CloudRedisClient.java +++ b/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/CloudRedisClient.java @@ -67,9 +67,24 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- *   Instance response = cloudRedisClient.getInstance(name);
+ * package com.google.example;
+ *
+ * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+ * import com.google.cloud.redis.v1beta1.Instance;
+ * import com.google.cloud.redis.v1beta1.InstanceName;
+ *
+ * public class CloudRedisClientGetInstance {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     cloudRedisClientGetInstance();
+ *   }
+ *
+ *   public static void cloudRedisClientGetInstance() throws Exception {
+ *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+ *       InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ *       Instance response = cloudRedisClient.getInstance(name);
+ *     }
+ *   }
  * }
  * }
* @@ -102,19 +117,50 @@ *

To customize credentials: * *

{@code
- * CloudRedisSettings cloudRedisSettings =
- *     CloudRedisSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+ * import com.google.cloud.redis.v1beta1.CloudRedisSettings;
+ * import com.google.cloud.redis.v1beta1.myCredentials;
+ *
+ * public class CloudRedisClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     cloudRedisClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void cloudRedisClientSetCredentialsProvider() throws Exception {
+ *     CloudRedisSettings cloudRedisSettings =
+ *         CloudRedisSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * CloudRedisSettings cloudRedisSettings =
- *     CloudRedisSettings.newBuilder().setEndpoint(myEndpoint).build();
- * CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
+ * package com.google.example;
+ *
+ * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+ * import com.google.cloud.redis.v1beta1.CloudRedisSettings;
+ * import com.google.cloud.redis.v1beta1.myEndpoint;
+ *
+ * public class CloudRedisClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     cloudRedisClientSetEndpoint();
+ *   }
+ *
+ *   public static void cloudRedisClientSetEndpoint() throws Exception {
+ *     CloudRedisSettings cloudRedisSettings =
+ *         CloudRedisSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -199,10 +245,25 @@ public final OperationsClient getOperationsClient() { *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.LocationName;
+   *
+   * public class CloudRedisClientListInstances {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientListInstances();
+   *   }
+   *
+   *   public static void cloudRedisClientListInstances() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *       for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -236,10 +297,25 @@ public final ListInstancesPagedResponse listInstances(LocationName parent) { *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
-   *   for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.LocationName;
+   *
+   * public class CloudRedisClientListInstances {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientListInstances();
+   *   }
+   *
+   *   public static void cloudRedisClientListInstances() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *       for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -270,15 +346,31 @@ public final ListInstancesPagedResponse listInstances(String parent) { *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   ListInstancesRequest request =
-   *       ListInstancesRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Instance element : cloudRedisClient.listInstances(request).iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.ListInstancesRequest;
+   * import com.google.cloud.redis.v1beta1.LocationName;
+   *
+   * public class CloudRedisClientListInstances {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientListInstances();
+   *   }
+   *
+   *   public static void cloudRedisClientListInstances() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       ListInstancesRequest request =
+   *           ListInstancesRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       for (Instance element : cloudRedisClient.listInstances(request).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -307,18 +399,35 @@ public final ListInstancesPagedResponse listInstances(ListInstancesRequest reque *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   ListInstancesRequest request =
-   *       ListInstancesRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future =
-   *       cloudRedisClient.listInstancesPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Instance element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.ListInstancesRequest;
+   * import com.google.cloud.redis.v1beta1.LocationName;
+   *
+   * public class CloudRedisClientListInstances {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientListInstances();
+   *   }
+   *
+   *   public static void cloudRedisClientListInstances() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       ListInstancesRequest request =
+   *           ListInstancesRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       ApiFuture future =
+   *           cloudRedisClient.listInstancesPagedCallable().futureCall(request);
+   *       // Do something.
+   *       for (Instance element : future.get().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -345,23 +454,41 @@ public final ListInstancesPagedResponse listInstances(ListInstancesRequest reque *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   ListInstancesRequest request =
-   *       ListInstancesRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListInstancesResponse response = cloudRedisClient.listInstancesCallable().call(request);
-   *     for (Instance element : response.getResponsesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.ListInstancesRequest;
+   * import com.google.cloud.redis.v1beta1.ListInstancesResponse;
+   * import com.google.cloud.redis.v1beta1.LocationName;
+   * import com.google.common.base.Strings;
+   *
+   * public class CloudRedisClientListInstances {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientListInstances();
+   *   }
+   *
+   *   public static void cloudRedisClientListInstances() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       ListInstancesRequest request =
+   *           ListInstancesRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setPageSize(883849137)
+   *               .setPageToken("pageToken873572522")
+   *               .build();
+   *       while (true) {
+   *         ListInstancesResponse response = cloudRedisClient.listInstancesCallable().call(request);
+   *         for (Instance element : response.getResponsesList()) {
+   *           // doThingsWith(element);
+   *         }
+   *         String nextPageToken = response.getNextPageToken();
+   *         if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *           request = request.toBuilder().setPageToken(nextPageToken).build();
+   *         } else {
+   *           break;
+   *         }
+   *       }
    *     }
    *   }
    * }
@@ -378,9 +505,24 @@ public final UnaryCallable listInst
    * 

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
-   *   Instance response = cloudRedisClient.getInstance(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   *
+   * public class CloudRedisClientGetInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientGetInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientGetInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+   *       Instance response = cloudRedisClient.getInstance(name);
+   *     }
+   *   }
    * }
    * }
* @@ -402,9 +544,24 @@ public final Instance getInstance(InstanceName name) { *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
-   *   Instance response = cloudRedisClient.getInstance(name);
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   *
+   * public class CloudRedisClientGetInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientGetInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientGetInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
+   *       Instance response = cloudRedisClient.getInstance(name);
+   *     }
+   *   }
    * }
    * }
* @@ -425,12 +582,28 @@ public final Instance getInstance(String name) { *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   GetInstanceRequest request =
-   *       GetInstanceRequest.newBuilder()
-   *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
-   *           .build();
-   *   Instance response = cloudRedisClient.getInstance(request);
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.GetInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   *
+   * public class CloudRedisClientGetInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientGetInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientGetInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       GetInstanceRequest request =
+   *           GetInstanceRequest.newBuilder()
+   *               .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
+   *               .build();
+   *       Instance response = cloudRedisClient.getInstance(request);
+   *     }
+   *   }
    * }
    * }
* @@ -448,14 +621,31 @@ public final Instance getInstance(GetInstanceRequest request) { *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   GetInstanceRequest request =
-   *       GetInstanceRequest.newBuilder()
-   *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
-   *           .build();
-   *   ApiFuture future = cloudRedisClient.getInstanceCallable().futureCall(request);
-   *   // Do something.
-   *   Instance response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.GetInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   *
+   * public class CloudRedisClientGetInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientGetInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientGetInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       GetInstanceRequest request =
+   *           GetInstanceRequest.newBuilder()
+   *               .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
+   *               .build();
+   *       ApiFuture future = cloudRedisClient.getInstanceCallable().futureCall(request);
+   *       // Do something.
+   *       Instance response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -481,11 +671,26 @@ public final UnaryCallable getInstanceCallable() { *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   String instanceId = "instanceId902024336";
-   *   Instance instance = Instance.newBuilder().build();
-   *   Instance response = cloudRedisClient.createInstanceAsync(parent, instanceId, instance).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.LocationName;
+   *
+   * public class CloudRedisClientCreateInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientCreateInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientCreateInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *       String instanceId = "instanceId902024336";
+   *       Instance instance = Instance.newBuilder().build();
+   *       Instance response = cloudRedisClient.createInstanceAsync(parent, instanceId, instance).get();
+   *     }
+   *   }
    * }
    * }
* @@ -533,11 +738,26 @@ public final OperationFuture createInstanceAsync( *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
-   *   String instanceId = "instanceId902024336";
-   *   Instance instance = Instance.newBuilder().build();
-   *   Instance response = cloudRedisClient.createInstanceAsync(parent, instanceId, instance).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.LocationName;
+   *
+   * public class CloudRedisClientCreateInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientCreateInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientCreateInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *       String instanceId = "instanceId902024336";
+   *       Instance instance = Instance.newBuilder().build();
+   *       Instance response = cloudRedisClient.createInstanceAsync(parent, instanceId, instance).get();
+   *     }
+   *   }
    * }
    * }
* @@ -585,14 +805,30 @@ public final OperationFuture createInstanceAsync( *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   CreateInstanceRequest request =
-   *       CreateInstanceRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setInstanceId("instanceId902024336")
-   *           .setInstance(Instance.newBuilder().build())
-   *           .build();
-   *   Instance response = cloudRedisClient.createInstanceAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.CreateInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.LocationName;
+   *
+   * public class CloudRedisClientCreateInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientCreateInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientCreateInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       CreateInstanceRequest request =
+   *           CreateInstanceRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setInstanceId("instanceId902024336")
+   *               .setInstance(Instance.newBuilder().build())
+   *               .build();
+   *       Instance response = cloudRedisClient.createInstanceAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -621,17 +857,35 @@ public final OperationFuture createInstanceAsync(CreateInstanceRe *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   CreateInstanceRequest request =
-   *       CreateInstanceRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setInstanceId("instanceId902024336")
-   *           .setInstance(Instance.newBuilder().build())
-   *           .build();
-   *   OperationFuture future =
-   *       cloudRedisClient.createInstanceOperationCallable().futureCall(request);
-   *   // Do something.
-   *   Instance response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.CreateInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.LocationName;
+   * import com.google.protobuf.Any;
+   *
+   * public class CloudRedisClientCreateInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientCreateInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientCreateInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       CreateInstanceRequest request =
+   *           CreateInstanceRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setInstanceId("instanceId902024336")
+   *               .setInstance(Instance.newBuilder().build())
+   *               .build();
+   *       OperationFuture future =
+   *           cloudRedisClient.createInstanceOperationCallable().futureCall(request);
+   *       // Do something.
+   *       Instance response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -658,16 +912,34 @@ public final OperationFuture createInstanceAsync(CreateInstanceRe *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   CreateInstanceRequest request =
-   *       CreateInstanceRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setInstanceId("instanceId902024336")
-   *           .setInstance(Instance.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = cloudRedisClient.createInstanceCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.CreateInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.LocationName;
+   * import com.google.longrunning.Operation;
+   *
+   * public class CloudRedisClientCreateInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientCreateInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientCreateInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       CreateInstanceRequest request =
+   *           CreateInstanceRequest.newBuilder()
+   *               .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *               .setInstanceId("instanceId902024336")
+   *               .setInstance(Instance.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = cloudRedisClient.createInstanceCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -686,10 +958,25 @@ public final UnaryCallable createInstanceCalla *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Instance instance = Instance.newBuilder().build();
-   *   Instance response = cloudRedisClient.updateInstanceAsync(updateMask, instance).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class CloudRedisClientUpdateInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientUpdateInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientUpdateInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       FieldMask updateMask = FieldMask.newBuilder().build();
+   *       Instance instance = Instance.newBuilder().build();
+   *       Instance response = cloudRedisClient.updateInstanceAsync(updateMask, instance).get();
+   *     }
+   *   }
    * }
    * }
* @@ -718,13 +1005,29 @@ public final OperationFuture updateInstanceAsync( *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   UpdateInstanceRequest request =
-   *       UpdateInstanceRequest.newBuilder()
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .setInstance(Instance.newBuilder().build())
-   *           .build();
-   *   Instance response = cloudRedisClient.updateInstanceAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.UpdateInstanceRequest;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class CloudRedisClientUpdateInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientUpdateInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientUpdateInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       UpdateInstanceRequest request =
+   *           UpdateInstanceRequest.newBuilder()
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .setInstance(Instance.newBuilder().build())
+   *               .build();
+   *       Instance response = cloudRedisClient.updateInstanceAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -746,16 +1049,34 @@ public final OperationFuture updateInstanceAsync(UpdateInstanceRe *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   UpdateInstanceRequest request =
-   *       UpdateInstanceRequest.newBuilder()
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .setInstance(Instance.newBuilder().build())
-   *           .build();
-   *   OperationFuture future =
-   *       cloudRedisClient.updateInstanceOperationCallable().futureCall(request);
-   *   // Do something.
-   *   Instance response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.UpdateInstanceRequest;
+   * import com.google.protobuf.Any;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class CloudRedisClientUpdateInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientUpdateInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientUpdateInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       UpdateInstanceRequest request =
+   *           UpdateInstanceRequest.newBuilder()
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .setInstance(Instance.newBuilder().build())
+   *               .build();
+   *       OperationFuture future =
+   *           cloudRedisClient.updateInstanceOperationCallable().futureCall(request);
+   *       // Do something.
+   *       Instance response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -775,15 +1096,33 @@ public final OperationFuture updateInstanceAsync(UpdateInstanceRe *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   UpdateInstanceRequest request =
-   *       UpdateInstanceRequest.newBuilder()
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .setInstance(Instance.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = cloudRedisClient.updateInstanceCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.UpdateInstanceRequest;
+   * import com.google.longrunning.Operation;
+   * import com.google.protobuf.FieldMask;
+   *
+   * public class CloudRedisClientUpdateInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientUpdateInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientUpdateInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       UpdateInstanceRequest request =
+   *           UpdateInstanceRequest.newBuilder()
+   *               .setUpdateMask(FieldMask.newBuilder().build())
+   *               .setInstance(Instance.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = cloudRedisClient.updateInstanceCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -798,10 +1137,25 @@ public final UnaryCallable updateInstanceCalla *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
-   *   String redisVersion = "redisVersion-1972584739";
-   *   Instance response = cloudRedisClient.upgradeInstanceAsync(name, redisVersion).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   *
+   * public class CloudRedisClientUpgradeInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientUpgradeInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientUpgradeInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+   *       String redisVersion = "redisVersion-1972584739";
+   *       Instance response = cloudRedisClient.upgradeInstanceAsync(name, redisVersion).get();
+   *     }
+   *   }
    * }
    * }
* @@ -828,10 +1182,25 @@ public final OperationFuture upgradeInstanceAsync( *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
-   *   String redisVersion = "redisVersion-1972584739";
-   *   Instance response = cloudRedisClient.upgradeInstanceAsync(name, redisVersion).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   *
+   * public class CloudRedisClientUpgradeInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientUpgradeInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientUpgradeInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
+   *       String redisVersion = "redisVersion-1972584739";
+   *       Instance response = cloudRedisClient.upgradeInstanceAsync(name, redisVersion).get();
+   *     }
+   *   }
    * }
    * }
* @@ -855,13 +1224,29 @@ public final OperationFuture upgradeInstanceAsync( *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   UpgradeInstanceRequest request =
-   *       UpgradeInstanceRequest.newBuilder()
-   *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
-   *           .setRedisVersion("redisVersion-1972584739")
-   *           .build();
-   *   Instance response = cloudRedisClient.upgradeInstanceAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   * import com.google.cloud.redis.v1beta1.UpgradeInstanceRequest;
+   *
+   * public class CloudRedisClientUpgradeInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientUpgradeInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientUpgradeInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       UpgradeInstanceRequest request =
+   *           UpgradeInstanceRequest.newBuilder()
+   *               .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
+   *               .setRedisVersion("redisVersion-1972584739")
+   *               .build();
+   *       Instance response = cloudRedisClient.upgradeInstanceAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -879,16 +1264,34 @@ public final OperationFuture upgradeInstanceAsync(UpgradeInstance *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   UpgradeInstanceRequest request =
-   *       UpgradeInstanceRequest.newBuilder()
-   *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
-   *           .setRedisVersion("redisVersion-1972584739")
-   *           .build();
-   *   OperationFuture future =
-   *       cloudRedisClient.upgradeInstanceOperationCallable().futureCall(request);
-   *   // Do something.
-   *   Instance response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   * import com.google.cloud.redis.v1beta1.UpgradeInstanceRequest;
+   * import com.google.protobuf.Any;
+   *
+   * public class CloudRedisClientUpgradeInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientUpgradeInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientUpgradeInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       UpgradeInstanceRequest request =
+   *           UpgradeInstanceRequest.newBuilder()
+   *               .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
+   *               .setRedisVersion("redisVersion-1972584739")
+   *               .build();
+   *       OperationFuture future =
+   *           cloudRedisClient.upgradeInstanceOperationCallable().futureCall(request);
+   *       // Do something.
+   *       Instance response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -904,15 +1307,32 @@ public final OperationFuture upgradeInstanceAsync(UpgradeInstance *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   UpgradeInstanceRequest request =
-   *       UpgradeInstanceRequest.newBuilder()
-   *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
-   *           .setRedisVersion("redisVersion-1972584739")
-   *           .build();
-   *   ApiFuture future = cloudRedisClient.upgradeInstanceCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   * import com.google.cloud.redis.v1beta1.UpgradeInstanceRequest;
+   * import com.google.longrunning.Operation;
+   *
+   * public class CloudRedisClientUpgradeInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientUpgradeInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientUpgradeInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       UpgradeInstanceRequest request =
+   *           UpgradeInstanceRequest.newBuilder()
+   *               .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
+   *               .setRedisVersion("redisVersion-1972584739")
+   *               .build();
+   *       ApiFuture future = cloudRedisClient.upgradeInstanceCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -933,10 +1353,25 @@ public final UnaryCallable upgradeInstanceCal *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   String name = "name3373707";
-   *   InputConfig inputConfig = InputConfig.newBuilder().build();
-   *   Instance response = cloudRedisClient.importInstanceAsync(name, inputConfig).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.InputConfig;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   *
+   * public class CloudRedisClientImportInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientImportInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientImportInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       String name = "name3373707";
+   *       InputConfig inputConfig = InputConfig.newBuilder().build();
+   *       Instance response = cloudRedisClient.importInstanceAsync(name, inputConfig).get();
+   *     }
+   *   }
    * }
    * }
* @@ -966,13 +1401,29 @@ public final OperationFuture importInstanceAsync( *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   ImportInstanceRequest request =
-   *       ImportInstanceRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setInputConfig(InputConfig.newBuilder().build())
-   *           .build();
-   *   Instance response = cloudRedisClient.importInstanceAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.ImportInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.InputConfig;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   *
+   * public class CloudRedisClientImportInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientImportInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientImportInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       ImportInstanceRequest request =
+   *           ImportInstanceRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setInputConfig(InputConfig.newBuilder().build())
+   *               .build();
+   *       Instance response = cloudRedisClient.importInstanceAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -996,16 +1447,34 @@ public final OperationFuture importInstanceAsync(ImportInstanceRe *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   ImportInstanceRequest request =
-   *       ImportInstanceRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setInputConfig(InputConfig.newBuilder().build())
-   *           .build();
-   *   OperationFuture future =
-   *       cloudRedisClient.importInstanceOperationCallable().futureCall(request);
-   *   // Do something.
-   *   Instance response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.ImportInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.InputConfig;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.protobuf.Any;
+   *
+   * public class CloudRedisClientImportInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientImportInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientImportInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       ImportInstanceRequest request =
+   *           ImportInstanceRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setInputConfig(InputConfig.newBuilder().build())
+   *               .build();
+   *       OperationFuture future =
+   *           cloudRedisClient.importInstanceOperationCallable().futureCall(request);
+   *       // Do something.
+   *       Instance response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1027,15 +1496,32 @@ public final OperationFuture importInstanceAsync(ImportInstanceRe *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   ImportInstanceRequest request =
-   *       ImportInstanceRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setInputConfig(InputConfig.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = cloudRedisClient.importInstanceCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.ImportInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.InputConfig;
+   * import com.google.longrunning.Operation;
+   *
+   * public class CloudRedisClientImportInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientImportInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientImportInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       ImportInstanceRequest request =
+   *           ImportInstanceRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setInputConfig(InputConfig.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = cloudRedisClient.importInstanceCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1055,10 +1541,25 @@ public final UnaryCallable importInstanceCalla *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   String name = "name3373707";
-   *   OutputConfig outputConfig = OutputConfig.newBuilder().build();
-   *   Instance response = cloudRedisClient.exportInstanceAsync(name, outputConfig).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.OutputConfig;
+   *
+   * public class CloudRedisClientExportInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientExportInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientExportInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       String name = "name3373707";
+   *       OutputConfig outputConfig = OutputConfig.newBuilder().build();
+   *       Instance response = cloudRedisClient.exportInstanceAsync(name, outputConfig).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1087,13 +1588,29 @@ public final OperationFuture exportInstanceAsync( *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   ExportInstanceRequest request =
-   *       ExportInstanceRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setOutputConfig(OutputConfig.newBuilder().build())
-   *           .build();
-   *   Instance response = cloudRedisClient.exportInstanceAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.ExportInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.OutputConfig;
+   *
+   * public class CloudRedisClientExportInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientExportInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientExportInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       ExportInstanceRequest request =
+   *           ExportInstanceRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setOutputConfig(OutputConfig.newBuilder().build())
+   *               .build();
+   *       Instance response = cloudRedisClient.exportInstanceAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1116,16 +1633,34 @@ public final OperationFuture exportInstanceAsync(ExportInstanceRe *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   ExportInstanceRequest request =
-   *       ExportInstanceRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setOutputConfig(OutputConfig.newBuilder().build())
-   *           .build();
-   *   OperationFuture future =
-   *       cloudRedisClient.exportInstanceOperationCallable().futureCall(request);
-   *   // Do something.
-   *   Instance response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.ExportInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.OutputConfig;
+   * import com.google.protobuf.Any;
+   *
+   * public class CloudRedisClientExportInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientExportInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientExportInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       ExportInstanceRequest request =
+   *           ExportInstanceRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setOutputConfig(OutputConfig.newBuilder().build())
+   *               .build();
+   *       OperationFuture future =
+   *           cloudRedisClient.exportInstanceOperationCallable().futureCall(request);
+   *       // Do something.
+   *       Instance response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1146,15 +1681,32 @@ public final OperationFuture exportInstanceAsync(ExportInstanceRe *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   ExportInstanceRequest request =
-   *       ExportInstanceRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setOutputConfig(OutputConfig.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = cloudRedisClient.exportInstanceCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.ExportInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.OutputConfig;
+   * import com.google.longrunning.Operation;
+   *
+   * public class CloudRedisClientExportInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientExportInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientExportInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       ExportInstanceRequest request =
+   *           ExportInstanceRequest.newBuilder()
+   *               .setName("name3373707")
+   *               .setOutputConfig(OutputConfig.newBuilder().build())
+   *               .build();
+   *       ApiFuture future = cloudRedisClient.exportInstanceCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1170,11 +1722,27 @@ public final UnaryCallable exportInstanceCalla *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
-   *   FailoverInstanceRequest.DataProtectionMode dataProtectionMode =
-   *       FailoverInstanceRequest.DataProtectionMode.forNumber(0);
-   *   Instance response = cloudRedisClient.failoverInstanceAsync(name, dataProtectionMode).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.FailoverInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   *
+   * public class CloudRedisClientFailoverInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientFailoverInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientFailoverInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+   *       FailoverInstanceRequest.DataProtectionMode dataProtectionMode =
+   *           FailoverInstanceRequest.DataProtectionMode.forNumber(0);
+   *       Instance response = cloudRedisClient.failoverInstanceAsync(name, dataProtectionMode).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1203,11 +1771,27 @@ public final OperationFuture failoverInstanceAsync( *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
-   *   FailoverInstanceRequest.DataProtectionMode dataProtectionMode =
-   *       FailoverInstanceRequest.DataProtectionMode.forNumber(0);
-   *   Instance response = cloudRedisClient.failoverInstanceAsync(name, dataProtectionMode).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.FailoverInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   *
+   * public class CloudRedisClientFailoverInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientFailoverInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientFailoverInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
+   *       FailoverInstanceRequest.DataProtectionMode dataProtectionMode =
+   *           FailoverInstanceRequest.DataProtectionMode.forNumber(0);
+   *       Instance response = cloudRedisClient.failoverInstanceAsync(name, dataProtectionMode).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1236,12 +1820,28 @@ public final OperationFuture failoverInstanceAsync( *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   FailoverInstanceRequest request =
-   *       FailoverInstanceRequest.newBuilder()
-   *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
-   *           .build();
-   *   Instance response = cloudRedisClient.failoverInstanceAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.FailoverInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   *
+   * public class CloudRedisClientFailoverInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientFailoverInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientFailoverInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       FailoverInstanceRequest request =
+   *           FailoverInstanceRequest.newBuilder()
+   *               .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
+   *               .build();
+   *       Instance response = cloudRedisClient.failoverInstanceAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1261,15 +1861,33 @@ public final OperationFuture failoverInstanceAsync( *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   FailoverInstanceRequest request =
-   *       FailoverInstanceRequest.newBuilder()
-   *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
-   *           .build();
-   *   OperationFuture future =
-   *       cloudRedisClient.failoverInstanceOperationCallable().futureCall(request);
-   *   // Do something.
-   *   Instance response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.FailoverInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.Instance;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   * import com.google.protobuf.Any;
+   *
+   * public class CloudRedisClientFailoverInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientFailoverInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientFailoverInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       FailoverInstanceRequest request =
+   *           FailoverInstanceRequest.newBuilder()
+   *               .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
+   *               .build();
+   *       OperationFuture future =
+   *           cloudRedisClient.failoverInstanceOperationCallable().futureCall(request);
+   *       // Do something.
+   *       Instance response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1286,14 +1904,31 @@ public final OperationFuture failoverInstanceAsync( *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   FailoverInstanceRequest request =
-   *       FailoverInstanceRequest.newBuilder()
-   *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
-   *           .build();
-   *   ApiFuture future = cloudRedisClient.failoverInstanceCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.FailoverInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   * import com.google.longrunning.Operation;
+   *
+   * public class CloudRedisClientFailoverInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientFailoverInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientFailoverInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       FailoverInstanceRequest request =
+   *           FailoverInstanceRequest.newBuilder()
+   *               .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
+   *               .build();
+   *       ApiFuture future = cloudRedisClient.failoverInstanceCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1308,9 +1943,24 @@ public final UnaryCallable failoverInstanceC *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
-   *   cloudRedisClient.deleteInstanceAsync(name).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class CloudRedisClientDeleteInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientDeleteInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientDeleteInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+   *       cloudRedisClient.deleteInstanceAsync(name).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1332,9 +1982,24 @@ public final OperationFuture deleteInstanceAsync(InstanceName name) *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
-   *   cloudRedisClient.deleteInstanceAsync(name).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class CloudRedisClientDeleteInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientDeleteInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientDeleteInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
+   *       cloudRedisClient.deleteInstanceAsync(name).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1355,12 +2020,28 @@ public final OperationFuture deleteInstanceAsync(String name) { *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   DeleteInstanceRequest request =
-   *       DeleteInstanceRequest.newBuilder()
-   *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
-   *           .build();
-   *   cloudRedisClient.deleteInstanceAsync(request).get();
+   * package com.google.example;
+   *
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.DeleteInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   * import com.google.protobuf.Empty;
+   *
+   * public class CloudRedisClientDeleteInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientDeleteInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientDeleteInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       DeleteInstanceRequest request =
+   *           DeleteInstanceRequest.newBuilder()
+   *               .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
+   *               .build();
+   *       cloudRedisClient.deleteInstanceAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1378,15 +2059,33 @@ public final OperationFuture deleteInstanceAsync(DeleteInstanceReque *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   DeleteInstanceRequest request =
-   *       DeleteInstanceRequest.newBuilder()
-   *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
-   *           .build();
-   *   OperationFuture future =
-   *       cloudRedisClient.deleteInstanceOperationCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.DeleteInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   * import com.google.protobuf.Any;
+   * import com.google.protobuf.Empty;
+   *
+   * public class CloudRedisClientDeleteInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientDeleteInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientDeleteInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       DeleteInstanceRequest request =
+   *           DeleteInstanceRequest.newBuilder()
+   *               .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
+   *               .build();
+   *       OperationFuture future =
+   *           cloudRedisClient.deleteInstanceOperationCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -1402,14 +2101,31 @@ public final OperationFuture deleteInstanceAsync(DeleteInstanceReque *

Sample code: * *

{@code
-   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
-   *   DeleteInstanceRequest request =
-   *       DeleteInstanceRequest.newBuilder()
-   *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
-   *           .build();
-   *   ApiFuture future = cloudRedisClient.deleteInstanceCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+   * import com.google.cloud.redis.v1beta1.DeleteInstanceRequest;
+   * import com.google.cloud.redis.v1beta1.InstanceName;
+   * import com.google.longrunning.Operation;
+   *
+   * public class CloudRedisClientDeleteInstance {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     cloudRedisClientDeleteInstance();
+   *   }
+   *
+   *   public static void cloudRedisClientDeleteInstance() throws Exception {
+   *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *       DeleteInstanceRequest request =
+   *           DeleteInstanceRequest.newBuilder()
+   *               .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
+   *               .build();
+   *       ApiFuture future = cloudRedisClient.deleteInstanceCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/CloudRedisSettings.java b/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/CloudRedisSettings.java index 08436a1bd7..3417bca4d9 100644 --- a/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/CloudRedisSettings.java +++ b/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/CloudRedisSettings.java @@ -57,17 +57,31 @@ *

For example, to set the total timeout of getInstance to 30 seconds: * *

{@code
- * CloudRedisSettings.Builder cloudRedisSettingsBuilder = CloudRedisSettings.newBuilder();
- * cloudRedisSettingsBuilder
- *     .getInstanceSettings()
- *     .setRetrySettings(
- *         cloudRedisSettingsBuilder
- *             .getInstanceSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * CloudRedisSettings cloudRedisSettings = cloudRedisSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.redis.v1beta1.CloudRedisSettings;
+ * import java.time.Duration;
+ *
+ * public class CloudRedisSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     cloudRedisSettings();
+ *   }
+ *
+ *   public static void cloudRedisSettings() throws Exception {
+ *     CloudRedisSettings.Builder cloudRedisSettingsBuilder = CloudRedisSettings.newBuilder();
+ *     cloudRedisSettingsBuilder
+ *         .getInstanceSettings()
+ *         .setRetrySettings(
+ *             cloudRedisSettingsBuilder
+ *                 .getInstanceSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     CloudRedisSettings cloudRedisSettings = cloudRedisSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @BetaApi diff --git a/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/package-info.java b/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/package-info.java index d8d969e5e7..2a2ba1f760 100644 --- a/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/package-info.java +++ b/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/package-info.java @@ -43,9 +43,24 @@ *

Sample for CloudRedisClient: * *

{@code
- * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- *   Instance response = cloudRedisClient.getInstance(name);
+ * package com.google.example;
+ *
+ * import com.google.cloud.redis.v1beta1.CloudRedisClient;
+ * import com.google.cloud.redis.v1beta1.Instance;
+ * import com.google.cloud.redis.v1beta1.InstanceName;
+ *
+ * public class CloudRedisClientGetInstance {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     cloudRedisClientGetInstance();
+ *   }
+ *
+ *   public static void cloudRedisClientGetInstance() throws Exception {
+ *     try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+ *       InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ *       Instance response = cloudRedisClient.getInstance(name);
+ *     }
+ *   }
  * }
  * }
*/ diff --git a/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java b/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java index b92734fabc..7dd20bf0f8 100644 --- a/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java +++ b/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java @@ -85,17 +85,31 @@ *

For example, to set the total timeout of getInstance to 30 seconds: * *

{@code
- * CloudRedisStubSettings.Builder cloudRedisSettingsBuilder = CloudRedisStubSettings.newBuilder();
- * cloudRedisSettingsBuilder
- *     .getInstanceSettings()
- *     .setRetrySettings(
- *         cloudRedisSettingsBuilder
- *             .getInstanceSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * CloudRedisStubSettings cloudRedisSettings = cloudRedisSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.cloud.redis.v1beta1.stub.CloudRedisStubSettings;
+ * import java.time.Duration;
+ *
+ * public class CloudRedisSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     cloudRedisSettings();
+ *   }
+ *
+ *   public static void cloudRedisSettings() throws Exception {
+ *     CloudRedisStubSettings.Builder cloudRedisSettingsBuilder = CloudRedisStubSettings.newBuilder();
+ *     cloudRedisSettingsBuilder
+ *         .getInstanceSettings()
+ *         .setRetrySettings(
+ *             cloudRedisSettingsBuilder
+ *                 .getInstanceSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     CloudRedisStubSettings cloudRedisSettings = cloudRedisSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @BetaApi diff --git a/test/integration/goldens/storage/com/google/storage/v2/StorageClient.java b/test/integration/goldens/storage/com/google/storage/v2/StorageClient.java index 78b7fd7e08..de8498f80b 100644 --- a/test/integration/goldens/storage/com/google/storage/v2/StorageClient.java +++ b/test/integration/goldens/storage/com/google/storage/v2/StorageClient.java @@ -35,14 +35,32 @@ * calls that map to API methods. Sample code to get started: * *
{@code
- * try (StorageClient storageClient = StorageClient.create()) {
- *   StartResumableWriteRequest request =
- *       StartResumableWriteRequest.newBuilder()
- *           .setWriteObjectSpec(WriteObjectSpec.newBuilder().build())
- *           .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
- *           .setCommonRequestParams(CommonRequestParams.newBuilder().build())
- *           .build();
- *   StartResumableWriteResponse response = storageClient.startResumableWrite(request);
+ * package com.google.example;
+ *
+ * import com.google.storage.v2.CommonObjectRequestParams;
+ * import com.google.storage.v2.CommonRequestParams;
+ * import com.google.storage.v2.StartResumableWriteRequest;
+ * import com.google.storage.v2.StartResumableWriteResponse;
+ * import com.google.storage.v2.StorageClient;
+ * import com.google.storage.v2.WriteObjectSpec;
+ *
+ * public class StorageClientStartResumableWrite {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     storageClientStartResumableWrite();
+ *   }
+ *
+ *   public static void storageClientStartResumableWrite() throws Exception {
+ *     try (StorageClient storageClient = StorageClient.create()) {
+ *       StartResumableWriteRequest request =
+ *           StartResumableWriteRequest.newBuilder()
+ *               .setWriteObjectSpec(WriteObjectSpec.newBuilder().build())
+ *               .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
+ *               .setCommonRequestParams(CommonRequestParams.newBuilder().build())
+ *               .build();
+ *       StartResumableWriteResponse response = storageClient.startResumableWrite(request);
+ *     }
+ *   }
  * }
  * }
* @@ -75,18 +93,49 @@ *

To customize credentials: * *

{@code
- * StorageSettings storageSettings =
- *     StorageSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * StorageClient storageClient = StorageClient.create(storageSettings);
+ * package com.google.example;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ * import com.google.storage.v2.StorageClient;
+ * import com.google.storage.v2.StorageSettings;
+ * import com.google.storage.v2.myCredentials;
+ *
+ * public class StorageClientSetCredentialsProvider {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     storageClientSetCredentialsProvider();
+ *   }
+ *
+ *   public static void storageClientSetCredentialsProvider() throws Exception {
+ *     StorageSettings storageSettings =
+ *         StorageSettings.newBuilder()
+ *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *             .build();
+ *     StorageClient storageClient = StorageClient.create(storageSettings);
+ *   }
+ * }
  * }
* *

To customize the endpoint: * *

{@code
- * StorageSettings storageSettings = StorageSettings.newBuilder().setEndpoint(myEndpoint).build();
- * StorageClient storageClient = StorageClient.create(storageSettings);
+ * package com.google.example;
+ *
+ * import com.google.storage.v2.StorageClient;
+ * import com.google.storage.v2.StorageSettings;
+ * import com.google.storage.v2.myEndpoint;
+ *
+ * public class StorageClientSetEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     storageClientSetEndpoint();
+ *   }
+ *
+ *   public static void storageClientSetEndpoint() throws Exception {
+ *     StorageSettings storageSettings = StorageSettings.newBuilder().setEndpoint(myEndpoint).build();
+ *     StorageClient storageClient = StorageClient.create(storageSettings);
+ *   }
+ * }
  * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. @@ -149,25 +198,44 @@ public StorageStub getStub() { *

Sample code: * *

{@code
-   * try (StorageClient storageClient = StorageClient.create()) {
-   *   ReadObjectRequest request =
-   *       ReadObjectRequest.newBuilder()
-   *           .setBucket("bucket-1378203158")
-   *           .setObject("object-1023368385")
-   *           .setGeneration(305703192)
-   *           .setReadOffset(-715377828)
-   *           .setReadLimit(-164298798)
-   *           .setIfGenerationMatch(-1086241088)
-   *           .setIfGenerationNotMatch(1475720404)
-   *           .setIfMetagenerationMatch(1043427781)
-   *           .setIfMetagenerationNotMatch(1025430873)
-   *           .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
-   *           .setCommonRequestParams(CommonRequestParams.newBuilder().build())
-   *           .setReadMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ServerStream stream = storageClient.readObjectCallable().call(request);
-   *   for (ReadObjectResponse response : stream) {
-   *     // Do something when a response is received.
+   * package com.google.example;
+   *
+   * import com.google.api.gax.rpc.ServerStream;
+   * import com.google.protobuf.FieldMask;
+   * import com.google.storage.v2.CommonObjectRequestParams;
+   * import com.google.storage.v2.CommonRequestParams;
+   * import com.google.storage.v2.ReadObjectRequest;
+   * import com.google.storage.v2.ReadObjectResponse;
+   * import com.google.storage.v2.StorageClient;
+   *
+   * public class StorageClientReadObject {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     storageClientReadObject();
+   *   }
+   *
+   *   public static void storageClientReadObject() throws Exception {
+   *     try (StorageClient storageClient = StorageClient.create()) {
+   *       ReadObjectRequest request =
+   *           ReadObjectRequest.newBuilder()
+   *               .setBucket("bucket-1378203158")
+   *               .setObject("object-1023368385")
+   *               .setGeneration(305703192)
+   *               .setReadOffset(-715377828)
+   *               .setReadLimit(-164298798)
+   *               .setIfGenerationMatch(-1086241088)
+   *               .setIfGenerationNotMatch(1475720404)
+   *               .setIfMetagenerationMatch(1043427781)
+   *               .setIfMetagenerationNotMatch(1025430873)
+   *               .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
+   *               .setCommonRequestParams(CommonRequestParams.newBuilder().build())
+   *               .setReadMask(FieldMask.newBuilder().build())
+   *               .build();
+   *       ServerStream stream = storageClient.readObjectCallable().call(request);
+   *       for (ReadObjectResponse response : stream) {
+   *         // Do something when a response is received.
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -202,35 +270,54 @@ public final ServerStreamingCallable read *

Sample code: * *

{@code
-   * try (StorageClient storageClient = StorageClient.create()) {
-   *   ApiStreamObserver responseObserver =
-   *       new ApiStreamObserver() {
-   *         {@literal @}Override
-   *         public void onNext(WriteObjectResponse response) {
-   *           // Do something when a response is received.
-   *         }
-   *
-   *         {@literal @}Override
-   *         public void onError(Throwable t) {
-   *           // Add error-handling
-   *         }
-   *
-   *         {@literal @}Override
-   *         public void onCompleted() {
-   *           // Do something when complete.
-   *         }
-   *       };
-   *   ApiStreamObserver requestObserver =
-   *       storageClient.writeObject().clientStreamingCall(responseObserver);
-   *   WriteObjectRequest request =
-   *       WriteObjectRequest.newBuilder()
-   *           .setWriteOffset(-1559543565)
-   *           .setObjectChecksums(ObjectChecksums.newBuilder().build())
-   *           .setFinishWrite(true)
-   *           .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
-   *           .setCommonRequestParams(CommonRequestParams.newBuilder().build())
-   *           .build();
-   *   requestObserver.onNext(request);
+   * package com.google.example;
+   *
+   * import com.google.api.gax.rpc.ApiStreamObserver;
+   * import com.google.storage.v2.CommonObjectRequestParams;
+   * import com.google.storage.v2.CommonRequestParams;
+   * import com.google.storage.v2.ObjectChecksums;
+   * import com.google.storage.v2.StorageClient;
+   * import com.google.storage.v2.WriteObjectRequest;
+   * import com.google.storage.v2.WriteObjectResponse;
+   *
+   * public class StorageClientWriteObject {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     storageClientWriteObject();
+   *   }
+   *
+   *   public static void storageClientWriteObject() throws Exception {
+   *     try (StorageClient storageClient = StorageClient.create()) {
+   *       ApiStreamObserver responseObserver =
+   *           new ApiStreamObserver() {
+   *             {@literal @}Override
+   *             public void onNext(WriteObjectResponse response) {
+   *               // Do something when a response is received.
+   *             }
+   *
+   *             {@literal @}Override
+   *             public void onError(Throwable t) {
+   *               // Add error-handling
+   *             }
+   *
+   *             {@literal @}Override
+   *             public void onCompleted() {
+   *               // Do something when complete.
+   *             }
+   *           };
+   *       ApiStreamObserver requestObserver =
+   *           storageClient.writeObject().clientStreamingCall(responseObserver);
+   *       WriteObjectRequest request =
+   *           WriteObjectRequest.newBuilder()
+   *               .setWriteOffset(-1559543565)
+   *               .setObjectChecksums(ObjectChecksums.newBuilder().build())
+   *               .setFinishWrite(true)
+   *               .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
+   *               .setCommonRequestParams(CommonRequestParams.newBuilder().build())
+   *               .build();
+   *       requestObserver.onNext(request);
+   *     }
+   *   }
    * }
    * }
*/ @@ -247,14 +334,32 @@ public final ServerStreamingCallable read *

Sample code: * *

{@code
-   * try (StorageClient storageClient = StorageClient.create()) {
-   *   StartResumableWriteRequest request =
-   *       StartResumableWriteRequest.newBuilder()
-   *           .setWriteObjectSpec(WriteObjectSpec.newBuilder().build())
-   *           .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
-   *           .setCommonRequestParams(CommonRequestParams.newBuilder().build())
-   *           .build();
-   *   StartResumableWriteResponse response = storageClient.startResumableWrite(request);
+   * package com.google.example;
+   *
+   * import com.google.storage.v2.CommonObjectRequestParams;
+   * import com.google.storage.v2.CommonRequestParams;
+   * import com.google.storage.v2.StartResumableWriteRequest;
+   * import com.google.storage.v2.StartResumableWriteResponse;
+   * import com.google.storage.v2.StorageClient;
+   * import com.google.storage.v2.WriteObjectSpec;
+   *
+   * public class StorageClientStartResumableWrite {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     storageClientStartResumableWrite();
+   *   }
+   *
+   *   public static void storageClientStartResumableWrite() throws Exception {
+   *     try (StorageClient storageClient = StorageClient.create()) {
+   *       StartResumableWriteRequest request =
+   *           StartResumableWriteRequest.newBuilder()
+   *               .setWriteObjectSpec(WriteObjectSpec.newBuilder().build())
+   *               .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
+   *               .setCommonRequestParams(CommonRequestParams.newBuilder().build())
+   *               .build();
+   *       StartResumableWriteResponse response = storageClient.startResumableWrite(request);
+   *     }
+   *   }
    * }
    * }
* @@ -273,17 +378,36 @@ public final StartResumableWriteResponse startResumableWrite(StartResumableWrite *

Sample code: * *

{@code
-   * try (StorageClient storageClient = StorageClient.create()) {
-   *   StartResumableWriteRequest request =
-   *       StartResumableWriteRequest.newBuilder()
-   *           .setWriteObjectSpec(WriteObjectSpec.newBuilder().build())
-   *           .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
-   *           .setCommonRequestParams(CommonRequestParams.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       storageClient.startResumableWriteCallable().futureCall(request);
-   *   // Do something.
-   *   StartResumableWriteResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.storage.v2.CommonObjectRequestParams;
+   * import com.google.storage.v2.CommonRequestParams;
+   * import com.google.storage.v2.StartResumableWriteRequest;
+   * import com.google.storage.v2.StartResumableWriteResponse;
+   * import com.google.storage.v2.StorageClient;
+   * import com.google.storage.v2.WriteObjectSpec;
+   *
+   * public class StorageClientStartResumableWrite {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     storageClientStartResumableWrite();
+   *   }
+   *
+   *   public static void storageClientStartResumableWrite() throws Exception {
+   *     try (StorageClient storageClient = StorageClient.create()) {
+   *       StartResumableWriteRequest request =
+   *           StartResumableWriteRequest.newBuilder()
+   *               .setWriteObjectSpec(WriteObjectSpec.newBuilder().build())
+   *               .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
+   *               .setCommonRequestParams(CommonRequestParams.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           storageClient.startResumableWriteCallable().futureCall(request);
+   *       // Do something.
+   *       StartResumableWriteResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -309,9 +433,23 @@ public final StartResumableWriteResponse startResumableWrite(StartResumableWrite *

Sample code: * *

{@code
-   * try (StorageClient storageClient = StorageClient.create()) {
-   *   String uploadId = "uploadId1563990780";
-   *   QueryWriteStatusResponse response = storageClient.queryWriteStatus(uploadId);
+   * package com.google.example;
+   *
+   * import com.google.storage.v2.QueryWriteStatusResponse;
+   * import com.google.storage.v2.StorageClient;
+   *
+   * public class StorageClientQueryWriteStatus {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     storageClientQueryWriteStatus();
+   *   }
+   *
+   *   public static void storageClientQueryWriteStatus() throws Exception {
+   *     try (StorageClient storageClient = StorageClient.create()) {
+   *       String uploadId = "uploadId1563990780";
+   *       QueryWriteStatusResponse response = storageClient.queryWriteStatus(uploadId);
+   *     }
+   *   }
    * }
    * }
* @@ -342,14 +480,31 @@ public final QueryWriteStatusResponse queryWriteStatus(String uploadId) { *

Sample code: * *

{@code
-   * try (StorageClient storageClient = StorageClient.create()) {
-   *   QueryWriteStatusRequest request =
-   *       QueryWriteStatusRequest.newBuilder()
-   *           .setUploadId("uploadId1563990780")
-   *           .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
-   *           .setCommonRequestParams(CommonRequestParams.newBuilder().build())
-   *           .build();
-   *   QueryWriteStatusResponse response = storageClient.queryWriteStatus(request);
+   * package com.google.example;
+   *
+   * import com.google.storage.v2.CommonObjectRequestParams;
+   * import com.google.storage.v2.CommonRequestParams;
+   * import com.google.storage.v2.QueryWriteStatusRequest;
+   * import com.google.storage.v2.QueryWriteStatusResponse;
+   * import com.google.storage.v2.StorageClient;
+   *
+   * public class StorageClientQueryWriteStatus {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     storageClientQueryWriteStatus();
+   *   }
+   *
+   *   public static void storageClientQueryWriteStatus() throws Exception {
+   *     try (StorageClient storageClient = StorageClient.create()) {
+   *       QueryWriteStatusRequest request =
+   *           QueryWriteStatusRequest.newBuilder()
+   *               .setUploadId("uploadId1563990780")
+   *               .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
+   *               .setCommonRequestParams(CommonRequestParams.newBuilder().build())
+   *               .build();
+   *       QueryWriteStatusResponse response = storageClient.queryWriteStatus(request);
+   *     }
+   *   }
    * }
    * }
* @@ -377,17 +532,35 @@ public final QueryWriteStatusResponse queryWriteStatus(QueryWriteStatusRequest r *

Sample code: * *

{@code
-   * try (StorageClient storageClient = StorageClient.create()) {
-   *   QueryWriteStatusRequest request =
-   *       QueryWriteStatusRequest.newBuilder()
-   *           .setUploadId("uploadId1563990780")
-   *           .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
-   *           .setCommonRequestParams(CommonRequestParams.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       storageClient.queryWriteStatusCallable().futureCall(request);
-   *   // Do something.
-   *   QueryWriteStatusResponse response = future.get();
+   * package com.google.example;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.storage.v2.CommonObjectRequestParams;
+   * import com.google.storage.v2.CommonRequestParams;
+   * import com.google.storage.v2.QueryWriteStatusRequest;
+   * import com.google.storage.v2.QueryWriteStatusResponse;
+   * import com.google.storage.v2.StorageClient;
+   *
+   * public class StorageClientQueryWriteStatus {
+   *
+   *   public static void main(String[] args) throws Exception {
+   *     storageClientQueryWriteStatus();
+   *   }
+   *
+   *   public static void storageClientQueryWriteStatus() throws Exception {
+   *     try (StorageClient storageClient = StorageClient.create()) {
+   *       QueryWriteStatusRequest request =
+   *           QueryWriteStatusRequest.newBuilder()
+   *               .setUploadId("uploadId1563990780")
+   *               .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
+   *               .setCommonRequestParams(CommonRequestParams.newBuilder().build())
+   *               .build();
+   *       ApiFuture future =
+   *           storageClient.queryWriteStatusCallable().futureCall(request);
+   *       // Do something.
+   *       QueryWriteStatusResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ diff --git a/test/integration/goldens/storage/com/google/storage/v2/StorageSettings.java b/test/integration/goldens/storage/com/google/storage/v2/StorageSettings.java index 8cbe00e72f..f74ad4c43c 100644 --- a/test/integration/goldens/storage/com/google/storage/v2/StorageSettings.java +++ b/test/integration/goldens/storage/com/google/storage/v2/StorageSettings.java @@ -52,17 +52,31 @@ *

For example, to set the total timeout of startResumableWrite to 30 seconds: * *

{@code
- * StorageSettings.Builder storageSettingsBuilder = StorageSettings.newBuilder();
- * storageSettingsBuilder
- *     .startResumableWriteSettings()
- *     .setRetrySettings(
- *         storageSettingsBuilder
- *             .startResumableWriteSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * StorageSettings storageSettings = storageSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.storage.v2.StorageSettings;
+ * import java.time.Duration;
+ *
+ * public class StorageSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     storageSettings();
+ *   }
+ *
+ *   public static void storageSettings() throws Exception {
+ *     StorageSettings.Builder storageSettingsBuilder = StorageSettings.newBuilder();
+ *     storageSettingsBuilder
+ *         .startResumableWriteSettings()
+ *         .setRetrySettings(
+ *             storageSettingsBuilder
+ *                 .startResumableWriteSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     StorageSettings storageSettings = storageSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/storage/com/google/storage/v2/package-info.java b/test/integration/goldens/storage/com/google/storage/v2/package-info.java index bfb389cc80..946bc56286 100644 --- a/test/integration/goldens/storage/com/google/storage/v2/package-info.java +++ b/test/integration/goldens/storage/com/google/storage/v2/package-info.java @@ -24,14 +24,32 @@ *

Sample for StorageClient: * *

{@code
- * try (StorageClient storageClient = StorageClient.create()) {
- *   StartResumableWriteRequest request =
- *       StartResumableWriteRequest.newBuilder()
- *           .setWriteObjectSpec(WriteObjectSpec.newBuilder().build())
- *           .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
- *           .setCommonRequestParams(CommonRequestParams.newBuilder().build())
- *           .build();
- *   StartResumableWriteResponse response = storageClient.startResumableWrite(request);
+ * package com.google.example;
+ *
+ * import com.google.storage.v2.CommonObjectRequestParams;
+ * import com.google.storage.v2.CommonRequestParams;
+ * import com.google.storage.v2.StartResumableWriteRequest;
+ * import com.google.storage.v2.StartResumableWriteResponse;
+ * import com.google.storage.v2.StorageClient;
+ * import com.google.storage.v2.WriteObjectSpec;
+ *
+ * public class StorageClientStartResumableWrite {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     storageClientStartResumableWrite();
+ *   }
+ *
+ *   public static void storageClientStartResumableWrite() throws Exception {
+ *     try (StorageClient storageClient = StorageClient.create()) {
+ *       StartResumableWriteRequest request =
+ *           StartResumableWriteRequest.newBuilder()
+ *               .setWriteObjectSpec(WriteObjectSpec.newBuilder().build())
+ *               .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
+ *               .setCommonRequestParams(CommonRequestParams.newBuilder().build())
+ *               .build();
+ *       StartResumableWriteResponse response = storageClient.startResumableWrite(request);
+ *     }
+ *   }
  * }
  * }
*/ diff --git a/test/integration/goldens/storage/com/google/storage/v2/stub/StorageStubSettings.java b/test/integration/goldens/storage/com/google/storage/v2/stub/StorageStubSettings.java index 85c8639848..7051afcdfe 100644 --- a/test/integration/goldens/storage/com/google/storage/v2/stub/StorageStubSettings.java +++ b/test/integration/goldens/storage/com/google/storage/v2/stub/StorageStubSettings.java @@ -68,17 +68,31 @@ *

For example, to set the total timeout of startResumableWrite to 30 seconds: * *

{@code
- * StorageStubSettings.Builder storageSettingsBuilder = StorageStubSettings.newBuilder();
- * storageSettingsBuilder
- *     .startResumableWriteSettings()
- *     .setRetrySettings(
- *         storageSettingsBuilder
- *             .startResumableWriteSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * StorageStubSettings storageSettings = storageSettingsBuilder.build();
+ * package com.google.example;
+ *
+ * import com.google.storage.v2.stub.StorageStubSettings;
+ * import java.time.Duration;
+ *
+ * public class StorageSettings {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     storageSettings();
+ *   }
+ *
+ *   public static void storageSettings() throws Exception {
+ *     StorageStubSettings.Builder storageSettingsBuilder = StorageStubSettings.newBuilder();
+ *     storageSettingsBuilder
+ *         .startResumableWriteSettings()
+ *         .setRetrySettings(
+ *             storageSettingsBuilder
+ *                 .startResumableWriteSettings()
+ *                 .getRetrySettings()
+ *                 .toBuilder()
+ *                 .setTotalTimeout(Duration.ofSeconds(30))
+ *                 .build());
+ *     StorageStubSettings storageSettings = storageSettingsBuilder.build();
+ *   }
+ * }
  * }
*/ @Generated("by gapic-generator-java")