From 444a91f79a53cee8056cef2a2033d8822e87e259 Mon Sep 17 00:00:00 2001 From: Emily Ball Date: Mon, 29 Nov 2021 19:07:36 -0800 Subject: [PATCH 01/13] feat: ExecutableSampleComposer --- .../samplecode/ExecutableSampleComposer.java | 86 +++++++++++ .../composer/samplecode/SampleCodeWriter.java | 8 + .../gapic/composer/samplecode/SampleUtil.java | 26 ++++ .../gapic/composer/samplecode/BUILD.bazel | 1 + .../ExecutableSampleComposerTest.java | 146 ++++++++++++++++++ 5 files changed, 267 insertions(+) create mode 100644 src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposer.java create mode 100644 src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleUtil.java create mode 100644 src/test/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposerTest.java 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..5416908b81 --- /dev/null +++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposer.java @@ -0,0 +1,86 @@ +package com.google.api.generator.gapic.composer.samplecode; + +import com.google.api.generator.engine.ast.*; +import com.google.api.generator.gapic.utils.JavaStyle; +import com.google.common.collect.ImmutableList; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class ExecutableSampleComposer { + public static String createExecutableSample(String samplePackageName, String sampleMethodName, + List sampleVariableAssignments, + List sampleBody, List sampleMethodArgs){ + return SampleCodeWriter.write(composeExecutableSample(samplePackageName, sampleMethodName, + sampleVariableAssignments, sampleBody, sampleMethodArgs)); + } + + static ClassDefinition composeExecutableSample(String samplePackageName, String sampleMethodName, + List sampleVariableAssignments, + List sampleBody, List sampleMethodArgs){ + + String sampleClassName = JavaStyle.toUpperCamelCase(sampleMethodName); + MethodDefinition mainMethod = composeMainMethod(composeMainBody( + sampleVariableAssignments, composeInvokeMethodStatement(sampleMethodName, sampleMethodArgs))); + MethodDefinition sampleMethod = composeSampleMethod(sampleMethodName, sampleMethodArgs, sampleBody); + return composeSampleClass( + samplePackageName, + sampleClassName, + mainMethod, + sampleMethod); + } + + 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()); + } + + 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; + } + + static ClassDefinition composeSampleClass(String samplePackageName, String sampleClassName, + MethodDefinition mainMethod, MethodDefinition sampleMethod){ + return ClassDefinition.builder() + .setScope(ScopeNode.PUBLIC) + .setPackageString(samplePackageName) + .setName(sampleClassName) + .setMethods(ImmutableList.of(mainMethod, sampleMethod)) + .build(); + } + + 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()) + .setBody(mainBody) + .build(); + } + + static MethodDefinition composeSampleMethod(String sampleMethodName, List sampleMethodArgs, + List sampleMethodBody) { + return MethodDefinition.builder() + .setScope(ScopeNode.PUBLIC) + .setIsStatic(true) + .setReturnType(TypeNode.VOID) + .setName(sampleMethodName) + .setArguments(sampleMethodArgs) + .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..3ccc825e13 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,7 @@ package com.google.api.generator.gapic.composer.samplecode; +import com.google.api.generator.engine.ast.ClassDefinition; import com.google.api.generator.engine.ast.Statement; import com.google.api.generator.engine.writer.JavaWriterVisitor; import java.util.Arrays; @@ -34,4 +35,11 @@ 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 @}");
+  }
 }
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..5edba23ddd
--- /dev/null
+++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleUtil.java
@@ -0,0 +1,26 @@
+package com.google.api.generator.gapic.composer.samplecode;
+
+import com.google.api.generator.engine.ast.*;
+
+public class SampleUtil {
+    static MethodInvocationExpr systemOutPrint(String content){
+        VaporReference out = VaporReference.builder()
+                .setSupertypeReference(ConcreteReference.withClazz(System.class))
+                .setEnclosingClassNames("System").setName("out").setPakkage("java.lang").build();
+        return MethodInvocationExpr.builder()
+                .setStaticReferenceType(TypeNode.withReference(out))
+                .setMethodName("println")
+                .setArguments(ValueExpr.withValue(StringObjectValue.withValue(content)))
+                .build();
+    }
+    static MethodInvocationExpr systemOutPrint(VariableExpr variableExpr){
+        VaporReference out = VaporReference.builder()
+                .setSupertypeReference(ConcreteReference.withClazz(System.class))
+                .setEnclosingClassNames("System").setName("out").setPakkage("java.lang").build();
+        return MethodInvocationExpr.builder()
+                .setStaticReferenceType(TypeNode.withReference(out))
+                .setMethodName("println")
+                .setArguments(variableExpr.toBuilder().setIsDecl(false).build())
+                .build();
+    }
+}
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..0f1df84aa0 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,7 @@ TESTS = [
     "SampleCodeWriterTest",
     "ServiceClientSampleCodeComposerTest",
     "SettingsSampleCodeComposerTest",
+    "ExecutableSampleComposerTest",
 ]
 
 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..4754016fac
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposerTest.java
@@ -0,0 +1,146 @@
+package com.google.api.generator.gapic.composer.samplecode;
+
+import com.google.api.generator.engine.ast.*;
+import com.google.api.generator.testutils.LineFormatter;
+import com.google.common.collect.ImmutableList;
+import org.junit.Test;
+
+import java.util.ArrayList;
+
+import static org.junit.Assert.assertEquals;
+
+public class ExecutableSampleComposerTest {
+
+    @Test
+    public void createExecutableSampleEmptySample() {
+        String packageName = "com.google.example";
+        String sampleMethodName = "echoClientWait";
+
+        String sampleResult = ExecutableSampleComposer.createExecutableSample(packageName, sampleMethodName,
+                new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
+
+        String expected =
+                LineFormatter.lines(
+                        "package com.google.example;\n",
+                        "\n",
+                        "public class EchoClientWait {\n",
+                        "\n",
+                        "  public static void main(String[] args) {\n",
+                        "    echoClientWait();\n",
+                        "  }\n",
+                        "\n",
+                        "  public static void echoClientWait() {}\n",
+                        "}\n");
+
+        assertEquals(sampleResult, expected);
+    }
+
+    @Test
+    public void createExecutableSampleMethodArgsNoVar() {
+        String packageName = "com.google.example";
+        String sampleMethodName = "echoClientWait";
+
+        Statement sampleBody = ExprStatement.withExpr(SampleUtil.systemOutPrint("Testing " + sampleMethodName));
+
+        String sampleResult = ExecutableSampleComposer.createExecutableSample(packageName, sampleMethodName,
+                new ArrayList<>(), ImmutableList.of(sampleBody), new ArrayList<>());
+
+        String expected =
+                LineFormatter.lines(
+                        "package com.google.example;\n",
+                        "\n",
+                        "public class EchoClientWait {\n",
+                        "\n",
+                        "  public static void main(String[] args) {\n",
+                        "    echoClientWait();\n",
+                        "  }\n",
+                        "\n",
+                        "  public static void echoClientWait() {\n",
+                        "    System.out.println(\"Testing echoClientWait\");\n",
+                        "  }\n",
+                        "}\n");
+
+        assertEquals(sampleResult, expected);
+    }
+
+    @Test
+    public void createExecutableSampleMethod() {
+        String packageName = "com.google.example";
+        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));
+
+        String sampleResult = ExecutableSampleComposer.createExecutableSample(packageName, sampleMethodName,
+                ImmutableList.of(varAssignment), ImmutableList.of(sampleBody), ImmutableList.of(variableExpr));
+
+        String expected =
+                LineFormatter.lines(
+                        "package com.google.example;\n",
+                        "\n",
+                        "public class EchoClientWait {\n",
+                        "\n",
+                        "  public static void main(String[] args) {\n",
+                        "    String content = \"Testing echoClientWait\";\n",
+                        "    echoClientWait(content);\n",
+                        "  }\n",
+                        "\n",
+                        "  public static void echoClientWait(String content) {\n",
+                        "    System.out.println(content);\n",
+                        "  }\n",
+                        "}\n");
+
+        assertEquals(sampleResult, expected);
+    }
+
+    @Test
+    public void createExecutableSampleMethodMultipleStatements() {
+        String packageName = "com.google.example";
+        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));
+
+        String sampleResult = ExecutableSampleComposer.createExecutableSample(packageName, sampleMethodName,
+                ImmutableList.of(varAssignment, varAssignment2), ImmutableList.of(bodyStatement, bodyStatement2),
+                ImmutableList.of(variableExpr, variableExpr2));
+
+        String expected =
+                LineFormatter.lines(
+                        "package com.google.example;\n",
+                        "\n",
+                        "public class EchoClientWait {\n",
+                        "\n",
+                        "  public static void main(String[] args) {\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) {\n",
+                        "    System.out.println(content);\n",
+                        "    System.out.println(otherContent);\n",
+                        "  }\n",
+                        "}\n");
+
+        assertEquals(sampleResult, expected);
+    }
+}

From fce9bda33f82f98d0931fed5d1c5b0e93c54d79d Mon Sep 17 00:00:00 2001
From: Emily Ball 
Date: Tue, 30 Nov 2021 12:46:21 -0800
Subject: [PATCH 02/13] feat: make current samples executable samples

---
 .../engine/writer/ImportWriterVisitor.java    |    5 -
 .../AbstractServiceClientClassComposer.java   |   35 +-
 .../AbstractServiceSettingsClassComposer.java |    6 +-
 ...tractServiceStubSettingsClassComposer.java |    6 +-
 .../composer/samplecode/ExecutableSample.java |   21 +
 .../samplecode/ExecutableSampleComposer.java  |   34 +-
 .../gapic/composer/samplecode/SampleUtil.java |    5 +
 .../ServiceClientSampleCodeComposer.java      |  153 +-
 .../SettingsSampleCodeComposer.java           |   16 +-
 .../grpc/goldens/BookshopClient.golden        |  169 ++-
 .../goldens/DeprecatedServiceClient.golden    |  149 +-
 .../goldens/DeprecatedServiceSettings.golden  |   37 +-
 .../DeprecatedServiceStubSettings.golden      |   39 +-
 .../composer/grpc/goldens/EchoClient.golden   |  870 +++++++++---
 .../composer/grpc/goldens/EchoSettings.golden |   35 +-
 .../grpc/goldens/EchoStubSettings.golden      |   35 +-
 .../grpc/goldens/IdentityClient.golden        |  540 +++++--
 .../LoggingServiceV2StubSettings.golden       |   37 +-
 .../grpc/goldens/MessagingClient.golden       | 1255 ++++++++++++-----
 .../grpc/goldens/PublisherStubSettings.golden |   35 +-
 .../rest/goldens/ComplianceSettings.golden    |   35 +-
 .../goldens/ComplianceStubSettings.golden     |   35 +-
 .../ExecutableSampleComposerTest.java         |   28 +-
 .../ServiceClientSampleCodeComposerTest.java  |  910 ++++++++----
 .../SettingsSampleCodeComposerTest.java       |   87 +-
 25 files changed, 3285 insertions(+), 1292 deletions(-)
 create mode 100644 src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSample.java

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..ff29a2613d 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
@@ -359,11 +359,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..bc437bf89d
--- /dev/null
+++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSample.java
@@ -0,0 +1,21 @@
+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 {
+    final String samplePackageName;
+    final String sampleMethodName;
+    final List sampleVariableAssignments;
+    final List sampleBody;
+
+    public ExecutableSample(String samplePackageName, String sampleMethodName,
+                            List sampleVariableAssignments, List sampleBody) {
+        this.samplePackageName = samplePackageName;
+        this.sampleMethodName = sampleMethodName;
+        this.sampleVariableAssignments = sampleVariableAssignments;
+        this.sampleBody = 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
index 5416908b81..f96475495d 100644
--- 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
@@ -6,21 +6,36 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 public class ExecutableSampleComposer {
-    public static String createExecutableSample(String samplePackageName, String sampleMethodName,
-                                                List sampleVariableAssignments,
-                                                List sampleBody, List sampleMethodArgs){
-        return SampleCodeWriter.write(composeExecutableSample(samplePackageName, sampleMethodName,
-                sampleVariableAssignments, sampleBody, sampleMethodArgs));
+    // TODO: exceptions
+    public static String createExecutableSample(ExecutableSample executableSample){
+        return SampleCodeWriter.write(
+                composeExecutableSample(executableSample.samplePackageName, executableSample.sampleMethodName,
+                        executableSample.sampleVariableAssignments, executableSample.sampleBody));
+    }
+
+    public static Optional createExecutableSample(Optional executableSample){
+        if (executableSample.isPresent()) {
+            ExecutableSample sample = executableSample.get();
+          return Optional.of(SampleCodeWriter.write(
+              composeExecutableSample(
+                      sample.samplePackageName,
+                      sample.sampleMethodName,
+                      sample.sampleVariableAssignments,
+                      sample.sampleBody)));
+        }
+        return Optional.empty();
     }
 
     static ClassDefinition composeExecutableSample(String samplePackageName, String sampleMethodName,
                                                    List sampleVariableAssignments,
-                                                   List sampleBody, List sampleMethodArgs){
+                                                   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);
@@ -31,6 +46,12 @@ static ClassDefinition composeExecutableSample(String samplePackageName, String
                 sampleMethod);
     }
 
+    static List composeSampleMethodArgs(List sampleVariableAssignments){
+        return sampleVariableAssignments.stream()
+                .map(v -> v.variableExpr().toBuilder().setIsDecl(true).build())
+                .collect(Collectors.toList());
+    }
+
     static Statement composeInvokeMethodStatement(String sampleMethodName, List sampleMethodArgs){
         List invokeArgs = sampleMethodArgs.stream()
                 .map(arg -> arg.toBuilder().setIsDecl(false).build())
@@ -40,7 +61,6 @@ static Statement composeInvokeMethodStatement(String sampleMethodName, List composeMainBody(List sampleVariableAssignments, Statement invokeMethod){
-
         List setVariables = sampleVariableAssignments.stream()
                 .map(var -> ExprStatement.withExpr(var)).collect(Collectors.toList());
         List body = new ArrayList<>(setVariables);
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
index 5edba23ddd..666d0e5662 100644
--- 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
@@ -1,6 +1,7 @@
 package com.google.api.generator.gapic.composer.samplecode;
 
 import com.google.api.generator.engine.ast.*;
+import com.google.api.generator.gapic.utils.JavaStyle;
 
 public class SampleUtil {
     static MethodInvocationExpr systemOutPrint(String content){
@@ -23,4 +24,8 @@ static MethodInvocationExpr systemOutPrint(VariableExpr variableExpr){
                 .setArguments(variableExpr.toBuilder().setIsDecl(false).build())
                 .build();
     }
+
+    static String composeSampleMethodName(String clientName, String methodName){
+        return JavaStyle.toLowerCamelCase(clientName + methodName);
+    }
 }
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..a2c00aacbe 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
@@ -63,6 +63,9 @@
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
+import static com.google.api.generator.gapic.composer.samplecode.ExecutableSampleComposer.createExecutableSample;
+import static com.google.api.generator.gapic.composer.samplecode.SampleUtil.composeSampleMethodName;
+
 public class ServiceClientSampleCodeComposer {
 
   public static String composeClassHeaderMethodSampleCode(
@@ -79,28 +82,29 @@ 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 =
     // EchoSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create("myCredentials")).build();
     String settingsName = JavaStyle.toLowerCamelCase(settingsType.reference().name());
     String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name());
+    String packageName = clientType.reference().pakkage();
     TypeNode myCredentialsType =
         TypeNode.withReference(
             VaporReference.builder()
                 .setName("myCredentials")
-                .setPakkage(clientType.reference().pakkage())
+                .setPakkage(packageName)
                 .build());
     VariableExpr settingsVarExpr =
         VariableExpr.withVariable(
@@ -155,23 +159,30 @@ public static String composeClassHeaderCredentialsSampleCode(
             .setVariableExpr(clientVarExpr.toBuilder().setIsDecl(true).build())
             .setValueExpr(createMethodExpr)
             .build();
-    return SampleCodeWriter.write(
-        Arrays.asList(
+
+    List sampleBody = Arrays.asList(
             ExprStatement.withExpr(initSettingsVarExpr),
-            ExprStatement.withExpr(initClientVarExpr)));
+            ExprStatement.withExpr(initClientVarExpr));
+
+    return new ExecutableSample(
+            packageName,
+            composeSampleMethodName(clientName, "create"),
+            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();
     String settingsName = JavaStyle.toLowerCamelCase(settingsType.reference().name());
     String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name());
+    String packageName = clientType.reference().pakkage();
     TypeNode myEndpointType =
         TypeNode.withReference(
             VaporReference.builder()
                 .setName("myEndpoint")
-                .setPakkage(clientType.reference().pakkage())
+                .setPakkage(packageName)
                 .build());
     VariableExpr settingsVarExpr =
         VariableExpr.withVariable(
@@ -220,22 +231,28 @@ public static String composeClassHeaderEndpointSampleCode(
             .setValueExpr(createMethodExpr)
             .build();
 
-    return SampleCodeWriter.write(
-        Arrays.asList(
+    List sampleBody = Arrays.asList(
             ExprStatement.withExpr(initSettingsVarExpr),
-            ExprStatement.withExpr(initClientVarExpr)));
+            ExprStatement.withExpr(initClientVarExpr));
+
+    return new ExecutableSample(
+            packageName,
+            composeSampleMethodName(clientName, "ClassHeaderEndpoint"),
+            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()))
+                .setName(clientName)
                 .setType(clientType)
                 .build());
 
@@ -265,23 +282,30 @@ public static String composeRpcMethodHeaderSampleCode(
               method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs));
     }
 
-    return SampleCodeWriter.write(
-        TryCatchStatement.builder()
+    List sampleBody = Arrays.asList(TryCatchStatement.builder()
             .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
             .setTryBody(bodyStatements)
             .setIsSampleCode(true)
             .build());
+    String packageName = clientType.reference().pakkage();
+    return new ExecutableSample(
+            packageName,
+            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());
+    String packageName = clientType.reference().pakkage();
     VariableExpr clientVarExpr =
         VariableExpr.withVariable(
             Variable.builder()
-                .setName(JavaStyle.toLowerCamelCase(clientType.reference().name()))
+                .setName(clientName)
                 .setType(clientType)
                 .build());
 
@@ -322,24 +346,31 @@ public static String composeRpcDefaultMethodHeaderSampleCode(
               method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs));
     }
 
-    return SampleCodeWriter.write(
-        TryCatchStatement.builder()
+    List sampleBody = Arrays.asList(TryCatchStatement.builder()
             .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
             .setTryBody(bodyStatements)
             .setIsSampleCode(true)
             .build());
+
+    return new ExecutableSample(
+            packageName,
+            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());
+    String packageName = clientType.reference().pakkage();
     VariableExpr clientVarExpr =
         VariableExpr.withVariable(
             Variable.builder()
-                .setName(JavaStyle.toLowerCamelCase(clientType.reference().name()))
+                .setName(clientName)
                 .setType(clientType)
                 .build());
     // Assign method's request variable with the default value.
@@ -434,24 +465,31 @@ 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(
+            packageName,
+            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());
+    String packageName = clientType.reference().pakkage();
     VariableExpr clientVarExpr =
         VariableExpr.withVariable(
             Variable.builder()
-                .setName(JavaStyle.toLowerCamelCase(clientType.reference().name()))
+                .setName(clientName)
                 .setType(clientType)
                 .build());
     // Assign method's request variable with the default value.
@@ -553,24 +591,31 @@ 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(
+            packageName,
+            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());
+    String packageName = clientType.reference().pakkage();
     VariableExpr clientVarExpr =
         VariableExpr.withVariable(
             Variable.builder()
-                .setName(JavaStyle.toLowerCamelCase(clientType.reference().name()))
+                .setName(clientName)
                 .setType(clientType)
                 .build());
 
@@ -603,23 +648,30 @@ public static String composeRegularCallableMethodHeaderSampleCode(
           composeUnaryOrLroCallableBodyStatements(method, clientVarExpr, requestVarExpr));
     }
 
-    return SampleCodeWriter.write(
-        TryCatchStatement.builder()
+    List sampleBody = Arrays.asList(TryCatchStatement.builder()
             .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
             .setTryBody(bodyStatements)
             .setIsSampleCode(true)
             .build());
+
+    return new ExecutableSample(
+            packageName,
+            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());
+    String packageName = clientType.reference().pakkage();
     VariableExpr clientVarExpr =
         VariableExpr.withVariable(
             Variable.builder()
-                .setName(JavaStyle.toLowerCamelCase(clientType.reference().name()))
+                .setName(clientName)
                 .setType(clientType)
                 .build());
     // Assign method's request variable with the default value.
@@ -652,12 +704,17 @@ public static String composeStreamCallableMethodHeaderSampleCode(
           composeStreamClientBodyStatements(method, clientVarExpr, requestAssignmentExpr));
     }
 
-    return SampleCodeWriter.write(
-        TryCatchStatement.builder()
+    List sampleBody = Arrays.asList(TryCatchStatement.builder()
             .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr))
             .setTryBody(bodyStatements)
             .setIsSampleCode(true)
             .build());
+
+    return new ExecutableSample(
+            packageName,
+            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..9a1d320e15 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,14 +27,17 @@
 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;
 import java.util.stream.Collectors;
 
+import static com.google.api.generator.gapic.composer.samplecode.SampleUtil.composeSampleMethodName;
+
 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,13 +116,15 @@ public static Optional composeSampleCode(
             .setArguments(retrySettingsArgExpr)
             .build();
 
+    String name = JavaStyle.toLowerCamelCase(settingsClassName);
+    String packageName = classType.reference().pakkage();
     // Initialize clientSetting with builder() method.
     // e.g: FoobarSettings foobarSettings = foobarSettingsBuilder.build();
     VariableExpr settingsVarExpr =
         VariableExpr.withVariable(
             Variable.builder()
                 .setType(classType)
-                .setName(JavaStyle.toLowerCamelCase(settingsClassName))
+                .setName(name)
                 .build());
     AssignmentExpr settingBuildAssignmentExpr =
         AssignmentExpr.builder()
@@ -132,7 +137,7 @@ public static Optional composeSampleCode(
                     .build())
             .build();
 
-    List statements =
+    List sampleBody =
         Arrays.asList(
                 initLocalSettingsExpr,
                 settingBuilderMethodInvocationExpr,
@@ -140,6 +145,9 @@ public static Optional composeSampleCode(
             .stream()
             .map(e -> ExprStatement.withExpr(e))
             .collect(Collectors.toList());
-    return Optional.of(SampleCodeWriter.write(statements));
+
+
+
+    return Optional.of(new ExecutableSample(packageName, 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..d2b1df51d3 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,24 @@ 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.bookshop.v1beta1;
+ *
+ * import java.util.ArrayList;
+ * import java.util.List;
+ *
+ * public class BookshopClientGetBook {
+ *
+ *   public static void main(String[] args) {
+ *     bookshopClientGetBook();
+ *   }
+ *
+ *   public static void bookshopClientGetBook() {
+ *     try (BookshopClient bookshopClient = BookshopClient.create()) {
+ *       int booksCount = 1618425911;
+ *       List books = new ArrayList<>();
+ *       Book response = bookshopClient.getBook(booksCount, books);
+ *     }
+ *   }
  * }
  * }
* @@ -52,19 +66,43 @@ 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.bookshop.v1beta1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class BookshopClientcreate {
+ *
+ *   public static void main(String[] args) {
+ *     bookshopClientcreate();
+ *   }
+ *
+ *   public static void bookshopClientcreate() {
+ *     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.bookshop.v1beta1;
+ *
+ * public class BookshopClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) {
+ *     bookshopClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void bookshopClientClassHeaderEndpoint() {
+ *     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 +164,24 @@ 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.bookshop.v1beta1;
+   *
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class BookshopClientGetBook {
+   *
+   *   public static void main(String[] args) {
+   *     bookshopClientGetBook();
+   *   }
+   *
+   *   public static void bookshopClientGetBook() {
+   *     try (BookshopClient bookshopClient = BookshopClient.create()) {
+   *       int booksCount = 1618425911;
+   *       List books = new ArrayList<>();
+   *       Book response = bookshopClient.getBook(booksCount, books);
+   *     }
+   *   }
    * }
    * }
* @@ -148,10 +200,24 @@ 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.bookshop.v1beta1;
+   *
+   * import java.util.ArrayList;
+   * import java.util.List;
+   *
+   * public class BookshopClientGetBook {
+   *
+   *   public static void main(String[] args) {
+   *     bookshopClientGetBook();
+   *   }
+   *
+   *   public static void bookshopClientGetBook() {
+   *     try (BookshopClient bookshopClient = BookshopClient.create()) {
+   *       String booksList = "booksList2-1119589686";
+   *       List books = new ArrayList<>();
+   *       Book response = bookshopClient.getBook(booksList, books);
+   *     }
+   *   }
    * }
    * }
* @@ -170,14 +236,27 @@ 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.bookshop.v1beta1;
+   *
+   * import java.util.ArrayList;
+   *
+   * public class BookshopClientGetBook {
+   *
+   *   public static void main(String[] args) {
+   *     bookshopClientGetBook();
+   *   }
+   *
+   *   public static void bookshopClientGetBook() {
+   *     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 +272,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();
-   *   ApiFuture future = bookshopClient.getBookCallable().futureCall(request);
-   *   // Do something.
-   *   Book response = future.get();
+   * package com.google.bookshop.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import java.util.ArrayList;
+   *
+   * public class BookshopClientGetBook {
+   *
+   *   public static void main(String[] args) {
+   *     bookshopClientGetBook();
+   *   }
+   *
+   *   public static void bookshopClientGetBook() {
+   *     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..fb1c94bcf3 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,22 @@ 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.testdata.v1;
+ *
+ * import com.google.protobuf.Empty;
+ *
+ * public class DeprecatedServiceClientFastFibonacci {
+ *
+ *   public static void main(String[] args) {
+ *     deprecatedServiceClientFastFibonacci();
+ *   }
+ *
+ *   public static void deprecatedServiceClientFastFibonacci() {
+ *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+ *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+ *       deprecatedServiceClient.fastFibonacci(request);
+ *     }
+ *   }
  * }
  * }
* @@ -52,21 +65,45 @@ 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.testdata.v1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class DeprecatedServiceClientcreate {
+ *
+ *   public static void main(String[] args) {
+ *     deprecatedServiceClientcreate();
+ *   }
+ *
+ *   public static void deprecatedServiceClientcreate() {
+ *     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.testdata.v1;
+ *
+ * public class DeprecatedServiceClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) {
+ *     deprecatedServiceClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void deprecatedServiceClientClassHeaderEndpoint() {
+ *     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 +169,22 @@ 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.testdata.v1;
+   *
+   * import com.google.protobuf.Empty;
+   *
+   * public class DeprecatedServiceClientFastFibonacci {
+   *
+   *   public static void main(String[] args) {
+   *     deprecatedServiceClientFastFibonacci();
+   *   }
+   *
+   *   public static void deprecatedServiceClientFastFibonacci() {
+   *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+   *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+   *       deprecatedServiceClient.fastFibonacci(request);
+   *     }
+   *   }
    * }
    * }
* @@ -150,11 +200,25 @@ 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.testdata.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.protobuf.Empty;
+   *
+   * public class DeprecatedServiceClientFastFibonacci {
+   *
+   *   public static void main(String[] args) {
+   *     deprecatedServiceClientFastFibonacci();
+   *   }
+   *
+   *   public static void deprecatedServiceClientFastFibonacci() {
+   *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+   *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+   *       ApiFuture future = deprecatedServiceClient.fastFibonacciCallable().futureCall(request);
+   *       // Do something.
+   *       future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -167,9 +231,22 @@ 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.testdata.v1;
+   *
+   * import com.google.protobuf.Empty;
+   *
+   * public class DeprecatedServiceClientSlowFibonacci {
+   *
+   *   public static void main(String[] args) {
+   *     deprecatedServiceClientSlowFibonacci();
+   *   }
+   *
+   *   public static void deprecatedServiceClientSlowFibonacci() {
+   *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+   *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+   *       deprecatedServiceClient.slowFibonacci(request);
+   *     }
+   *   }
    * }
    * }
* @@ -187,11 +264,25 @@ 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.testdata.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.protobuf.Empty;
+   *
+   * public class DeprecatedServiceClientSlowFibonacci {
+   *
+   *   public static void main(String[] args) {
+   *     deprecatedServiceClientSlowFibonacci();
+   *   }
+   *
+   *   public static void deprecatedServiceClientSlowFibonacci() {
+   *     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..d1fdfb1438 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,31 @@ 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.testdata.v1;
+ *
+ * import java.time.Duration;
+ *
+ * public class DeprecatedServiceSettings {
+ *
+ *   public static void main(String[] args) {
+ *     deprecatedServiceSettings();
+ *   }
+ *
+ *   public static void deprecatedServiceSettings() {
+ *     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..79a869dfaf 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,32 @@ 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.testdata.v1.stub;
+ *
+ * import java.time.Duration;
+ *
+ * public class DeprecatedServiceSettings {
+ *
+ *   public static void main(String[] args) {
+ *     deprecatedServiceSettings();
+ *   }
+ *
+ *   public static void deprecatedServiceSettings() {
+ *     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..46d36f11f5 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,19 @@ 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.showcase.v1beta1;
+ *
+ * public class EchoClientEcho {
+ *
+ *   public static void main(String[] args) {
+ *     echoClientEcho();
+ *   }
+ *
+ *   public static void echoClientEcho() {
+ *     try (EchoClient echoClient = EchoClient.create()) {
+ *       EchoResponse response = echoClient.echo();
+ *     }
+ *   }
  * }
  * }
* @@ -68,18 +79,42 @@ 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.showcase.v1beta1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class EchoClientcreate {
+ *
+ *   public static void main(String[] args) {
+ *     echoClientcreate();
+ *   }
+ *
+ *   public static void echoClientcreate() {
+ *     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.showcase.v1beta1;
+ *
+ * public class EchoClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) {
+ *     echoClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void echoClientClassHeaderEndpoint() {
+ *     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 +187,19 @@ public class EchoClient implements BackgroundResource { * Sample code: * *

{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   EchoResponse response = echoClient.echo();
+   * package com.google.showcase.v1beta1;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       EchoResponse response = echoClient.echo();
+   *     }
+   *   }
    * }
    * }
* @@ -170,9 +216,22 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.resourcenames.ResourceName;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       ResourceName parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
+   *       EchoResponse response = echoClient.echo(parent);
+   *     }
+   *   }
    * }
    * }
* @@ -190,9 +249,22 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.rpc.Status;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       Status error = Status.newBuilder().build();
+   *       EchoResponse response = echoClient.echo(error);
+   *     }
+   *   }
    * }
    * }
* @@ -209,9 +281,20 @@ 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.showcase.v1beta1;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       FoobarName name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
+   *       EchoResponse response = echoClient.echo(name);
+   *     }
+   *   }
    * }
    * }
* @@ -229,9 +312,20 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   String content = "content951530617";
-   *   EchoResponse response = echoClient.echo(content);
+   * package com.google.showcase.v1beta1;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       String content = "content951530617";
+   *       EchoResponse response = echoClient.echo(content);
+   *     }
+   *   }
    * }
    * }
* @@ -248,9 +342,20 @@ 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.showcase.v1beta1;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       String name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
+   *       EchoResponse response = echoClient.echo(name);
+   *     }
+   *   }
    * }
    * }
* @@ -267,9 +372,20 @@ 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.showcase.v1beta1;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       String parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
+   *       EchoResponse response = echoClient.echo(parent);
+   *     }
+   *   }
    * }
    * }
* @@ -286,10 +402,21 @@ 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.showcase.v1beta1;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       String content = "content951530617";
+   *       Severity severity = Severity.forNumber(0);
+   *       EchoResponse response = echoClient.echo(content, severity);
+   *     }
+   *   }
    * }
    * }
* @@ -308,15 +435,26 @@ 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.showcase.v1beta1;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() {
+   *     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 +470,30 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class EchoClientEcho {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientEcho();
+   *   }
+   *
+   *   public static void echoClientEcho() {
+   *     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 +506,25 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.gax.rpc.ServerStream;
+   *
+   * public class EchoClientExpand {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientExpand();
+   *   }
+   *
+   *   public static void echoClientExpand() {
+   *     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 +538,47 @@ 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.showcase.v1beta1;
    *
-   *         {@literal @}Override
-   *         public void onError(Throwable t) {
-   *           // Add error-handling
-   *         }
+   * import com.google.api.gax.rpc.ApiStreamObserver;
    *
-   *         {@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) {
+   *     echoClientCollect();
+   *   }
+   *
+   *   public static void echoClientCollect() {
+   *     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 +591,31 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.gax.rpc.BidiStream;
+   *
+   * public class EchoClientChat {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientChat();
+   *   }
+   *
+   *   public static void echoClientChat() {
+   *     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 +629,31 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.gax.rpc.BidiStream;
+   *
+   * public class EchoClientChatAgain {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientChatAgain();
+   *   }
+   *
+   *   public static void echoClientChatAgain() {
+   *     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 +667,26 @@ 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.showcase.v1beta1;
+   *
+   * public class EchoClientPagedExpand {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientPagedExpand();
+   *   }
+   *
+   *   public static void echoClientPagedExpand() {
+   *     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 +703,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();
-   *   ApiFuture future = echoClient.pagedExpandPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (EchoResponse element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class EchoClientPagedExpand {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientPagedExpand();
+   *   }
+   *
+   *   public static void echoClientPagedExpand() {
+   *     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 +741,36 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.common.base.Strings;
+   *
+   * public class EchoClientPagedExpand {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientPagedExpand();
+   *   }
+   *
+   *   public static void echoClientPagedExpand() {
+   *     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 +785,20 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * try (EchoClient echoClient = EchoClient.create()) {
-   *   for (EchoResponse element : echoClient.simplePagedExpand().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.showcase.v1beta1;
+   *
+   * public class EchoClientSimplePagedExpand {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientSimplePagedExpand();
+   *   }
+   *
+   *   public static void echoClientSimplePagedExpand() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       for (EchoResponse element : echoClient.simplePagedExpand().iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -565,15 +816,26 @@ 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.showcase.v1beta1;
+   *
+   * public class EchoClientSimplePagedExpand {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientSimplePagedExpand();
+   *   }
+   *
+   *   public static void echoClientSimplePagedExpand() {
+   *     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 +852,31 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class EchoClientSimplePagedExpand {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientSimplePagedExpand();
+   *   }
+   *
+   *   public static void echoClientSimplePagedExpand() {
+   *     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 +891,36 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.common.base.Strings;
+   *
+   * public class EchoClientSimplePagedExpand {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientSimplePagedExpand();
+   *   }
+   *
+   *   public static void echoClientSimplePagedExpand() {
+   *     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 +935,22 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.Duration;
+   *
+   * public class EchoClientWait {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientWait();
+   *   }
+   *
+   *   public static void echoClientWait() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       Duration ttl = Duration.newBuilder().build();
+   *       WaitResponse response = echoClient.waitAsync(ttl).get();
+   *     }
+   *   }
    * }
    * }
* @@ -666,9 +967,22 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.Timestamp;
+   *
+   * public class EchoClientWait {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientWait();
+   *   }
+   *
+   *   public static void echoClientWait() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       Timestamp endTime = Timestamp.newBuilder().build();
+   *       WaitResponse response = echoClient.waitAsync(endTime).get();
+   *     }
+   *   }
    * }
    * }
* @@ -685,9 +999,20 @@ 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.showcase.v1beta1;
+   *
+   * public class EchoClientWait {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientWait();
+   *   }
+   *
+   *   public static void echoClientWait() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       WaitRequest request = WaitRequest.newBuilder().build();
+   *       WaitResponse response = echoClient.waitAsync(request).get();
+   *     }
+   *   }
    * }
    * }
* @@ -703,12 +1028,25 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   *
+   * public class EchoClientWait {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientWait();
+   *   }
+   *
+   *   public static void echoClientWait() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       WaitRequest request = WaitRequest.newBuilder().build();
+   *       OperationFuture future =
+   *           echoClient.waitOperationCallable().futureCall(request);
+   *       // Do something.
+   *       WaitResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -721,11 +1059,25 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.longrunning.Operation;
+   *
+   * public class EchoClientWait {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientWait();
+   *   }
+   *
+   *   public static void echoClientWait() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       WaitRequest request = WaitRequest.newBuilder().build();
+   *       ApiFuture future = echoClient.waitCallable().futureCall(request);
+   *       // Do something.
+   *       Operation response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -738,9 +1090,20 @@ 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.showcase.v1beta1;
+   *
+   * public class EchoClientBlock {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientBlock();
+   *   }
+   *
+   *   public static void echoClientBlock() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       BlockRequest request = BlockRequest.newBuilder().build();
+   *       BlockResponse response = echoClient.block(request);
+   *     }
+   *   }
    * }
    * }
* @@ -756,11 +1119,24 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class EchoClientBlock {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientBlock();
+   *   }
+   *
+   *   public static void echoClientBlock() {
+   *     try (EchoClient echoClient = EchoClient.create()) {
+   *       BlockRequest request = BlockRequest.newBuilder().build();
+   *       ApiFuture future = echoClient.blockCallable().futureCall(request);
+   *       // Do something.
+   *       BlockResponse response = future.get();
+   *     }
+   *   }
    * }
    * }
*/ @@ -773,15 +1149,26 @@ 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.showcase.v1beta1;
+   *
+   * public class EchoClientCollideName {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientCollideName();
+   *   }
+   *
+   *   public static void echoClientCollideName() {
+   *     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 +1184,30 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class EchoClientCollideName {
+   *
+   *   public static void main(String[] args) {
+   *     echoClientCollideName();
+   *   }
+   *
+   *   public static void echoClientCollideName() {
+   *     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..0ead94fcf9 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,30 @@ 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.showcase.v1beta1;
+ *
+ * import java.time.Duration;
+ *
+ * public class EchoSettings {
+ *
+ *   public static void main(String[] args) {
+ *     echoSettings();
+ *   }
+ *
+ *   public static void echoSettings() {
+ *     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..0652dcdd1b 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,30 @@ 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.showcase.v1beta1.stub;
+ *
+ * import java.time.Duration;
+ *
+ * public class EchoSettings {
+ *
+ *   public static void main(String[] args) {
+ *     echoSettings();
+ *   }
+ *
+ *   public static void echoSettings() {
+ *     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..075b95773a 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,22 @@ 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.showcase.v1beta1;
+ *
+ * public class IdentityClientCreateUser {
+ *
+ *   public static void main(String[] args) {
+ *     identityClientCreateUser();
+ *   }
+ *
+ *   public static void identityClientCreateUser() {
+ *     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 +72,43 @@ 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.showcase.v1beta1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class IdentityClientcreate {
+ *
+ *   public static void main(String[] args) {
+ *     identityClientcreate();
+ *   }
+ *
+ *   public static void identityClientcreate() {
+ *     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.showcase.v1beta1;
+ *
+ * public class IdentityClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) {
+ *     identityClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void identityClientClassHeaderEndpoint() {
+ *     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 +170,22 @@ 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.showcase.v1beta1;
+   *
+   * public class IdentityClientCreateUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientCreateUser();
+   *   }
+   *
+   *   public static void identityClientCreateUser() {
+   *     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 +208,28 @@ 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.showcase.v1beta1;
+   *
+   * public class IdentityClientCreateUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientCreateUser();
+   *   }
+   *
+   *   public static void identityClientCreateUser() {
+   *     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 +271,40 @@ 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.showcase.v1beta1;
+   *
+   * public class IdentityClientCreateUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientCreateUser();
+   *   }
+   *
+   *   public static void identityClientCreateUser() {
+   *     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 +367,24 @@ 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.showcase.v1beta1;
+   *
+   * public class IdentityClientCreateUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientCreateUser();
+   *   }
+   *
+   *   public static void identityClientCreateUser() {
+   *     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 +400,28 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class IdentityClientCreateUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientCreateUser();
+   *   }
+   *
+   *   public static void identityClientCreateUser() {
+   *     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 +434,20 @@ 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.showcase.v1beta1;
+   *
+   * public class IdentityClientGetUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientGetUser();
+   *   }
+   *
+   *   public static void identityClientGetUser() {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       UserName name = UserName.of("[USER]");
+   *       User response = identityClient.getUser(name);
+   *     }
+   *   }
    * }
    * }
* @@ -362,9 +465,20 @@ 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.showcase.v1beta1;
+   *
+   * public class IdentityClientGetUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientGetUser();
+   *   }
+   *
+   *   public static void identityClientGetUser() {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       String name = UserName.of("[USER]").toString();
+   *       User response = identityClient.getUser(name);
+   *     }
+   *   }
    * }
    * }
* @@ -381,10 +495,21 @@ 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.showcase.v1beta1;
+   *
+   * public class IdentityClientGetUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientGetUser();
+   *   }
+   *
+   *   public static void identityClientGetUser() {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       GetUserRequest request =
+   *           GetUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
+   *       User response = identityClient.getUser(request);
+   *     }
+   *   }
    * }
    * }
* @@ -400,12 +525,25 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class IdentityClientGetUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientGetUser();
+   *   }
+   *
+   *   public static void identityClientGetUser() {
+   *     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 +556,21 @@ 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.showcase.v1beta1;
+   *
+   * public class IdentityClientUpdateUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientUpdateUser();
+   *   }
+   *
+   *   public static void identityClientUpdateUser() {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       UpdateUserRequest request =
+   *           UpdateUserRequest.newBuilder().setUser(User.newBuilder().build()).build();
+   *       User response = identityClient.updateUser(request);
+   *     }
+   *   }
    * }
    * }
* @@ -437,12 +586,25 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class IdentityClientUpdateUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientUpdateUser();
+   *   }
+   *
+   *   public static void identityClientUpdateUser() {
+   *     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 +617,22 @@ public class IdentityClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (IdentityClient identityClient = IdentityClient.create()) {
-   *   UserName name = UserName.of("[USER]");
-   *   identityClient.deleteUser(name);
+   * package com.google.showcase.v1beta1;
+   *
+   * import com.google.protobuf.Empty;
+   *
+   * public class IdentityClientDeleteUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientDeleteUser();
+   *   }
+   *
+   *   public static void identityClientDeleteUser() {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       UserName name = UserName.of("[USER]");
+   *       identityClient.deleteUser(name);
+   *     }
+   *   }
    * }
    * }
* @@ -475,9 +650,22 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.Empty;
+   *
+   * public class IdentityClientDeleteUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientDeleteUser();
+   *   }
+   *
+   *   public static void identityClientDeleteUser() {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       String name = UserName.of("[USER]").toString();
+   *       identityClient.deleteUser(name);
+   *     }
+   *   }
    * }
    * }
* @@ -494,10 +682,23 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.Empty;
+   *
+   * public class IdentityClientDeleteUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientDeleteUser();
+   *   }
+   *
+   *   public static void identityClientDeleteUser() {
+   *     try (IdentityClient identityClient = IdentityClient.create()) {
+   *       DeleteUserRequest request =
+   *           DeleteUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
+   *       identityClient.deleteUser(request);
+   *     }
+   *   }
    * }
    * }
* @@ -513,12 +714,26 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.protobuf.Empty;
+   *
+   * public class IdentityClientDeleteUser {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientDeleteUser();
+   *   }
+   *
+   *   public static void identityClientDeleteUser() {
+   *     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 +746,25 @@ 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.showcase.v1beta1;
+   *
+   * public class IdentityClientListUsers {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientListUsers();
+   *   }
+   *
+   *   public static void identityClientListUsers() {
+   *     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 +781,29 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class IdentityClientListUsers {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientListUsers();
+   *   }
+   *
+   *   public static void identityClientListUsers() {
+   *     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 +817,35 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.common.base.Strings;
+   *
+   * public class IdentityClientListUsers {
+   *
+   *   public static void main(String[] args) {
+   *     identityClientListUsers();
+   *   }
+   *
+   *   public static void identityClientListUsers() {
+   *     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..98afc95f90 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,31 @@ 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.logging.v2.stub;
+ *
+ * import java.time.Duration;
+ *
+ * public class LoggingServiceV2Settings {
+ *
+ *   public static void main(String[] args) {
+ *     loggingServiceV2Settings();
+ *   }
+ *
+ *   public static void loggingServiceV2Settings() {
+ *     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..2f62eb856a 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,21 @@ 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.showcase.v1beta1;
+ *
+ * public class MessagingClientCreateRoom {
+ *
+ *   public static void main(String[] args) {
+ *     messagingClientCreateRoom();
+ *   }
+ *
+ *   public static void messagingClientCreateRoom() {
+ *     try (MessagingClient messagingClient = MessagingClient.create()) {
+ *       String displayName = "displayName1714148973";
+ *       String description = "description-1724546052";
+ *       Room response = messagingClient.createRoom(displayName, description);
+ *     }
+ *   }
  * }
  * }
* @@ -68,19 +79,43 @@ 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.showcase.v1beta1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class MessagingClientcreate {
+ *
+ *   public static void main(String[] args) {
+ *     messagingClientcreate();
+ *   }
+ *
+ *   public static void messagingClientcreate() {
+ *     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.showcase.v1beta1;
+ *
+ * public class MessagingClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) {
+ *     messagingClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void messagingClientClassHeaderEndpoint() {
+ *     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 +188,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientCreateRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientCreateRoom();
+   *   }
+   *
+   *   public static void messagingClientCreateRoom() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String displayName = "displayName1714148973";
+   *       String description = "description-1724546052";
+   *       Room response = messagingClient.createRoom(displayName, description);
+   *     }
+   *   }
    * }
    * }
* @@ -178,10 +224,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientCreateRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientCreateRoom();
+   *   }
+   *
+   *   public static void messagingClientCreateRoom() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       CreateRoomRequest request =
+   *           CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
+   *       Room response = messagingClient.createRoom(request);
+   *     }
+   *   }
    * }
    * }
* @@ -197,12 +254,25 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class MessagingClientCreateRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientCreateRoom();
+   *   }
+   *
+   *   public static void messagingClientCreateRoom() {
+   *     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 +285,20 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientGetRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientGetRoom();
+   *   }
+   *
+   *   public static void messagingClientGetRoom() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       RoomName name = RoomName.of("[ROOM]");
+   *       Room response = messagingClient.getRoom(name);
+   *     }
+   *   }
    * }
    * }
* @@ -235,9 +316,20 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientGetRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientGetRoom();
+   *   }
+   *
+   *   public static void messagingClientGetRoom() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String name = RoomName.of("[ROOM]").toString();
+   *       Room response = messagingClient.getRoom(name);
+   *     }
+   *   }
    * }
    * }
* @@ -254,10 +346,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientGetRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientGetRoom();
+   *   }
+   *
+   *   public static void messagingClientGetRoom() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       GetRoomRequest request =
+   *           GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
+   *       Room response = messagingClient.getRoom(request);
+   *     }
+   *   }
    * }
    * }
* @@ -273,12 +376,25 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class MessagingClientGetRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientGetRoom();
+   *   }
+   *
+   *   public static void messagingClientGetRoom() {
+   *     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 +407,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientUpdateRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientUpdateRoom();
+   *   }
+   *
+   *   public static void messagingClientUpdateRoom() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       UpdateRoomRequest request =
+   *           UpdateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
+   *       Room response = messagingClient.updateRoom(request);
+   *     }
+   *   }
    * }
    * }
* @@ -310,12 +437,25 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class MessagingClientUpdateRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientUpdateRoom();
+   *   }
+   *
+   *   public static void messagingClientUpdateRoom() {
+   *     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 +468,22 @@ public class MessagingClient implements BackgroundResource { * Sample code: * *
{@code
-   * try (MessagingClient messagingClient = MessagingClient.create()) {
-   *   RoomName name = RoomName.of("[ROOM]");
-   *   messagingClient.deleteRoom(name);
+   * package com.google.showcase.v1beta1;
+   *
+   * import com.google.protobuf.Empty;
+   *
+   * public class MessagingClientDeleteRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientDeleteRoom();
+   *   }
+   *
+   *   public static void messagingClientDeleteRoom() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       RoomName name = RoomName.of("[ROOM]");
+   *       messagingClient.deleteRoom(name);
+   *     }
+   *   }
    * }
    * }
* @@ -348,9 +501,22 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.Empty;
+   *
+   * public class MessagingClientDeleteRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientDeleteRoom();
+   *   }
+   *
+   *   public static void messagingClientDeleteRoom() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String name = RoomName.of("[ROOM]").toString();
+   *       messagingClient.deleteRoom(name);
+   *     }
+   *   }
    * }
    * }
* @@ -367,10 +533,23 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.Empty;
+   *
+   * public class MessagingClientDeleteRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientDeleteRoom();
+   *   }
+   *
+   *   public static void messagingClientDeleteRoom() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       DeleteRoomRequest request =
+   *           DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
+   *       messagingClient.deleteRoom(request);
+   *     }
+   *   }
    * }
    * }
* @@ -386,12 +565,26 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.protobuf.Empty;
+   *
+   * public class MessagingClientDeleteRoom {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientDeleteRoom();
+   *   }
+   *
+   *   public static void messagingClientDeleteRoom() {
+   *     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 +597,25 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientListRooms {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientListRooms();
+   *   }
+   *
+   *   public static void messagingClientListRooms() {
+   *     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 +632,29 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class MessagingClientListRooms {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientListRooms();
+   *   }
+   *
+   *   public static void messagingClientListRooms() {
+   *     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 +668,35 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.common.base.Strings;
+   *
+   * public class MessagingClientListRooms {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientListRooms();
+   *   }
+   *
+   *   public static void messagingClientListRooms() {
+   *     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 +711,23 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.ByteString;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ProfileName parent = ProfileName.of("[USER]");
+   *       ByteString image = ByteString.EMPTY;
+   *       Blurb response = messagingClient.createBlurb(parent, image);
+   *     }
+   *   }
    * }
    * }
* @@ -506,10 +749,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ProfileName parent = ProfileName.of("[USER]");
+   *       String text = "text3556653";
+   *       Blurb response = messagingClient.createBlurb(parent, text);
+   *     }
+   *   }
    * }
    * }
* @@ -531,10 +785,23 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.ByteString;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       RoomName parent = RoomName.of("[ROOM]");
+   *       ByteString image = ByteString.EMPTY;
+   *       Blurb response = messagingClient.createBlurb(parent, image);
+   *     }
+   *   }
    * }
    * }
* @@ -556,10 +823,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       RoomName parent = RoomName.of("[ROOM]");
+   *       String text = "text3556653";
+   *       Blurb response = messagingClient.createBlurb(parent, text);
+   *     }
+   *   }
    * }
    * }
* @@ -581,10 +859,23 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.ByteString;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String parent = ProfileName.of("[USER]").toString();
+   *       ByteString image = ByteString.EMPTY;
+   *       Blurb response = messagingClient.createBlurb(parent, image);
+   *     }
+   *   }
    * }
    * }
* @@ -606,10 +897,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String parent = ProfileName.of("[USER]").toString();
+   *       String text = "text3556653";
+   *       Blurb response = messagingClient.createBlurb(parent, text);
+   *     }
+   *   }
    * }
    * }
* @@ -631,13 +933,24 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() {
+   *     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 +966,28 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class MessagingClientCreateBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientCreateBlurb();
+   *   }
+   *
+   *   public static void messagingClientCreateBlurb() {
+   *     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 +1000,20 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientGetBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientGetBlurb();
+   *   }
+   *
+   *   public static void messagingClientGetBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       BlurbName name = BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]");
+   *       Blurb response = messagingClient.getBlurb(name);
+   *     }
+   *   }
    * }
    * }
* @@ -694,10 +1031,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientGetBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientGetBlurb();
+   *   }
+   *
+   *   public static void messagingClientGetBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String name =
+   *           BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
+   *       Blurb response = messagingClient.getBlurb(name);
+   *     }
+   *   }
    * }
    * }
* @@ -714,14 +1062,25 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientGetBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientGetBlurb();
+   *   }
+   *
+   *   public static void messagingClientGetBlurb() {
+   *     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 +1096,29 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class MessagingClientGetBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientGetBlurb();
+   *   }
+   *
+   *   public static void messagingClientGetBlurb() {
+   *     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 +1131,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientUpdateBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientUpdateBlurb();
+   *   }
+   *
+   *   public static void messagingClientUpdateBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       UpdateBlurbRequest request =
+   *           UpdateBlurbRequest.newBuilder().setBlurb(Blurb.newBuilder().build()).build();
+   *       Blurb response = messagingClient.updateBlurb(request);
+   *     }
+   *   }
    * }
    * }
* @@ -778,12 +1161,25 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class MessagingClientUpdateBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientUpdateBlurb();
+   *   }
+   *
+   *   public static void messagingClientUpdateBlurb() {
+   *     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 +1192,22 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.Empty;
+   *
+   * public class MessagingClientDeleteBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientDeleteBlurb();
+   *   }
+   *
+   *   public static void messagingClientDeleteBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       BlurbName name = BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]");
+   *       messagingClient.deleteBlurb(name);
+   *     }
+   *   }
    * }
    * }
* @@ -816,10 +1225,23 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.Empty;
+   *
+   * public class MessagingClientDeleteBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientDeleteBlurb();
+   *   }
+   *
+   *   public static void messagingClientDeleteBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String name =
+   *           BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
+   *       messagingClient.deleteBlurb(name);
+   *     }
+   *   }
    * }
    * }
* @@ -836,14 +1258,27 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.protobuf.Empty;
+   *
+   * public class MessagingClientDeleteBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientDeleteBlurb();
+   *   }
+   *
+   *   public static void messagingClientDeleteBlurb() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       DeleteBlurbRequest request =
+   *           DeleteBlurbRequest.newBuilder()
+   *               .setName(
+   *                   BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
+   *                       .toString())
+   *               .build();
+   *       messagingClient.deleteBlurb(request);
+   *     }
+   *   }
    * }
    * }
* @@ -859,16 +1294,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();
-   *   ApiFuture future = messagingClient.deleteBlurbCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
+   * package com.google.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.protobuf.Empty;
+   *
+   * public class MessagingClientDeleteBlurb {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientDeleteBlurb();
+   *   }
+   *
+   *   public static void messagingClientDeleteBlurb() {
+   *     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 +1330,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       ProfileName parent = ProfileName.of("[USER]");
+   *       for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -903,10 +1363,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       RoomName parent = RoomName.of("[ROOM]");
+   *       for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -925,10 +1396,21 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String parent = ProfileName.of("[USER]").toString();
+   *       for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
+   *         // doThingsWith(element);
+   *       }
+   *     }
    *   }
    * }
    * }
@@ -946,15 +1428,26 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() {
+   *     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 +1464,30 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() {
+   *     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 +1501,36 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.common.base.Strings;
+   *
+   * public class MessagingClientListBlurbs {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientListBlurbs();
+   *   }
+   *
+   *   public static void messagingClientListBlurbs() {
+   *     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 +1545,20 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientSearchBlurbs {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientSearchBlurbs();
+   *   }
+   *
+   *   public static void messagingClientSearchBlurbs() {
+   *     try (MessagingClient messagingClient = MessagingClient.create()) {
+   *       String query = "query107944136";
+   *       SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(query).get();
+   *     }
+   *   }
    * }
    * }
* @@ -1046,15 +1576,26 @@ 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.showcase.v1beta1;
+   *
+   * public class MessagingClientSearchBlurbs {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientSearchBlurbs();
+   *   }
+   *
+   *   public static void messagingClientSearchBlurbs() {
+   *     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 +1612,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();
-   *   OperationFuture future =
-   *       messagingClient.searchBlurbsOperationCallable().futureCall(request);
-   *   // Do something.
-   *   SearchBlurbsResponse response = future.get();
+   * package com.google.showcase.v1beta1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   *
+   * public class MessagingClientSearchBlurbs {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientSearchBlurbs();
+   *   }
+   *
+   *   public static void messagingClientSearchBlurbs() {
+   *     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 +1650,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();
-   *   ApiFuture future = messagingClient.searchBlurbsCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.showcase.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * import com.google.longrunning.Operation;
+   *
+   * public class MessagingClientSearchBlurbs {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientSearchBlurbs();
+   *   }
+   *
+   *   public static void messagingClientSearchBlurbs() {
+   *     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 +1687,26 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.gax.rpc.ServerStream;
+   *
+   * public class MessagingClientStreamBlurbs {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientStreamBlurbs();
+   *   }
+   *
+   *   public static void messagingClientStreamBlurbs() {
+   *     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 +1721,45 @@ 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.showcase.v1beta1;
    *
-   *         {@literal @}Override
-   *         public void onError(Throwable t) {
-   *           // Add error-handling
-   *         }
+   * import com.google.api.gax.rpc.ApiStreamObserver;
    *
-   *         {@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) {
+   *     messagingClientSendBlurbs();
+   *   }
+   *
+   *   public static void messagingClientSendBlurbs() {
+   *     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 +1773,26 @@ 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.showcase.v1beta1;
+   *
+   * import com.google.api.gax.rpc.BidiStream;
+   *
+   * public class MessagingClientConnect {
+   *
+   *   public static void main(String[] args) {
+   *     messagingClientConnect();
+   *   }
+   *
+   *   public static void messagingClientConnect() {
+   *     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..9ef94a138d 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,30 @@ 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.pubsub.v1.stub;
+ *
+ * import java.time.Duration;
+ *
+ * public class PublisherSettings {
+ *
+ *   public static void main(String[] args) {
+ *     publisherSettings();
+ *   }
+ *
+ *   public static void publisherSettings() {
+ *     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..d04708e77a 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,30 @@ 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.showcase.v1beta1;
+ *
+ * import java.time.Duration;
+ *
+ * public class ComplianceSettings {
+ *
+ *   public static void main(String[] args) {
+ *     complianceSettings();
+ *   }
+ *
+ *   public static void complianceSettings() {
+ *     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..8eda353745 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,30 @@ 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.showcase.v1beta1.stub;
+ *
+ * import java.time.Duration;
+ *
+ * public class ComplianceSettings {
+ *
+ *   public static void main(String[] args) {
+ *     complianceSettings();
+ *   }
+ *
+ *   public static void complianceSettings() {
+ *     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/ExecutableSampleComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposerTest.java index 4754016fac..3ae6f8da91 100644 --- 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 @@ -16,8 +16,9 @@ public void createExecutableSampleEmptySample() { String packageName = "com.google.example"; String sampleMethodName = "echoClientWait"; - String sampleResult = ExecutableSampleComposer.createExecutableSample(packageName, sampleMethodName, - new ArrayList<>(), new ArrayList<>(), new ArrayList<>()); + ExecutableSample executableSample = new ExecutableSample(packageName, sampleMethodName, + new ArrayList<>(), new ArrayList<>()); + String sampleResult = ExecutableSampleComposer.createExecutableSample(executableSample); String expected = LineFormatter.lines( @@ -39,12 +40,11 @@ public void createExecutableSampleEmptySample() { public void createExecutableSampleMethodArgsNoVar() { String packageName = "com.google.example"; String sampleMethodName = "echoClientWait"; - Statement sampleBody = ExprStatement.withExpr(SampleUtil.systemOutPrint("Testing " + sampleMethodName)); + ExecutableSample executableSample = new ExecutableSample(packageName, sampleMethodName, + new ArrayList<>(), ImmutableList.of(sampleBody)); - String sampleResult = ExecutableSampleComposer.createExecutableSample(packageName, sampleMethodName, - new ArrayList<>(), ImmutableList.of(sampleBody), new ArrayList<>()); - + String sampleResult = ExecutableSampleComposer.createExecutableSample(executableSample); String expected = LineFormatter.lines( "package com.google.example;\n", @@ -69,17 +69,15 @@ 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(packageName, sampleMethodName, + ImmutableList.of(varAssignment), ImmutableList.of(sampleBody)); - String sampleResult = ExecutableSampleComposer.createExecutableSample(packageName, sampleMethodName, - ImmutableList.of(varAssignment), ImmutableList.of(sampleBody), ImmutableList.of(variableExpr)); - + String sampleResult = ExecutableSampleComposer.createExecutableSample(executableSample); String expected = LineFormatter.lines( "package com.google.example;\n", @@ -115,14 +113,12 @@ public void createExecutableSampleMethodMultipleStatements() { .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(packageName, sampleMethodName, + ImmutableList.of(varAssignment, varAssignment2), ImmutableList.of(bodyStatement, bodyStatement2)); - String sampleResult = ExecutableSampleComposer.createExecutableSample(packageName, sampleMethodName, - ImmutableList.of(varAssignment, varAssignment2), ImmutableList.of(bodyStatement, bodyStatement2), - ImmutableList.of(variableExpr, variableExpr2)); - + String sampleResult = ExecutableSampleComposer.createExecutableSample(executableSample); String expected = LineFormatter.lines( "package com.google.example;\n", 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..ad81d0f4b7 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,20 @@ 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.showcase.v1beta1;\n", + "\n", + "public class EchoClientEcho {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientEcho();\n", + " }\n", + "\n", + " public static void echoClientEcho() {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " EchoResponse response = echoClient.echo();\n", + " }\n", + " }\n", + "}\n"); assertEquals(expected, results); } @@ -152,11 +164,24 @@ 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.showcase.v1beta1;\n", + "\n", + "import com.google.protobuf.Duration;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() {\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 +230,28 @@ 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.showcase.v1beta1;\n", + "\n", + "public class EchoClientEcho {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientEcho();\n", + " }\n", + "\n", + " public static void echoClientEcho() {\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 +300,28 @@ 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", - " }\n", - "}"); - assertEquals(results, expected); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.rpc.ServerStream;\n", + "\n", + "public class EchoClientExpand {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientExpand();\n", + " }\n", + "\n", + " public static void echoClientExpand() {\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 +339,28 @@ 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.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.core.FixedCredentialsProvider;\n", + "\n", + "public class EchoClientcreate {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientcreate();\n", + " }\n", + "\n", + " public static void echoClientcreate() {\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 +379,23 @@ 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.showcase.v1beta1;\n", + "\n", + "public class EchoClientClassHeaderEndpoint {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientClassHeaderEndpoint();\n", + " }\n", + "\n", + " public static void echoClientClassHeaderEndpoint() {\n", + " EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();\n", + " EchoClient echoClient = EchoClient.create(echoSettings);\n", + " }\n", + "}\n"); assertEquals(expected, results); } @@ -951,7 +1020,7 @@ public void validComposeRpcMethodHeaderSampleCode_pureUnaryRpcWithMethodReturnVo " String name = \"name3373707\";\n", " echoClient.delete(name);\n", "}"); - assertEquals(results, expected); + assertEquals(expected, results); } */ @@ -1036,19 +1105,32 @@ 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", - " }\n", - "}"); - assertEquals(results, expected); + "package com.google.showcase.v1beta1;\n", + "\n", + "import java.util.ArrayList;\n", + "import java.util.List;\n", + "\n", + "public class EchoClientListContent {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientListContent();\n", + " }\n", + "\n", + " public static void echoClientListContent() {\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 +1191,27 @@ 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", - " }\n", - "}"); - assertEquals(results, expected); + "package com.google.showcase.v1beta1;\n", + "\n", + "public class EchoClientListContent {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientListContent();\n", + " }\n", + "\n", + " public static void echoClientListContent() {\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 +1362,25 @@ 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.showcase.v1beta1;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() {\n", + " try (EchoClient echoClient = EchoClient.create()) {\n", + " WaitResponse response = echoClient.waitAsync().get();\n", + " }\n", + " }\n", + "}\n"); + assertEquals(expected, results); } @Test @@ -1342,15 +1446,28 @@ 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.showcase.v1beta1;\n", + "\n", + "import com.google.protobuf.Duration;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() {\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 +1530,29 @@ 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.showcase.v1beta1;\n", + "\n", + "import com.google.protobuf.Duration;\n", + "import com.google.protobuf.Empty;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() {\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 +1588,33 @@ 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", - " }\n", - "}"); - assertEquals(results, expected); + "package com.google.showcase.v1beta1;\n", + "\n", + "public class EchoClientPagedExpand {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientPagedExpand();\n", + " }\n", + "\n", + " public static void echoClientPagedExpand() {\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 +1698,28 @@ 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.showcase.v1beta1;\n", + "\n", + "import com.google.protobuf.Empty;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() {\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 +1768,26 @@ 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.showcase.v1beta1;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() {\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 +1818,34 @@ 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.showcase.v1beta1;\n", + "\n", + "import com.google.protobuf.Empty;\n", + "\n", + "public class EchoClientEcho {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientEcho();\n", + " }\n", + "\n", + " public static void echoClientEcho() {\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 +1879,32 @@ 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.showcase.v1beta1;\n", + "\n", + "public class EchoClientEcho {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientEcho();\n", + " }\n", + "\n", + " public static void echoClientEcho() {\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 +1953,31 @@ 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.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.longrunning.OperationFuture;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() {\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 +2022,32 @@ 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.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.longrunning.OperationFuture;\n", + "import com.google.protobuf.Empty;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() {\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 +2082,37 @@ 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", - " }\n", - "}"); - assertEquals(results, expected); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.core.ApiFuture;\n", + "\n", + "public class EchoClientPagedExpand {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientPagedExpand();\n", + " }\n", + "\n", + " public static void echoClientPagedExpand() {\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 +2272,32 @@ 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", - " }\n", - "}"); - assertEquals(results, expected); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.rpc.ServerStream;\n", + "\n", + "public class EchoClientExpand {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientExpand();\n", + " }\n", + "\n", + " public static void echoClientExpand() {\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 +2368,38 @@ 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", - " }\n", - "}"); - assertEquals(results, expected); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.rpc.BidiStream;\n", + "\n", + "public class EchoClientchat {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientchat();\n", + " }\n", + "\n", + " public static void echoClientchat() {\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 +2470,53 @@ 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.showcase.v1beta1;\n", "\n", - " {@literal @}Override\n", - " public void onError(Throwable t) {\n", - " // Add error-handling\n", - " }\n", + "import com.google.api.gax.rpc.ApiStreamObserver;\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) {\n", + " echoClientCollect();\n", + " }\n", + "\n", + " public static void echoClientCollect() {\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 +2583,36 @@ 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.showcase.v1beta1;\n", + "\n", + "import com.google.api.core.ApiFuture;\n", + "\n", + "public class EchoClientEcho {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientEcho();\n", + " }\n", + "\n", + " public static void echoClientEcho() {\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 +2660,31 @@ 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.showcase.v1beta1;\n", + "\n", + "import com.google.api.core.ApiFuture;\n", + "import com.google.longrunning.Operation;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() {\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 +2729,31 @@ 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.showcase.v1beta1;\n", + "\n", + "import com.google.api.core.ApiFuture;\n", + "import com.google.longrunning.Operation;\n", + "\n", + "public class EchoClientWait {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientWait();\n", + " }\n", + "\n", + " public static void echoClientWait() {\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 +2788,44 @@ 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", - " }\n", - " }\n", - "}"); - assertEquals(results, expected); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.common.base.Strings;\n", + "\n", + "public class EchoClientPagedExpand {\n", + "\n", + " public static void main(String[] args) {\n", + " echoClientPagedExpand();\n", + " }\n", + "\n", + " public static void echoClientPagedExpand() {\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", + "}\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..b3dddca75e 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,8 @@ 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()); } @@ -44,23 +45,36 @@ public void composeSettingsSampleCode_serviceSettingsClass() { .setName("EchoSettings") .setPakkage("com.google.showcase.v1beta1") .build()); - Optional results = - SettingsSampleCodeComposer.composeSampleCode( - Optional.of("Echo"), "EchoSettings", classType); + Optional results = 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.showcase.v1beta1;\n", + "\n", + "import java.time.Duration;\n", + "\n", + "public class EchoSettings {\n", + "\n", + " public static void main(String[] args) {\n", + " echoSettings();\n", + " }\n", + "\n", + " public static void echoSettings() {\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 +86,34 @@ 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.showcase.v1beta1;\n", + "\n", + "import java.time.Duration;\n", + "\n", + "public class EchoSettings {\n", + "\n", + " public static void main(String[] args) {\n", + " echoSettings();\n", + " }\n", + "\n", + " public static void echoSettings() {\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()); } } From cc25bb88595d210ca7ddd7a481f5525943bfcfc8 Mon Sep 17 00:00:00 2001 From: Emily Ball Date: Tue, 30 Nov 2021 13:03:23 -0800 Subject: [PATCH 03/13] chore: include license headers --- .../composer/samplecode/ExecutableSample.java | 14 ++++++++++++++ .../samplecode/ExecutableSampleComposer.java | 14 ++++++++++++++ .../gapic/composer/samplecode/SampleUtil.java | 14 ++++++++++++++ .../samplecode/ExecutableSampleComposerTest.java | 14 ++++++++++++++ 4 files changed, 56 insertions(+) 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 index bc437bf89d..b99f7f4371 100644 --- 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 @@ -1,3 +1,17 @@ +// 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; 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 index f96475495d..17846fae36 100644 --- 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 @@ -1,3 +1,17 @@ +// 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.*; 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 index 666d0e5662..4d163f4823 100644 --- 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 @@ -1,3 +1,17 @@ +// 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.*; 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 index 3ae6f8da91..249f1acb99 100644 --- 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 @@ -1,3 +1,17 @@ +// 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.*; From 23665b2836c694bcde0f36f4bc8d202f5921a336 Mon Sep 17 00:00:00 2001 From: Emily Ball Date: Tue, 30 Nov 2021 14:59:44 -0800 Subject: [PATCH 04/13] tests + cleanup --- .../composer/samplecode/SampleCodeWriter.java | 8 ++ .../gapic/composer/samplecode/SampleUtil.java | 31 +++--- .../gapic/composer/samplecode/BUILD.bazel | 1 + .../samplecode/SampleCodeWriterTest.java | 98 +++++++++++++++---- .../composer/samplecode/SampleUtilTest.java | 83 ++++++++++++++++ .../ServiceClientSampleCodeComposerTest.java | 12 +-- 6 files changed, 191 insertions(+), 42 deletions(-) create mode 100644 src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleUtilTest.java 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 3ccc825e13..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 @@ -15,6 +15,7 @@ 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; @@ -42,4 +43,11 @@ public static String write(ClassDefinition classDefinition) { // 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
index 4d163f4823..4f13fa7e4a 100644
--- 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
@@ -18,28 +18,29 @@
 import com.google.api.generator.gapic.utils.JavaStyle;
 
 public class SampleUtil {
-    static MethodInvocationExpr systemOutPrint(String content){
-        VaporReference out = VaporReference.builder()
-                .setSupertypeReference(ConcreteReference.withClazz(System.class))
-                .setEnclosingClassNames("System").setName("out").setPakkage("java.lang").build();
-        return MethodInvocationExpr.builder()
-                .setStaticReferenceType(TypeNode.withReference(out))
-                .setMethodName("println")
-                .setArguments(ValueExpr.withValue(StringObjectValue.withValue(content)))
-                .build();
+    public static String composeSampleMethodName(String clientName, String methodName){
+        if (clientName.equals("") || methodName.equals("")) {
+            throw new IllegalArgumentException("clientName and methodName must exist");
+        }
+        return JavaStyle.toLowerCamelCase(clientName + JavaStyle.toUpperCamelCase(methodName));
     }
-    static MethodInvocationExpr systemOutPrint(VariableExpr variableExpr){
+
+    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());
+    }
+
+    static MethodInvocationExpr composeSystemOutPrint(Expr content){
         VaporReference out = VaporReference.builder()
                 .setSupertypeReference(ConcreteReference.withClazz(System.class))
                 .setEnclosingClassNames("System").setName("out").setPakkage("java.lang").build();
         return MethodInvocationExpr.builder()
                 .setStaticReferenceType(TypeNode.withReference(out))
                 .setMethodName("println")
-                .setArguments(variableExpr.toBuilder().setIsDecl(false).build())
+                .setArguments(content)
                 .build();
     }
-
-    static String composeSampleMethodName(String clientName, String methodName){
-        return JavaStyle.toLowerCamelCase(clientName + methodName);
-    }
 }
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 0f1df84aa0..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
@@ -8,6 +8,7 @@ TESTS = [
     "ServiceClientSampleCodeComposerTest",
     "SettingsSampleCodeComposerTest",
     "ExecutableSampleComposerTest",
+    "SampleUtilTest",
 ]
 
 filegroup(
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..e0495a4211 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
@@ -14,31 +14,31 @@
 
 package com.google.api.generator.gapic.composer.samplecode;
 
-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 java.util.Arrays;
+import com.google.api.generator.engine.ast.*;
+import com.google.api.generator.testutils.LineFormatter;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
+import java.util.Arrays;
+
+import static junit.framework.TestCase.assertEquals;
+
 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 +48,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 +98,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..64a24760bc
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleUtilTest.java
@@ -0,0 +1,83 @@
+// 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.*;
+import org.junit.Test;
+
+import java.util.UUID;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
+
+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 ad81d0f4b7..3f024b455a 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
@@ -347,13 +347,13 @@ public void composeClassHeaderCredentialsSampleCode() {
           "\n",
           "import com.google.api.gax.core.FixedCredentialsProvider;\n",
           "\n",
-          "public class EchoClientcreate {\n",
+          "public class EchoClientCreate {\n",
           "\n",
           "  public static void main(String[] args) {\n",
-          "    echoClientcreate();\n",
+          "    echoClientCreate();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientcreate() {\n",
+          "  public static void echoClientCreate() {\n",
           "    EchoSettings echoSettings =\n",
           "        EchoSettings.newBuilder()\n",
           "            .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))\n",
@@ -2376,13 +2376,13 @@ public void validComposeStreamCallableMethodHeaderSampleCode_bidiStream() {
           "\n",
           "import com.google.api.gax.rpc.BidiStream;\n",
           "\n",
-          "public class EchoClientchat {\n",
+          "public class EchoClientChat {\n",
           "\n",
           "  public static void main(String[] args) {\n",
-          "    echoClientchat();\n",
+          "    echoClientChat();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientchat() {\n",
+          "  public static void echoClientChat() {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      BidiStream bidiStream = echoClient.chatCallable().call();\n",
           "      EchoRequest request =\n",

From 98460131e0ecf6bc80e3ba275c125cfe00e3b184 Mon Sep 17 00:00:00 2001
From: Emily Ball 
Date: Tue, 30 Nov 2021 15:58:41 -0800
Subject: [PATCH 05/13] include generic exceptions

---
 .../samplecode/ExecutableSampleComposer.java  |   4 +-
 .../grpc/goldens/BookshopClient.golden        |  32 +--
 .../goldens/DeprecatedServiceClient.golden    |  32 +--
 .../goldens/DeprecatedServiceSettings.golden  |   4 +-
 .../DeprecatedServiceStubSettings.golden      |   4 +-
 .../composer/grpc/goldens/EchoClient.golden   | 136 ++++++------
 .../composer/grpc/goldens/EchoSettings.golden |   4 +-
 .../grpc/goldens/EchoStubSettings.golden      |   4 +-
 .../grpc/goldens/IdentityClient.golden        |  88 ++++----
 .../LoggingServiceV2StubSettings.golden       |   4 +-
 .../grpc/goldens/MessagingClient.golden       | 204 +++++++++---------
 .../grpc/goldens/PublisherStubSettings.golden |   4 +-
 .../rest/goldens/ComplianceSettings.golden    |   4 +-
 .../goldens/ComplianceStubSettings.golden     |   4 +-
 .../ExecutableSampleComposerTest.java         |  16 +-
 .../ServiceClientSampleCodeComposerTest.java  | 104 ++++-----
 .../SettingsSampleCodeComposerTest.java       |   8 +-
 17 files changed, 329 insertions(+), 327 deletions(-)

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
index 17846fae36..798496f0f2 100644
--- 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
@@ -19,12 +19,12 @@
 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 {
-    // TODO: exceptions
     public static String createExecutableSample(ExecutableSample executableSample){
         return SampleCodeWriter.write(
                 composeExecutableSample(executableSample.samplePackageName, executableSample.sampleMethodName,
@@ -102,6 +102,7 @@ static MethodDefinition composeMainMethod(List mainBody){
                         .setVariable(Variable.builder().setType(TypeNode.STRING_ARRAY).setName("args").build())
                         .setIsDecl(true)
                         .build())
+                .setThrowsExceptions(Arrays.asList(TypeNode.withExceptionClazz(Exception.class)))
                 .setBody(mainBody)
                 .build();
     }
@@ -114,6 +115,7 @@ static MethodDefinition composeSampleMethod(String sampleMethodName, List books = new ArrayList<>();
@@ -70,13 +70,13 @@ import javax.annotation.Generated;
  *
  * import com.google.api.gax.core.FixedCredentialsProvider;
  *
- * public class BookshopClientcreate {
+ * public class BookshopClientCreate {
  *
- *   public static void main(String[] args) {
- *     bookshopClientcreate();
+ *   public static void main(String[] args) throws Exception {
+ *     bookshopClientCreate();
  *   }
  *
- *   public static void bookshopClientcreate() {
+ *   public static void bookshopClientCreate() throws Exception {
  *     BookshopSettings bookshopSettings =
  *         BookshopSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -93,11 +93,11 @@ import javax.annotation.Generated;
  *
  * public class BookshopClientClassHeaderEndpoint {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     bookshopClientClassHeaderEndpoint();
  *   }
  *
- *   public static void bookshopClientClassHeaderEndpoint() {
+ *   public static void bookshopClientClassHeaderEndpoint() throws Exception {
  *     BookshopSettings bookshopSettings =
  *         BookshopSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     BookshopClient bookshopClient = BookshopClient.create(bookshopSettings);
@@ -171,11 +171,11 @@ public class BookshopClient implements BackgroundResource {
    *
    * public class BookshopClientGetBook {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     bookshopClientGetBook();
    *   }
    *
-   *   public static void bookshopClientGetBook() {
+   *   public static void bookshopClientGetBook() throws Exception {
    *     try (BookshopClient bookshopClient = BookshopClient.create()) {
    *       int booksCount = 1618425911;
    *       List books = new ArrayList<>();
@@ -207,11 +207,11 @@ public class BookshopClient implements BackgroundResource {
    *
    * public class BookshopClientGetBook {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     bookshopClientGetBook();
    *   }
    *
-   *   public static void bookshopClientGetBook() {
+   *   public static void bookshopClientGetBook() throws Exception {
    *     try (BookshopClient bookshopClient = BookshopClient.create()) {
    *       String booksList = "booksList2-1119589686";
    *       List books = new ArrayList<>();
@@ -242,11 +242,11 @@ public class BookshopClient implements BackgroundResource {
    *
    * public class BookshopClientGetBook {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     bookshopClientGetBook();
    *   }
    *
-   *   public static void bookshopClientGetBook() {
+   *   public static void bookshopClientGetBook() throws Exception {
    *     try (BookshopClient bookshopClient = BookshopClient.create()) {
    *       GetBookRequest request =
    *           GetBookRequest.newBuilder()
@@ -279,11 +279,11 @@ public class BookshopClient implements BackgroundResource {
    *
    * public class BookshopClientGetBook {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     bookshopClientGetBook();
    *   }
    *
-   *   public static void bookshopClientGetBook() {
+   *   public static void bookshopClientGetBook() throws Exception {
    *     try (BookshopClient bookshopClient = BookshopClient.create()) {
    *       GetBookRequest request =
    *           GetBookRequest.newBuilder()
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 fb1c94bcf3..bcf24b3360 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
@@ -22,11 +22,11 @@ import javax.annotation.Generated;
  *
  * public class DeprecatedServiceClientFastFibonacci {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     deprecatedServiceClientFastFibonacci();
  *   }
  *
- *   public static void deprecatedServiceClientFastFibonacci() {
+ *   public static void deprecatedServiceClientFastFibonacci() throws Exception {
  *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
  *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
  *       deprecatedServiceClient.fastFibonacci(request);
@@ -69,13 +69,13 @@ import javax.annotation.Generated;
  *
  * import com.google.api.gax.core.FixedCredentialsProvider;
  *
- * public class DeprecatedServiceClientcreate {
+ * public class DeprecatedServiceClientCreate {
  *
- *   public static void main(String[] args) {
- *     deprecatedServiceClientcreate();
+ *   public static void main(String[] args) throws Exception {
+ *     deprecatedServiceClientCreate();
  *   }
  *
- *   public static void deprecatedServiceClientcreate() {
+ *   public static void deprecatedServiceClientCreate() throws Exception {
  *     DeprecatedServiceSettings deprecatedServiceSettings =
  *         DeprecatedServiceSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -93,11 +93,11 @@ import javax.annotation.Generated;
  *
  * public class DeprecatedServiceClientClassHeaderEndpoint {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     deprecatedServiceClientClassHeaderEndpoint();
  *   }
  *
- *   public static void deprecatedServiceClientClassHeaderEndpoint() {
+ *   public static void deprecatedServiceClientClassHeaderEndpoint() throws Exception {
  *     DeprecatedServiceSettings deprecatedServiceSettings =
  *         DeprecatedServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     DeprecatedServiceClient deprecatedServiceClient =
@@ -175,11 +175,11 @@ public class DeprecatedServiceClient implements BackgroundResource {
    *
    * public class DeprecatedServiceClientFastFibonacci {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     deprecatedServiceClientFastFibonacci();
    *   }
    *
-   *   public static void deprecatedServiceClientFastFibonacci() {
+   *   public static void deprecatedServiceClientFastFibonacci() throws Exception {
    *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
    *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
    *       deprecatedServiceClient.fastFibonacci(request);
@@ -207,11 +207,11 @@ public class DeprecatedServiceClient implements BackgroundResource {
    *
    * public class DeprecatedServiceClientFastFibonacci {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     deprecatedServiceClientFastFibonacci();
    *   }
    *
-   *   public static void 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);
@@ -237,11 +237,11 @@ public class DeprecatedServiceClient implements BackgroundResource {
    *
    * public class DeprecatedServiceClientSlowFibonacci {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     deprecatedServiceClientSlowFibonacci();
    *   }
    *
-   *   public static void deprecatedServiceClientSlowFibonacci() {
+   *   public static void deprecatedServiceClientSlowFibonacci() throws Exception {
    *     try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
    *       FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
    *       deprecatedServiceClient.slowFibonacci(request);
@@ -271,11 +271,11 @@ public class DeprecatedServiceClient implements BackgroundResource {
    *
    * public class DeprecatedServiceClientSlowFibonacci {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     deprecatedServiceClientSlowFibonacci();
    *   }
    *
-   *   public static void 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);
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 d1fdfb1438..03d79bb0b3 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
@@ -41,11 +41,11 @@ import javax.annotation.Generated;
  *
  * public class DeprecatedServiceSettings {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     deprecatedServiceSettings();
  *   }
  *
- *   public static void deprecatedServiceSettings() {
+ *   public static void deprecatedServiceSettings() throws Exception {
  *     DeprecatedServiceSettings.Builder deprecatedServiceSettingsBuilder =
  *         DeprecatedServiceSettings.newBuilder();
  *     deprecatedServiceSettingsBuilder
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 79a869dfaf..6ffb0f77c2 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
@@ -50,11 +50,11 @@ import org.threeten.bp.Duration;
  *
  * public class DeprecatedServiceSettings {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     deprecatedServiceSettings();
  *   }
  *
- *   public static void deprecatedServiceSettings() {
+ *   public static void deprecatedServiceSettings() throws Exception {
  *     DeprecatedServiceStubSettings.Builder deprecatedServiceSettingsBuilder =
  *         DeprecatedServiceStubSettings.newBuilder();
  *     deprecatedServiceSettingsBuilder
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 46d36f11f5..5db74cd0d2 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
@@ -38,11 +38,11 @@ import javax.annotation.Generated;
  *
  * public class EchoClientEcho {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     echoClientEcho();
  *   }
  *
- *   public static void echoClientEcho() {
+ *   public static void echoClientEcho() throws Exception {
  *     try (EchoClient echoClient = EchoClient.create()) {
  *       EchoResponse response = echoClient.echo();
  *     }
@@ -83,13 +83,13 @@ import javax.annotation.Generated;
  *
  * import com.google.api.gax.core.FixedCredentialsProvider;
  *
- * public class EchoClientcreate {
+ * public class EchoClientCreate {
  *
- *   public static void main(String[] args) {
- *     echoClientcreate();
+ *   public static void main(String[] args) throws Exception {
+ *     echoClientCreate();
  *   }
  *
- *   public static void echoClientcreate() {
+ *   public static void echoClientCreate() throws Exception {
  *     EchoSettings echoSettings =
  *         EchoSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -106,11 +106,11 @@ import javax.annotation.Generated;
  *
  * public class EchoClientClassHeaderEndpoint {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     echoClientClassHeaderEndpoint();
  *   }
  *
- *   public static void echoClientClassHeaderEndpoint() {
+ *   public static void echoClientClassHeaderEndpoint() throws Exception {
  *     EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     EchoClient echoClient = EchoClient.create(echoSettings);
  *   }
@@ -191,11 +191,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientEcho {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientEcho();
    *   }
    *
-   *   public static void echoClientEcho() {
+   *   public static void echoClientEcho() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       EchoResponse response = echoClient.echo();
    *     }
@@ -222,11 +222,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientEcho {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientEcho();
    *   }
    *
-   *   public static void echoClientEcho() {
+   *   public static void echoClientEcho() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       ResourceName parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
    *       EchoResponse response = echoClient.echo(parent);
@@ -255,11 +255,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientEcho {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientEcho();
    *   }
    *
-   *   public static void echoClientEcho() {
+   *   public static void echoClientEcho() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       Status error = Status.newBuilder().build();
    *       EchoResponse response = echoClient.echo(error);
@@ -285,11 +285,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientEcho {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientEcho();
    *   }
    *
-   *   public static void echoClientEcho() {
+   *   public static void echoClientEcho() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       FoobarName name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
    *       EchoResponse response = echoClient.echo(name);
@@ -316,11 +316,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientEcho {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientEcho();
    *   }
    *
-   *   public static void echoClientEcho() {
+   *   public static void echoClientEcho() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       String content = "content951530617";
    *       EchoResponse response = echoClient.echo(content);
@@ -346,11 +346,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientEcho {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientEcho();
    *   }
    *
-   *   public static void echoClientEcho() {
+   *   public static void echoClientEcho() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       String name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
    *       EchoResponse response = echoClient.echo(name);
@@ -376,11 +376,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientEcho {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientEcho();
    *   }
    *
-   *   public static void echoClientEcho() {
+   *   public static void echoClientEcho() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       String parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
    *       EchoResponse response = echoClient.echo(parent);
@@ -406,11 +406,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientEcho {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientEcho();
    *   }
    *
-   *   public static void echoClientEcho() {
+   *   public static void echoClientEcho() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       String content = "content951530617";
    *       Severity severity = Severity.forNumber(0);
@@ -439,11 +439,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientEcho {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientEcho();
    *   }
    *
-   *   public static void echoClientEcho() {
+   *   public static void echoClientEcho() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       EchoRequest request =
    *           EchoRequest.newBuilder()
@@ -476,11 +476,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientEcho {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientEcho();
    *   }
    *
-   *   public static void echoClientEcho() {
+   *   public static void echoClientEcho() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       EchoRequest request =
    *           EchoRequest.newBuilder()
@@ -512,11 +512,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientExpand {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientExpand();
    *   }
    *
-   *   public static void echoClientExpand() {
+   *   public static void echoClientExpand() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       ExpandRequest request =
    *           ExpandRequest.newBuilder().setContent("content951530617").setInfo("info3237038").build();
@@ -544,11 +544,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientCollect {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientCollect();
    *   }
    *
-   *   public static void echoClientCollect() {
+   *   public static void echoClientCollect() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       ApiStreamObserver responseObserver =
    *           new ApiStreamObserver() {
@@ -597,11 +597,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientChat {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientChat();
    *   }
    *
-   *   public static void echoClientChat() {
+   *   public static void echoClientChat() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       BidiStream bidiStream = echoClient.chatCallable().call();
    *       EchoRequest request =
@@ -635,11 +635,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientChatAgain {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientChatAgain();
    *   }
    *
-   *   public static void echoClientChatAgain() {
+   *   public static void echoClientChatAgain() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       BidiStream bidiStream = echoClient.chatAgainCallable().call();
    *       EchoRequest request =
@@ -671,11 +671,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientPagedExpand {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientPagedExpand();
    *   }
    *
-   *   public static void echoClientPagedExpand() {
+   *   public static void echoClientPagedExpand() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       PagedExpandRequest request =
    *           PagedExpandRequest.newBuilder()
@@ -709,11 +709,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientPagedExpand {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientPagedExpand();
    *   }
    *
-   *   public static void echoClientPagedExpand() {
+   *   public static void echoClientPagedExpand() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       PagedExpandRequest request =
    *           PagedExpandRequest.newBuilder()
@@ -747,11 +747,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientPagedExpand {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientPagedExpand();
    *   }
    *
-   *   public static void echoClientPagedExpand() {
+   *   public static void echoClientPagedExpand() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       PagedExpandRequest request =
    *           PagedExpandRequest.newBuilder()
@@ -789,11 +789,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientSimplePagedExpand {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientSimplePagedExpand();
    *   }
    *
-   *   public static void echoClientSimplePagedExpand() {
+   *   public static void echoClientSimplePagedExpand() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       for (EchoResponse element : echoClient.simplePagedExpand().iterateAll()) {
    *         // doThingsWith(element);
@@ -820,11 +820,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientSimplePagedExpand {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientSimplePagedExpand();
    *   }
    *
-   *   public static void echoClientSimplePagedExpand() {
+   *   public static void echoClientSimplePagedExpand() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       PagedExpandRequest request =
    *           PagedExpandRequest.newBuilder()
@@ -858,11 +858,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientSimplePagedExpand {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientSimplePagedExpand();
    *   }
    *
-   *   public static void echoClientSimplePagedExpand() {
+   *   public static void echoClientSimplePagedExpand() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       PagedExpandRequest request =
    *           PagedExpandRequest.newBuilder()
@@ -897,11 +897,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientSimplePagedExpand {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientSimplePagedExpand();
    *   }
    *
-   *   public static void echoClientSimplePagedExpand() {
+   *   public static void echoClientSimplePagedExpand() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       PagedExpandRequest request =
    *           PagedExpandRequest.newBuilder()
@@ -941,11 +941,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientWait {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientWait();
    *   }
    *
-   *   public static void echoClientWait() {
+   *   public static void echoClientWait() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       Duration ttl = Duration.newBuilder().build();
    *       WaitResponse response = echoClient.waitAsync(ttl).get();
@@ -973,11 +973,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientWait {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientWait();
    *   }
    *
-   *   public static void echoClientWait() {
+   *   public static void echoClientWait() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       Timestamp endTime = Timestamp.newBuilder().build();
    *       WaitResponse response = echoClient.waitAsync(endTime).get();
@@ -1003,11 +1003,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientWait {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientWait();
    *   }
    *
-   *   public static void echoClientWait() {
+   *   public static void echoClientWait() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       WaitRequest request = WaitRequest.newBuilder().build();
    *       WaitResponse response = echoClient.waitAsync(request).get();
@@ -1034,11 +1034,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientWait {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientWait();
    *   }
    *
-   *   public static void echoClientWait() {
+   *   public static void echoClientWait() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       WaitRequest request = WaitRequest.newBuilder().build();
    *       OperationFuture future =
@@ -1066,11 +1066,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientWait {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientWait();
    *   }
    *
-   *   public static void echoClientWait() {
+   *   public static void echoClientWait() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       WaitRequest request = WaitRequest.newBuilder().build();
    *       ApiFuture future = echoClient.waitCallable().futureCall(request);
@@ -1094,11 +1094,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientBlock {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientBlock();
    *   }
    *
-   *   public static void echoClientBlock() {
+   *   public static void echoClientBlock() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       BlockRequest request = BlockRequest.newBuilder().build();
    *       BlockResponse response = echoClient.block(request);
@@ -1125,11 +1125,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientBlock {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientBlock();
    *   }
    *
-   *   public static void echoClientBlock() {
+   *   public static void echoClientBlock() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       BlockRequest request = BlockRequest.newBuilder().build();
    *       ApiFuture future = echoClient.blockCallable().futureCall(request);
@@ -1153,11 +1153,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientCollideName {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientCollideName();
    *   }
    *
-   *   public static void echoClientCollideName() {
+   *   public static void echoClientCollideName() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       EchoRequest request =
    *           EchoRequest.newBuilder()
@@ -1190,11 +1190,11 @@ public class EchoClient implements BackgroundResource {
    *
    * public class EchoClientCollideName {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     echoClientCollideName();
    *   }
    *
-   *   public static void echoClientCollideName() {
+   *   public static void echoClientCollideName() throws Exception {
    *     try (EchoClient echoClient = EchoClient.create()) {
    *       EchoRequest request =
    *           EchoRequest.newBuilder()
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 0ead94fcf9..63b3504260 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
@@ -48,11 +48,11 @@ import javax.annotation.Generated;
  *
  * public class EchoSettings {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     echoSettings();
  *   }
  *
- *   public static void echoSettings() {
+ *   public static void echoSettings() throws Exception {
  *     EchoSettings.Builder echoSettingsBuilder = EchoSettings.newBuilder();
  *     echoSettingsBuilder
  *         .echoSettings()
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 0652dcdd1b..03af69b3d0 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
@@ -76,11 +76,11 @@ import org.threeten.bp.Duration;
  *
  * public class EchoSettings {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     echoSettings();
  *   }
  *
- *   public static void echoSettings() {
+ *   public static void echoSettings() throws Exception {
  *     EchoStubSettings.Builder echoSettingsBuilder = EchoStubSettings.newBuilder();
  *     echoSettingsBuilder
  *         .echoSettings()
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 075b95773a..68dd6e4a5c 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
@@ -28,11 +28,11 @@ import javax.annotation.Generated;
  *
  * public class IdentityClientCreateUser {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     identityClientCreateUser();
  *   }
  *
- *   public static void identityClientCreateUser() {
+ *   public static void identityClientCreateUser() throws Exception {
  *     try (IdentityClient identityClient = IdentityClient.create()) {
  *       String parent = UserName.of("[USER]").toString();
  *       String displayName = "displayName1714148973";
@@ -76,13 +76,13 @@ import javax.annotation.Generated;
  *
  * import com.google.api.gax.core.FixedCredentialsProvider;
  *
- * public class IdentityClientcreate {
+ * public class IdentityClientCreate {
  *
- *   public static void main(String[] args) {
- *     identityClientcreate();
+ *   public static void main(String[] args) throws Exception {
+ *     identityClientCreate();
  *   }
  *
- *   public static void identityClientcreate() {
+ *   public static void identityClientCreate() throws Exception {
  *     IdentitySettings identitySettings =
  *         IdentitySettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -99,11 +99,11 @@ import javax.annotation.Generated;
  *
  * public class IdentityClientClassHeaderEndpoint {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     identityClientClassHeaderEndpoint();
  *   }
  *
- *   public static void identityClientClassHeaderEndpoint() {
+ *   public static void identityClientClassHeaderEndpoint() throws Exception {
  *     IdentitySettings identitySettings =
  *         IdentitySettings.newBuilder().setEndpoint(myEndpoint).build();
  *     IdentityClient identityClient = IdentityClient.create(identitySettings);
@@ -174,11 +174,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientCreateUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientCreateUser();
    *   }
    *
-   *   public static void identityClientCreateUser() {
+   *   public static void identityClientCreateUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       String parent = UserName.of("[USER]").toString();
    *       String displayName = "displayName1714148973";
@@ -212,11 +212,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientCreateUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientCreateUser();
    *   }
    *
-   *   public static void identityClientCreateUser() {
+   *   public static void identityClientCreateUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       String parent = UserName.of("[USER]").toString();
    *       String displayName = "displayName1714148973";
@@ -275,11 +275,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientCreateUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientCreateUser();
    *   }
    *
-   *   public static void identityClientCreateUser() {
+   *   public static void identityClientCreateUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       String parent = UserName.of("[USER]").toString();
    *       String displayName = "displayName1714148973";
@@ -371,11 +371,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientCreateUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientCreateUser();
    *   }
    *
-   *   public static void identityClientCreateUser() {
+   *   public static void identityClientCreateUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       CreateUserRequest request =
    *           CreateUserRequest.newBuilder()
@@ -406,11 +406,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientCreateUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientCreateUser();
    *   }
    *
-   *   public static void identityClientCreateUser() {
+   *   public static void identityClientCreateUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       CreateUserRequest request =
    *           CreateUserRequest.newBuilder()
@@ -438,11 +438,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientGetUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientGetUser();
    *   }
    *
-   *   public static void identityClientGetUser() {
+   *   public static void identityClientGetUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       UserName name = UserName.of("[USER]");
    *       User response = identityClient.getUser(name);
@@ -469,11 +469,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientGetUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientGetUser();
    *   }
    *
-   *   public static void identityClientGetUser() {
+   *   public static void identityClientGetUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       String name = UserName.of("[USER]").toString();
    *       User response = identityClient.getUser(name);
@@ -499,11 +499,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientGetUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientGetUser();
    *   }
    *
-   *   public static void identityClientGetUser() {
+   *   public static void identityClientGetUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       GetUserRequest request =
    *           GetUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
@@ -531,11 +531,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientGetUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientGetUser();
    *   }
    *
-   *   public static void identityClientGetUser() {
+   *   public static void identityClientGetUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       GetUserRequest request =
    *           GetUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
@@ -560,11 +560,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientUpdateUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientUpdateUser();
    *   }
    *
-   *   public static void identityClientUpdateUser() {
+   *   public static void identityClientUpdateUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       UpdateUserRequest request =
    *           UpdateUserRequest.newBuilder().setUser(User.newBuilder().build()).build();
@@ -592,11 +592,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientUpdateUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientUpdateUser();
    *   }
    *
-   *   public static void identityClientUpdateUser() {
+   *   public static void identityClientUpdateUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       UpdateUserRequest request =
    *           UpdateUserRequest.newBuilder().setUser(User.newBuilder().build()).build();
@@ -623,11 +623,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientDeleteUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientDeleteUser();
    *   }
    *
-   *   public static void identityClientDeleteUser() {
+   *   public static void identityClientDeleteUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       UserName name = UserName.of("[USER]");
    *       identityClient.deleteUser(name);
@@ -656,11 +656,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientDeleteUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientDeleteUser();
    *   }
    *
-   *   public static void identityClientDeleteUser() {
+   *   public static void identityClientDeleteUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       String name = UserName.of("[USER]").toString();
    *       identityClient.deleteUser(name);
@@ -688,11 +688,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientDeleteUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientDeleteUser();
    *   }
    *
-   *   public static void identityClientDeleteUser() {
+   *   public static void identityClientDeleteUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       DeleteUserRequest request =
    *           DeleteUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
@@ -721,11 +721,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientDeleteUser {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientDeleteUser();
    *   }
    *
-   *   public static void identityClientDeleteUser() {
+   *   public static void identityClientDeleteUser() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       DeleteUserRequest request =
    *           DeleteUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
@@ -750,11 +750,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientListUsers {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientListUsers();
    *   }
    *
-   *   public static void identityClientListUsers() {
+   *   public static void identityClientListUsers() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       ListUsersRequest request =
    *           ListUsersRequest.newBuilder()
@@ -787,11 +787,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientListUsers {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientListUsers();
    *   }
    *
-   *   public static void identityClientListUsers() {
+   *   public static void identityClientListUsers() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       ListUsersRequest request =
    *           ListUsersRequest.newBuilder()
@@ -823,11 +823,11 @@ public class IdentityClient implements BackgroundResource {
    *
    * public class IdentityClientListUsers {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     identityClientListUsers();
    *   }
    *
-   *   public static void identityClientListUsers() {
+   *   public static void identityClientListUsers() throws Exception {
    *     try (IdentityClient identityClient = IdentityClient.create()) {
    *       ListUsersRequest request =
    *           ListUsersRequest.newBuilder()
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 98afc95f90..2a1e49ab83 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
@@ -83,11 +83,11 @@ import org.threeten.bp.Duration;
  *
  * public class LoggingServiceV2Settings {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     loggingServiceV2Settings();
  *   }
  *
- *   public static void loggingServiceV2Settings() {
+ *   public static void loggingServiceV2Settings() throws Exception {
  *     LoggingServiceV2StubSettings.Builder loggingServiceV2SettingsBuilder =
  *         LoggingServiceV2StubSettings.newBuilder();
  *     loggingServiceV2SettingsBuilder
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 2f62eb856a..64742dd403 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
@@ -36,11 +36,11 @@ import javax.annotation.Generated;
  *
  * public class MessagingClientCreateRoom {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     messagingClientCreateRoom();
  *   }
  *
- *   public static void messagingClientCreateRoom() {
+ *   public static void messagingClientCreateRoom() throws Exception {
  *     try (MessagingClient messagingClient = MessagingClient.create()) {
  *       String displayName = "displayName1714148973";
  *       String description = "description-1724546052";
@@ -83,13 +83,13 @@ import javax.annotation.Generated;
  *
  * import com.google.api.gax.core.FixedCredentialsProvider;
  *
- * public class MessagingClientcreate {
+ * public class MessagingClientCreate {
  *
- *   public static void main(String[] args) {
- *     messagingClientcreate();
+ *   public static void main(String[] args) throws Exception {
+ *     messagingClientCreate();
  *   }
  *
- *   public static void messagingClientcreate() {
+ *   public static void messagingClientCreate() throws Exception {
  *     MessagingSettings messagingSettings =
  *         MessagingSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -106,11 +106,11 @@ import javax.annotation.Generated;
  *
  * public class MessagingClientClassHeaderEndpoint {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     messagingClientClassHeaderEndpoint();
  *   }
  *
- *   public static void messagingClientClassHeaderEndpoint() {
+ *   public static void messagingClientClassHeaderEndpoint() throws Exception {
  *     MessagingSettings messagingSettings =
  *         MessagingSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     MessagingClient messagingClient = MessagingClient.create(messagingSettings);
@@ -192,11 +192,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientCreateRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientCreateRoom();
    *   }
    *
-   *   public static void messagingClientCreateRoom() {
+   *   public static void messagingClientCreateRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       String displayName = "displayName1714148973";
    *       String description = "description-1724546052";
@@ -228,11 +228,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientCreateRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientCreateRoom();
    *   }
    *
-   *   public static void messagingClientCreateRoom() {
+   *   public static void messagingClientCreateRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       CreateRoomRequest request =
    *           CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
@@ -260,11 +260,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientCreateRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientCreateRoom();
    *   }
    *
-   *   public static void messagingClientCreateRoom() {
+   *   public static void messagingClientCreateRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       CreateRoomRequest request =
    *           CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
@@ -289,11 +289,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientGetRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientGetRoom();
    *   }
    *
-   *   public static void messagingClientGetRoom() {
+   *   public static void messagingClientGetRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       RoomName name = RoomName.of("[ROOM]");
    *       Room response = messagingClient.getRoom(name);
@@ -320,11 +320,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientGetRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientGetRoom();
    *   }
    *
-   *   public static void messagingClientGetRoom() {
+   *   public static void messagingClientGetRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       String name = RoomName.of("[ROOM]").toString();
    *       Room response = messagingClient.getRoom(name);
@@ -350,11 +350,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientGetRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientGetRoom();
    *   }
    *
-   *   public static void messagingClientGetRoom() {
+   *   public static void messagingClientGetRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       GetRoomRequest request =
    *           GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
@@ -382,11 +382,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientGetRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientGetRoom();
    *   }
    *
-   *   public static void messagingClientGetRoom() {
+   *   public static void messagingClientGetRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       GetRoomRequest request =
    *           GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
@@ -411,11 +411,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientUpdateRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientUpdateRoom();
    *   }
    *
-   *   public static void messagingClientUpdateRoom() {
+   *   public static void messagingClientUpdateRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       UpdateRoomRequest request =
    *           UpdateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
@@ -443,11 +443,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientUpdateRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientUpdateRoom();
    *   }
    *
-   *   public static void messagingClientUpdateRoom() {
+   *   public static void messagingClientUpdateRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       UpdateRoomRequest request =
    *           UpdateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
@@ -474,11 +474,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientDeleteRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientDeleteRoom();
    *   }
    *
-   *   public static void messagingClientDeleteRoom() {
+   *   public static void messagingClientDeleteRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       RoomName name = RoomName.of("[ROOM]");
    *       messagingClient.deleteRoom(name);
@@ -507,11 +507,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientDeleteRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientDeleteRoom();
    *   }
    *
-   *   public static void messagingClientDeleteRoom() {
+   *   public static void messagingClientDeleteRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       String name = RoomName.of("[ROOM]").toString();
    *       messagingClient.deleteRoom(name);
@@ -539,11 +539,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientDeleteRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientDeleteRoom();
    *   }
    *
-   *   public static void messagingClientDeleteRoom() {
+   *   public static void messagingClientDeleteRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       DeleteRoomRequest request =
    *           DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
@@ -572,11 +572,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientDeleteRoom {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientDeleteRoom();
    *   }
    *
-   *   public static void messagingClientDeleteRoom() {
+   *   public static void messagingClientDeleteRoom() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       DeleteRoomRequest request =
    *           DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
@@ -601,11 +601,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientListRooms {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientListRooms();
    *   }
    *
-   *   public static void messagingClientListRooms() {
+   *   public static void messagingClientListRooms() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       ListRoomsRequest request =
    *           ListRoomsRequest.newBuilder()
@@ -638,11 +638,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientListRooms {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientListRooms();
    *   }
    *
-   *   public static void messagingClientListRooms() {
+   *   public static void messagingClientListRooms() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       ListRoomsRequest request =
    *           ListRoomsRequest.newBuilder()
@@ -674,11 +674,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientListRooms {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientListRooms();
    *   }
    *
-   *   public static void messagingClientListRooms() {
+   *   public static void messagingClientListRooms() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       ListRoomsRequest request =
    *           ListRoomsRequest.newBuilder()
@@ -717,11 +717,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientCreateBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientCreateBlurb();
    *   }
    *
-   *   public static void messagingClientCreateBlurb() {
+   *   public static void messagingClientCreateBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       ProfileName parent = ProfileName.of("[USER]");
    *       ByteString image = ByteString.EMPTY;
@@ -753,11 +753,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientCreateBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientCreateBlurb();
    *   }
    *
-   *   public static void messagingClientCreateBlurb() {
+   *   public static void messagingClientCreateBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       ProfileName parent = ProfileName.of("[USER]");
    *       String text = "text3556653";
@@ -791,11 +791,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientCreateBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientCreateBlurb();
    *   }
    *
-   *   public static void messagingClientCreateBlurb() {
+   *   public static void messagingClientCreateBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       RoomName parent = RoomName.of("[ROOM]");
    *       ByteString image = ByteString.EMPTY;
@@ -827,11 +827,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientCreateBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientCreateBlurb();
    *   }
    *
-   *   public static void messagingClientCreateBlurb() {
+   *   public static void messagingClientCreateBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       RoomName parent = RoomName.of("[ROOM]");
    *       String text = "text3556653";
@@ -865,11 +865,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientCreateBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientCreateBlurb();
    *   }
    *
-   *   public static void messagingClientCreateBlurb() {
+   *   public static void messagingClientCreateBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       String parent = ProfileName.of("[USER]").toString();
    *       ByteString image = ByteString.EMPTY;
@@ -901,11 +901,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientCreateBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientCreateBlurb();
    *   }
    *
-   *   public static void messagingClientCreateBlurb() {
+   *   public static void messagingClientCreateBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       String parent = ProfileName.of("[USER]").toString();
    *       String text = "text3556653";
@@ -937,11 +937,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientCreateBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientCreateBlurb();
    *   }
    *
-   *   public static void messagingClientCreateBlurb() {
+   *   public static void messagingClientCreateBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       CreateBlurbRequest request =
    *           CreateBlurbRequest.newBuilder()
@@ -972,11 +972,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientCreateBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientCreateBlurb();
    *   }
    *
-   *   public static void messagingClientCreateBlurb() {
+   *   public static void messagingClientCreateBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       CreateBlurbRequest request =
    *           CreateBlurbRequest.newBuilder()
@@ -1004,11 +1004,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientGetBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientGetBlurb();
    *   }
    *
-   *   public static void 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);
@@ -1035,11 +1035,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientGetBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientGetBlurb();
    *   }
    *
-   *   public static void messagingClientGetBlurb() {
+   *   public static void messagingClientGetBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       String name =
    *           BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
@@ -1066,11 +1066,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientGetBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientGetBlurb();
    *   }
    *
-   *   public static void messagingClientGetBlurb() {
+   *   public static void messagingClientGetBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       GetBlurbRequest request =
    *           GetBlurbRequest.newBuilder()
@@ -1102,11 +1102,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientGetBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientGetBlurb();
    *   }
    *
-   *   public static void messagingClientGetBlurb() {
+   *   public static void messagingClientGetBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       GetBlurbRequest request =
    *           GetBlurbRequest.newBuilder()
@@ -1135,11 +1135,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientUpdateBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientUpdateBlurb();
    *   }
    *
-   *   public static void messagingClientUpdateBlurb() {
+   *   public static void messagingClientUpdateBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       UpdateBlurbRequest request =
    *           UpdateBlurbRequest.newBuilder().setBlurb(Blurb.newBuilder().build()).build();
@@ -1167,11 +1167,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientUpdateBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientUpdateBlurb();
    *   }
    *
-   *   public static void messagingClientUpdateBlurb() {
+   *   public static void messagingClientUpdateBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       UpdateBlurbRequest request =
    *           UpdateBlurbRequest.newBuilder().setBlurb(Blurb.newBuilder().build()).build();
@@ -1198,11 +1198,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientDeleteBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientDeleteBlurb();
    *   }
    *
-   *   public static void messagingClientDeleteBlurb() {
+   *   public static void messagingClientDeleteBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       BlurbName name = BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]");
    *       messagingClient.deleteBlurb(name);
@@ -1231,11 +1231,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientDeleteBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientDeleteBlurb();
    *   }
    *
-   *   public static void messagingClientDeleteBlurb() {
+   *   public static void messagingClientDeleteBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       String name =
    *           BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
@@ -1264,11 +1264,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientDeleteBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientDeleteBlurb();
    *   }
    *
-   *   public static void messagingClientDeleteBlurb() {
+   *   public static void messagingClientDeleteBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       DeleteBlurbRequest request =
    *           DeleteBlurbRequest.newBuilder()
@@ -1301,11 +1301,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientDeleteBlurb {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientDeleteBlurb();
    *   }
    *
-   *   public static void messagingClientDeleteBlurb() {
+   *   public static void messagingClientDeleteBlurb() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       DeleteBlurbRequest request =
    *           DeleteBlurbRequest.newBuilder()
@@ -1334,11 +1334,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientListBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientListBlurbs();
    *   }
    *
-   *   public static void messagingClientListBlurbs() {
+   *   public static void messagingClientListBlurbs() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       ProfileName parent = ProfileName.of("[USER]");
    *       for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
@@ -1367,11 +1367,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientListBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientListBlurbs();
    *   }
    *
-   *   public static void messagingClientListBlurbs() {
+   *   public static void messagingClientListBlurbs() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       RoomName parent = RoomName.of("[ROOM]");
    *       for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
@@ -1400,11 +1400,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientListBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientListBlurbs();
    *   }
    *
-   *   public static void 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()) {
@@ -1432,11 +1432,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientListBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientListBlurbs();
    *   }
    *
-   *   public static void messagingClientListBlurbs() {
+   *   public static void messagingClientListBlurbs() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       ListBlurbsRequest request =
    *           ListBlurbsRequest.newBuilder()
@@ -1470,11 +1470,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientListBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientListBlurbs();
    *   }
    *
-   *   public static void messagingClientListBlurbs() {
+   *   public static void messagingClientListBlurbs() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       ListBlurbsRequest request =
    *           ListBlurbsRequest.newBuilder()
@@ -1507,11 +1507,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientListBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientListBlurbs();
    *   }
    *
-   *   public static void messagingClientListBlurbs() {
+   *   public static void messagingClientListBlurbs() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       ListBlurbsRequest request =
    *           ListBlurbsRequest.newBuilder()
@@ -1549,11 +1549,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientSearchBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientSearchBlurbs();
    *   }
    *
-   *   public static void messagingClientSearchBlurbs() {
+   *   public static void messagingClientSearchBlurbs() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       String query = "query107944136";
    *       SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(query).get();
@@ -1580,11 +1580,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientSearchBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientSearchBlurbs();
    *   }
    *
-   *   public static void messagingClientSearchBlurbs() {
+   *   public static void messagingClientSearchBlurbs() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       SearchBlurbsRequest request =
    *           SearchBlurbsRequest.newBuilder()
@@ -1618,11 +1618,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientSearchBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientSearchBlurbs();
    *   }
    *
-   *   public static void messagingClientSearchBlurbs() {
+   *   public static void messagingClientSearchBlurbs() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       SearchBlurbsRequest request =
    *           SearchBlurbsRequest.newBuilder()
@@ -1657,11 +1657,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientSearchBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientSearchBlurbs();
    *   }
    *
-   *   public static void messagingClientSearchBlurbs() {
+   *   public static void messagingClientSearchBlurbs() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       SearchBlurbsRequest request =
    *           SearchBlurbsRequest.newBuilder()
@@ -1693,11 +1693,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientStreamBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientStreamBlurbs();
    *   }
    *
-   *   public static void messagingClientStreamBlurbs() {
+   *   public static void messagingClientStreamBlurbs() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       StreamBlurbsRequest request =
    *           StreamBlurbsRequest.newBuilder().setName(ProfileName.of("[USER]").toString()).build();
@@ -1727,11 +1727,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientSendBlurbs {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientSendBlurbs();
    *   }
    *
-   *   public static void messagingClientSendBlurbs() {
+   *   public static void messagingClientSendBlurbs() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       ApiStreamObserver responseObserver =
    *           new ApiStreamObserver() {
@@ -1779,11 +1779,11 @@ public class MessagingClient implements BackgroundResource {
    *
    * public class MessagingClientConnect {
    *
-   *   public static void main(String[] args) {
+   *   public static void main(String[] args) throws Exception {
    *     messagingClientConnect();
    *   }
    *
-   *   public static void messagingClientConnect() {
+   *   public static void messagingClientConnect() throws Exception {
    *     try (MessagingClient messagingClient = MessagingClient.create()) {
    *       BidiStream bidiStream =
    *           messagingClient.connectCallable().call();
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 9ef94a138d..f7424fd43d 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
@@ -84,11 +84,11 @@ import org.threeten.bp.Duration;
  *
  * public class PublisherSettings {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     publisherSettings();
  *   }
  *
- *   public static void publisherSettings() {
+ *   public static void publisherSettings() throws Exception {
  *     PublisherStubSettings.Builder publisherSettingsBuilder = PublisherStubSettings.newBuilder();
  *     publisherSettingsBuilder
  *         .createTopicSettings()
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 d04708e77a..6dd90df67e 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
@@ -40,11 +40,11 @@ import javax.annotation.Generated;
  *
  * public class ComplianceSettings {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     complianceSettings();
  *   }
  *
- *   public static void complianceSettings() {
+ *   public static void complianceSettings() throws Exception {
  *     ComplianceSettings.Builder complianceSettingsBuilder = ComplianceSettings.newBuilder();
  *     complianceSettingsBuilder
  *         .repeatDataBodySettings()
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 8eda353745..4c3cf9426c 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
@@ -49,11 +49,11 @@ import javax.annotation.Generated;
  *
  * public class ComplianceSettings {
  *
- *   public static void main(String[] args) {
+ *   public static void main(String[] args) throws Exception {
  *     complianceSettings();
  *   }
  *
- *   public static void complianceSettings() {
+ *   public static void complianceSettings() throws Exception {
  *     ComplianceStubSettings.Builder complianceSettingsBuilder = ComplianceStubSettings.newBuilder();
  *     complianceSettingsBuilder
  *         .repeatDataBodySettings()
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
index 249f1acb99..742e8f8641 100644
--- 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
@@ -40,11 +40,11 @@ public void createExecutableSampleEmptySample() {
                         "\n",
                         "public class EchoClientWait {\n",
                         "\n",
-                        "  public static void main(String[] args) {\n",
+                        "  public static void main(String[] args) throws Exception {\n",
                         "    echoClientWait();\n",
                         "  }\n",
                         "\n",
-                        "  public static void echoClientWait() {}\n",
+                        "  public static void echoClientWait() throws Exception {}\n",
                         "}\n");
 
         assertEquals(sampleResult, expected);
@@ -65,11 +65,11 @@ public void createExecutableSampleMethodArgsNoVar() {
                         "\n",
                         "public class EchoClientWait {\n",
                         "\n",
-                        "  public static void main(String[] args) {\n",
+                        "  public static void main(String[] args) throws Exception {\n",
                         "    echoClientWait();\n",
                         "  }\n",
                         "\n",
-                        "  public static void echoClientWait() {\n",
+                        "  public static void echoClientWait() throws Exception {\n",
                         "    System.out.println(\"Testing echoClientWait\");\n",
                         "  }\n",
                         "}\n");
@@ -98,12 +98,12 @@ public void createExecutableSampleMethod() {
                         "\n",
                         "public class EchoClientWait {\n",
                         "\n",
-                        "  public static void main(String[] args) {\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) {\n",
+                        "  public static void echoClientWait(String content) throws Exception {\n",
                         "    System.out.println(content);\n",
                         "  }\n",
                         "}\n");
@@ -139,13 +139,13 @@ public void createExecutableSampleMethodMultipleStatements() {
                         "\n",
                         "public class EchoClientWait {\n",
                         "\n",
-                        "  public static void main(String[] args) {\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) {\n",
+                        "  public static void echoClientWait(String content, String otherContent) throws Exception {\n",
                         "    System.out.println(content);\n",
                         "    System.out.println(otherContent);\n",
                         "  }\n",
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 3f024b455a..753411c348 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
@@ -75,11 +75,11 @@ public void composeClassHeaderMethodSampleCode_unaryRpc() {
           "\n",
           "public class EchoClientEcho {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientEcho();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientEcho() {\n",
+          "  public static void echoClientEcho() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      EchoResponse response = echoClient.echo();\n",
           "    }\n",
@@ -170,11 +170,11 @@ public void composeClassHeaderMethodSampleCode_firstMethodIsNotUnaryRpc() {
           "\n",
           "public class EchoClientWait {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientWait();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientWait() {\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",
@@ -234,11 +234,11 @@ public void composeClassHeaderMethodSampleCode_firstMethodHasNoSignatures() {
           "\n",
           "public class EchoClientEcho {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientEcho();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientEcho() {\n",
+          "  public static void echoClientEcho() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      EchoRequest request =\n",
           "          EchoRequest.newBuilder()\n",
@@ -306,11 +306,11 @@ public void composeClassHeaderMethodSampleCode_firstMethodIsStream() {
           "\n",
           "public class EchoClientExpand {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientExpand();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientExpand() {\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",
@@ -349,11 +349,11 @@ public void composeClassHeaderCredentialsSampleCode() {
           "\n",
           "public class EchoClientCreate {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientCreate();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientCreate() {\n",
+          "  public static void echoClientCreate() throws Exception {\n",
           "    EchoSettings echoSettings =\n",
           "        EchoSettings.newBuilder()\n",
           "            .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))\n",
@@ -387,11 +387,11 @@ public void composeClassHeaderEndpointSampleCode() {
           "\n",
           "public class EchoClientClassHeaderEndpoint {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientClassHeaderEndpoint();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientClassHeaderEndpoint() {\n",
+          "  public static void echoClientClassHeaderEndpoint() throws Exception {\n",
           "    EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();\n",
           "    EchoClient echoClient = EchoClient.create(echoSettings);\n",
           "  }\n",
@@ -1116,11 +1116,11 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithMultipleMethodArgu
           "\n",
           "public class EchoClientListContent {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientListContent();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientListContent() {\n",
+          "  public static void echoClientListContent() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      List resourceName = new ArrayList<>();\n",
           "      String filter = \"filter-1274492040\";\n",
@@ -1199,11 +1199,11 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithNoMethodArguments(
           "\n",
           "public class EchoClientListContent {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientListContent();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientListContent() {\n",
+          "  public static void echoClientListContent() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      for (Content element : echoClient.listContent().iterateAll()) {\n",
           "        // doThingsWith(element);\n",
@@ -1370,11 +1370,11 @@ public void validComposeRpcMethodHeaderSampleCode_lroUnaryRpcWithNoMethodArgumen
           "\n",
           "public class EchoClientWait {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientWait();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientWait() {\n",
+          "  public static void echoClientWait() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      WaitResponse response = echoClient.waitAsync().get();\n",
           "    }\n",
@@ -1456,11 +1456,11 @@ public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnResponseType()
           "\n",
           "public class EchoClientWait {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientWait();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientWait() {\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",
@@ -1541,11 +1541,11 @@ public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnVoid() {
           "\n",
           "public class EchoClientWait {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientWait();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientWait() {\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",
@@ -1596,11 +1596,11 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_isPagedMethod() {
           "\n",
           "public class EchoClientPagedExpand {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientPagedExpand();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientPagedExpand() {\n",
+          "  public static void echoClientPagedExpand() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      PagedExpandRequest request =\n",
           "          PagedExpandRequest.newBuilder()\n",
@@ -1708,11 +1708,11 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_hasLroMethodWithReturnR
           "\n",
           "public class EchoClientWait {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientWait();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientWait() {\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",
@@ -1776,11 +1776,11 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_hasLroMethodWithReturnV
           "\n",
           "public class EchoClientWait {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientWait();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientWait() {\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",
@@ -1828,11 +1828,11 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_pureUnaryReturnVoid() {
           "\n",
           "public class EchoClientEcho {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientEcho();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientEcho() {\n",
+          "  public static void echoClientEcho() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      EchoRequest request =\n",
           "          EchoRequest.newBuilder()\n",
@@ -1887,11 +1887,11 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_pureUnaryReturnResponse
           "\n",
           "public class EchoClientEcho {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientEcho();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientEcho() {\n",
+          "  public static void echoClientEcho() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      EchoRequest request =\n",
           "          EchoRequest.newBuilder()\n",
@@ -1963,11 +1963,11 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnResponse() {
           "\n",
           "public class EchoClientWait {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientWait();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientWait() {\n",
+          "  public static void echoClientWait() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      WaitRequest request = WaitRequest.newBuilder().build();\n",
           "      OperationFuture future =\n",
@@ -2033,11 +2033,11 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnVoid() {
           "\n",
           "public class EchoClientWait {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientWait();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientWait() {\n",
+          "  public static void echoClientWait() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      WaitRequest request = WaitRequest.newBuilder().build();\n",
           "      OperationFuture future =\n",
@@ -2092,11 +2092,11 @@ public void validComposePagedCallableMethodHeaderSampleCode() {
           "\n",
           "public class EchoClientPagedExpand {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientPagedExpand();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientPagedExpand() {\n",
+          "  public static void echoClientPagedExpand() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      PagedExpandRequest request =\n",
           "          PagedExpandRequest.newBuilder()\n",
@@ -2282,11 +2282,11 @@ public void validComposeStreamCallableMethodHeaderSampleCode_serverStream() {
           "\n",
           "public class EchoClientExpand {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientExpand();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientExpand() {\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",
@@ -2378,11 +2378,11 @@ public void validComposeStreamCallableMethodHeaderSampleCode_bidiStream() {
           "\n",
           "public class EchoClientChat {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientChat();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientChat() {\n",
+          "  public static void echoClientChat() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      BidiStream bidiStream = echoClient.chatCallable().call();\n",
           "      EchoRequest request =\n",
@@ -2480,11 +2480,11 @@ public void validComposeStreamCallableMethodHeaderSampleCode_clientStream() {
             "\n",
             "public class EchoClientCollect {\n",
             "\n",
-            "  public static void main(String[] args) {\n",
+            "  public static void main(String[] args) throws Exception {\n",
             "    echoClientCollect();\n",
             "  }\n",
             "\n",
-            "  public static void echoClientCollect() {\n",
+            "  public static void echoClientCollect() throws Exception {\n",
             "    try (EchoClient echoClient = EchoClient.create()) {\n",
             "      ApiStreamObserver responseObserver =\n",
             "          new ApiStreamObserver() {\n",
@@ -2593,11 +2593,11 @@ public void validComposeRegularCallableMethodHeaderSampleCode_unaryRpc() {
           "\n",
           "public class EchoClientEcho {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientEcho();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientEcho() {\n",
+          "  public static void echoClientEcho() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      EchoRequest request =\n",
           "          EchoRequest.newBuilder()\n",
@@ -2671,11 +2671,11 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpc() {
           "\n",
           "public class EchoClientWait {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientWait();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientWait() {\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",
@@ -2740,11 +2740,11 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpcWithReturnVo
           "\n",
           "public class EchoClientWait {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientWait();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientWait() {\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",
@@ -2798,11 +2798,11 @@ public void validComposeRegularCallableMethodHeaderSampleCode_pageRpc() {
           "\n",
           "public class EchoClientPagedExpand {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoClientPagedExpand();\n",
           "  }\n",
           "\n",
-          "  public static void echoClientPagedExpand() {\n",
+          "  public static void echoClientPagedExpand() throws Exception {\n",
           "    try (EchoClient echoClient = EchoClient.create()) {\n",
           "      PagedExpandRequest request =\n",
           "          PagedExpandRequest.newBuilder()\n",
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 b3dddca75e..5ca35fb44e 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
@@ -56,11 +56,11 @@ public void composeSettingsSampleCode_serviceSettingsClass() {
           "\n",
           "public class EchoSettings {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoSettings();\n",
           "  }\n",
           "\n",
-          "  public static void echoSettings() {\n",
+          "  public static void echoSettings() throws Exception {\n",
           "    EchoSettings.Builder echoSettingsBuilder = EchoSettings.newBuilder();\n",
           "    echoSettingsBuilder\n",
           "        .echoSettings()\n",
@@ -96,11 +96,11 @@ public void composeSettingsSampleCode_serviceStubClass() {
           "\n",
           "public class EchoSettings {\n",
           "\n",
-          "  public static void main(String[] args) {\n",
+          "  public static void main(String[] args) throws Exception {\n",
           "    echoSettings();\n",
           "  }\n",
           "\n",
-          "  public static void echoSettings() {\n",
+          "  public static void echoSettings() throws Exception {\n",
           "    EchoStubSettings.Builder echoSettingsBuilder = EchoStubSettings.newBuilder();\n",
           "    echoSettingsBuilder\n",
           "        .echoSettings()\n",

From c292b3bbbc3da99fe84de4636bad1481709fd295 Mon Sep 17 00:00:00 2001
From: Emily Ball 
Date: Tue, 30 Nov 2021 16:54:42 -0800
Subject: [PATCH 06/13] tests: update integration goldens

---
 .../cloud/asset/v1/AssetServiceClient.java    | 1397 +++++--
 .../cloud/asset/v1/AssetServiceSettings.java  |   35 +-
 .../google/cloud/asset/v1/package-info.java   |   33 +-
 .../v1/stub/AssetServiceStubSettings.java     |   37 +-
 .../cloud/compute/v1/AddressesClient.java     |  621 ++-
 .../cloud/compute/v1/AddressesSettings.java   |   35 +-
 .../compute/v1/RegionOperationsClient.java    |  227 +-
 .../compute/v1/RegionOperationsSettings.java  |   37 +-
 .../google/cloud/compute/v1/package-info.java |   44 +-
 .../v1/stub/AddressesStubSettings.java        |   35 +-
 .../v1/stub/RegionOperationsStubSettings.java |   37 +-
 .../credentials/v1/IamCredentialsClient.java  |  553 ++-
 .../v1/IamCredentialsSettings.java            |   37 +-
 .../iam/credentials/v1/package-info.java      |   29 +-
 .../v1/stub/IamCredentialsStubSettings.java   |   37 +-
 .../com/google/iam/v1/IAMPolicyClient.java    |  238 +-
 .../com/google/iam/v1/IAMPolicySettings.java  |   35 +-
 .../iam/com/google/iam/v1/package-info.java   |   25 +-
 .../iam/v1/stub/IAMPolicyStubSettings.java    |   35 +-
 .../kms/v1/KeyManagementServiceClient.java    | 3400 ++++++++++++-----
 .../kms/v1/KeyManagementServiceSettings.java  |   39 +-
 .../com/google/cloud/kms/v1/package-info.java |   19 +-
 .../KeyManagementServiceStubSettings.java     |   39 +-
 .../library/v1/LibraryServiceClient.java      | 1278 +++++--
 .../library/v1/LibraryServiceSettings.java    |   37 +-
 .../example/library/v1/package-info.java      |   19 +-
 .../v1/stub/LibraryServiceStubSettings.java   |   37 +-
 .../google/cloud/logging/v2/ConfigClient.java | 2704 +++++++++----
 .../cloud/logging/v2/ConfigSettings.java      |   35 +-
 .../cloud/logging/v2/LoggingClient.java       |  870 +++--
 .../cloud/logging/v2/LoggingSettings.java     |   35 +-
 .../cloud/logging/v2/MetricsClient.java       |  636 ++-
 .../cloud/logging/v2/MetricsSettings.java     |   35 +-
 .../google/cloud/logging/v2/package-info.java |   71 +-
 .../v2/stub/ConfigServiceV2StubSettings.java  |   37 +-
 .../v2/stub/LoggingServiceV2StubSettings.java |   37 +-
 .../v2/stub/MetricsServiceV2StubSettings.java |   37 +-
 .../cloud/pubsub/v1/SchemaServiceClient.java  |  939 +++--
 .../pubsub/v1/SchemaServiceSettings.java      |   35 +-
 .../pubsub/v1/SubscriptionAdminClient.java    | 2175 ++++++++---
 .../pubsub/v1/SubscriptionAdminSettings.java  |   37 +-
 .../cloud/pubsub/v1/TopicAdminClient.java     | 1319 +++++--
 .../cloud/pubsub/v1/TopicAdminSettings.java   |   35 +-
 .../google/cloud/pubsub/v1/package-info.java  |   74 +-
 .../pubsub/v1/stub/PublisherStubSettings.java |   35 +-
 .../v1/stub/SchemaServiceStubSettings.java    |   37 +-
 .../v1/stub/SubscriberStubSettings.java       |   37 +-
 .../cloud/redis/v1beta1/CloudRedisClient.java | 1151 ++++--
 .../redis/v1beta1/CloudRedisSettings.java     |   35 +-
 .../cloud/redis/v1beta1/package-info.java     |   17 +-
 .../v1beta1/stub/CloudRedisStubSettings.java  |   35 +-
 .../com/google/storage/v2/StorageClient.java  |  329 +-
 .../google/storage/v2/StorageSettings.java    |   35 +-
 .../com/google/storage/v2/package-info.java   |   27 +-
 .../storage/v2/stub/StorageStubSettings.java  |   35 +-
 55 files changed, 14128 insertions(+), 5151 deletions(-)

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..9a366b817f 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,29 @@
  * 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.cloud.asset.v1;
+ *
+ * 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 +102,43 @@ *

To customize credentials: * *

{@code
- * AssetServiceSettings assetServiceSettings =
- *     AssetServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
+ * package com.google.cloud.asset.v1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class AssetServiceClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     assetServiceClientCreate();
+ *   }
+ *
+ *   public static void assetServiceClientCreate() 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.cloud.asset.v1;
+ *
+ * public class AssetServiceClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     assetServiceClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void assetServiceClientClassHeaderEndpoint() 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 +220,31 @@ 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.cloud.asset.v1;
+   *
+   * 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 +270,35 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * 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 +321,35 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +364,23 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.resourcenames.ResourceName;
+   *
+   * 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 +404,21 @@ 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.cloud.asset.v1;
+   *
+   * 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 +441,33 @@ 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.cloud.asset.v1;
+   *
+   * 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 +486,36 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +531,42 @@ 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.cloud.asset.v1;
+   *
+   * 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 +587,29 @@ 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.cloud.asset.v1;
+   *
+   * 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 +632,33 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +674,20 @@ public final BatchGetAssetsHistoryResponse batchGetAssetsHistory( *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   String parent = "parent-995424086";
-   *   Feed response = assetServiceClient.createFeed(parent);
+   * package com.google.cloud.asset.v1;
+   *
+   * 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 +709,25 @@ 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.cloud.asset.v1;
+   *
+   * 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 +745,29 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +782,20 @@ 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.cloud.asset.v1;
+   *
+   * 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 +817,20 @@ 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.cloud.asset.v1;
+   *
+   * 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 +851,23 @@ 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.cloud.asset.v1;
+   *
+   * 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 +885,27 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +920,20 @@ public final UnaryCallable getFeedCallable() { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   String parent = "parent-995424086";
-   *   ListFeedsResponse response = assetServiceClient.listFeeds(parent);
+   * package com.google.cloud.asset.v1;
+   *
+   * 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 +954,21 @@ 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.cloud.asset.v1;
+   *
+   * 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 +986,26 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +1020,20 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1054,26 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1091,29 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1128,22 @@ public final UnaryCallable updateFeedCallable() { *

Sample code: * *

{@code
-   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
-   *   FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
-   *   assetServiceClient.deleteFeed(name);
+   * package com.google.cloud.asset.v1;
+   *
+   * 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 +1165,22 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1201,25 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1237,28 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1275,27 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1383,34 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1432,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();
-   *   ApiFuture future =
-   *       assetServiceClient.searchAllResourcesPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (ResourceSearchResult element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
+   * package com.google.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1481,43 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1537,23 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1624,32 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1671,35 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1718,41 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1770,26 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1807,30 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1853,25 @@ 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.cloud.asset.v1;
+   *
+   * 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 +1898,30 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   *
+   * 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 +1947,30 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1989,24 @@ 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.cloud.asset.v1;
+   *
+   * 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 +2027,29 @@ 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.cloud.asset.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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..bc9ce047e5 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,30 @@ *

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.cloud.asset.v1;
+ *
+ * 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..496c0611f0 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,29 @@ *

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.cloud.asset.v1;
+ *
+ * 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..f04d1e8c80 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,31 @@ *

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.cloud.asset.v1.stub;
+ *
+ * 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..812a5d90c0 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,24 @@ * 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.cloud.compute.v1;
+ *
+ * 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 +97,43 @@ *

To customize credentials: * *

{@code
- * AddressesSettings addressesSettings =
- *     AddressesSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * AddressesClient addressesClient = AddressesClient.create(addressesSettings);
+ * package com.google.cloud.compute.v1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class AddressesClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     addressesClientCreate();
+ *   }
+ *
+ *   public static void addressesClientCreate() 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.cloud.compute.v1;
+ *
+ * public class AddressesClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     addressesClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void addressesClientClassHeaderEndpoint() 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 +196,24 @@ 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.cloud.compute.v1;
+   *
+   * 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 +234,32 @@ 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.cloud.compute.v1;
+   *
+   * 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 +278,35 @@ 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.cloud.compute.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +323,40 @@ 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.cloud.compute.v1;
+   *
+   * 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 +374,22 @@ 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.cloud.compute.v1;
+   *
+   * 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 +416,26 @@ 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.cloud.compute.v1;
+   *
+   * 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 +455,31 @@ 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.cloud.compute.v1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   *
+   * 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 +495,31 @@ 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.cloud.compute.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +534,22 @@ 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.cloud.compute.v1;
+   *
+   * 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 +576,26 @@ 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.cloud.compute.v1;
+   *
+   * 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 +615,31 @@ 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.cloud.compute.v1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   *
+   * 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 +655,31 @@ 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.cloud.compute.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +694,23 @@ 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.cloud.compute.v1;
+   *
+   * 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 +743,29 @@ 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.cloud.compute.v1;
+   *
+   * 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 +784,33 @@ 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.cloud.compute.v1; + * + * import com.google.api.core.ApiFuture; + * + * 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 +826,39 @@ 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.cloud.compute.v1;
+   *
+   * 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..64d15ee238 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,30 @@
  * 

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.cloud.compute.v1;
+ *
+ * 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..151b7fac59 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,22 @@ * 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.cloud.compute.v1;
+ *
+ * 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 +82,45 @@ *

To customize credentials: * *

{@code
- * RegionOperationsSettings regionOperationsSettings =
- *     RegionOperationsSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * RegionOperationsClient regionOperationsClient =
- *     RegionOperationsClient.create(regionOperationsSettings);
+ * package com.google.cloud.compute.v1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class RegionOperationsClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     regionOperationsClientCreate();
+ *   }
+ *
+ *   public static void regionOperationsClientCreate() 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.cloud.compute.v1;
+ *
+ * public class RegionOperationsClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     regionOperationsClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void regionOperationsClientClassHeaderEndpoint() 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 +185,22 @@ 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.cloud.compute.v1;
+   *
+   * 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 +226,25 @@ 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.cloud.compute.v1;
+   *
+   * 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 +262,29 @@ 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.cloud.compute.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +308,22 @@ 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.cloud.compute.v1;
+   *
+   * 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 +358,25 @@ 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.cloud.compute.v1;
+   *
+   * 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 +403,29 @@ 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.cloud.compute.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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..0ea54b961b 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,31 @@ *

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.cloud.compute.v1;
+ *
+ * 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..e909ea3433 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,24 @@ *

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.cloud.compute.v1;
+ *
+ * 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 +55,22 @@ *

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.cloud.compute.v1;
+ *
+ * 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..ba339e5398 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,30 @@ *

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.cloud.compute.v1.stub;
+ *
+ * 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..f4730bab7b 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,31 @@ *

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.cloud.compute.v1.stub;
+ *
+ * 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..b76f09b31b 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,28 @@ * 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.cloud.iam.credentials.v1;
+ *
+ * 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 +97,43 @@ *

To customize credentials: * *

{@code
- * IamCredentialsSettings iamCredentialsSettings =
- *     IamCredentialsSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create(iamCredentialsSettings);
+ * package com.google.cloud.iam.credentials.v1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class IamCredentialsClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iamCredentialsClientCreate();
+ *   }
+ *
+ *   public static void iamCredentialsClientCreate() 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.cloud.iam.credentials.v1;
+ *
+ * public class IamCredentialsClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iamCredentialsClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void iamCredentialsClientClassHeaderEndpoint() 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 +198,28 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +262,28 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +326,29 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +366,33 @@ 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.cloud.iam.credentials.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +408,27 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +469,27 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +530,28 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +569,32 @@ 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.cloud.iam.credentials.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +610,26 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +666,26 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +721,28 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +760,32 @@ 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.cloud.iam.credentials.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +800,25 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +855,25 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +909,27 @@ 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.cloud.iam.credentials.v1;
+   *
+   * 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 +947,31 @@ 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.cloud.iam.credentials.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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..cf38a24e52 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,31 @@ *

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.cloud.iam.credentials.v1;
+ *
+ * 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..271fda0111 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,28 @@ *

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.cloud.iam.credentials.v1;
+ *
+ * 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..4225509e4c 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,31 @@ *

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.cloud.iam.credentials.v1.stub;
+ *
+ * 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..f5a4920b3f 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,24 @@ * 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.iam.v1;
+ *
+ * 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 +104,43 @@ *

To customize credentials: * *

{@code
- * IAMPolicySettings iAMPolicySettings =
- *     IAMPolicySettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create(iAMPolicySettings);
+ * package com.google.iam.v1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class IAMPolicyClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iAMPolicyClientCreate();
+ *   }
+ *
+ *   public static void iAMPolicyClientCreate() 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.iam.v1;
+ *
+ * public class IAMPolicyClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     iAMPolicyClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void iAMPolicyClientClassHeaderEndpoint() 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 +203,24 @@ 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.iam.v1;
+   *
+   * 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 +238,28 @@ 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.iam.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +275,24 @@ 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.iam.v1;
+   *
+   * 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 +311,28 @@ 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.iam.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +352,26 @@ 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.iam.v1;
+   *
+   * 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 +394,30 @@ 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.iam.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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..7804f2bcb5 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,30 @@ *

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.iam.v1;
+ *
+ * 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..5e8e9f2189 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,24 @@ *

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.iam.v1;
+ *
+ * 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..da232e2df3 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,30 @@ *

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.iam.v1.stub;
+ *
+ * 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..e94b3e7a11 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,21 @@ * 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.cloud.kms.v1;
+ *
+ * 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 +113,45 @@ *

To customize credentials: * *

{@code
- * KeyManagementServiceSettings keyManagementServiceSettings =
- *     KeyManagementServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * KeyManagementServiceClient keyManagementServiceClient =
- *     KeyManagementServiceClient.create(keyManagementServiceSettings);
+ * package com.google.cloud.kms.v1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class KeyManagementServiceClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     keyManagementServiceClientCreate();
+ *   }
+ *
+ *   public static void keyManagementServiceClientCreate() 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.cloud.kms.v1;
+ *
+ * public class KeyManagementServiceClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     keyManagementServiceClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void keyManagementServiceClientClassHeaderEndpoint() 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 +216,22 @@ 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.cloud.kms.v1;
+   *
+   * 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 +255,22 @@ 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.cloud.kms.v1;
+   *
+   * 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 +291,29 @@ 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.cloud.kms.v1;
+   *
+   * 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 +332,34 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +376,40 @@ 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.cloud.kms.v1;
+   *
+   * 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 +426,22 @@ 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.cloud.kms.v1;
+   *
+   * 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 +465,22 @@ 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.cloud.kms.v1;
+   *
+   * 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 +501,29 @@ 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.cloud.kms.v1;
+   *
+   * 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 +542,34 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +586,40 @@ 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.cloud.kms.v1;
+   *
+   * 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 +637,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +678,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +717,32 @@ 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.cloud.kms.v1;
+   *
+   * 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 +762,36 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +808,42 @@ 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.cloud.kms.v1;
+   *
+   * 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 +861,22 @@ 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.cloud.kms.v1;
+   *
+   * 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 +900,22 @@ 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.cloud.kms.v1;
+   *
+   * 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 +936,29 @@ 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.cloud.kms.v1;
+   *
+   * 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 +977,34 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +1021,40 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1072,21 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1107,21 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1141,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1176,29 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +1215,22 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1253,22 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1290,26 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1329,31 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +1368,23 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1407,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1445,31 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1487,36 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +1535,23 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1575,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1615,31 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1660,36 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +1704,22 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1740,22 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1775,26 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1812,31 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +1851,23 @@ 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.cloud.kms.v1;
+   *
+   * 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,18 +1895,29 @@ 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.cloud.kms.v1; * - * @param parent Required. The resource name of the location associated with the - * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. - * @param keyRingId Required. It must be unique within a location and match the regular expression + * 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); + * } + * } + * } + * }
+ * + * @param parent Required. The resource name of the location associated with the + * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. + * @param keyRingId Required. It must be unique within a location and match the regular expression * `[a-zA-Z0-9_-]{1,63}` * @param keyRing Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1416,15 +1939,26 @@ 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.cloud.kms.v1;
+   *
+   * 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 +1976,31 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +2020,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2072,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2123,27 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2166,32 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +2211,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2261,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2311,27 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2354,32 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +2400,27 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2443,32 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +2487,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2538,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2588,26 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2628,31 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +2667,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2708,27 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2746,31 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +2793,25 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2845,27 @@ 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.cloud.kms.v1;
+   *
+   * 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 +2891,31 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +2934,25 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.resourcenames.ResourceName;
+   * 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 +2988,25 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3039,33 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3086,37 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3134,25 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3181,25 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3225,33 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3272,37 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3320,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3367,25 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3412,35 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3461,39 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3512,27 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3562,28 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3609,36 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3659,40 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3711,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3758,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3804,27 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3846,32 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +3900,23 @@ 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.cloud.kms.v1;
+   *
+   * 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 +3952,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +4003,31 @@ 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.cloud.kms.v1;
+   *
+   * 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 +4058,36 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +4110,23 @@ 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.cloud.kms.v1;
+   *
+   * 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 +4156,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +4201,31 @@ 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.cloud.kms.v1;
+   *
+   * 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 +4250,36 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +4296,31 @@ 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.cloud.kms.v1;
+   *
+   * 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 +4339,35 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +4382,31 @@ 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.cloud.kms.v1;
+   *
+   * 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 +4425,35 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +4470,42 @@ 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.cloud.kms.v1;
+   *
+   * 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 +4522,24 @@ 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.cloud.kms.v1;
+   *
+   * 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 +4557,28 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +4594,31 @@ 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.cloud.kms.v1;
+   *
+   * 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 +4637,35 @@ 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.cloud.kms.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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..8e5b2a1b2f 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,32 @@ *

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.cloud.kms.v1;
+ *
+ * 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..8994c0736f 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,21 @@ *

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.cloud.kms.v1;
+ *
+ * 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..c06a196e12 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,32 @@ *

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.cloud.kms.v1.stub;
+ *
+ * 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..82c67e9048 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,22 @@ * 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.cloud.example.library.v1;
+ *
+ * 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 +115,43 @@ *

To customize credentials: * *

{@code
- * LibraryServiceSettings libraryServiceSettings =
- *     LibraryServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * LibraryServiceClient libraryServiceClient = LibraryServiceClient.create(libraryServiceSettings);
+ * package com.google.cloud.example.library.v1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class LibraryServiceClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     libraryServiceClientCreate();
+ *   }
+ *
+ *   public static void libraryServiceClientCreate() 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.cloud.example.library.v1;
+ *
+ * public class LibraryServiceClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     libraryServiceClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void libraryServiceClientClassHeaderEndpoint() 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 +216,22 @@ public LibraryServiceStub getStub() { *

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   Shelf shelf = Shelf.newBuilder().build();
-   *   Shelf response = libraryServiceClient.createShelf(shelf);
+   * package com.google.cloud.example.library.v1;
+   *
+   * 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 +250,24 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +285,27 @@ 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.cloud.example.library.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +320,23 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +356,23 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +391,25 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +427,28 @@ 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.cloud.example.library.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +464,28 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +505,31 @@ 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.cloud.example.library.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +547,38 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +595,23 @@ public final UnaryCallable listShelvesC
    * 

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   ShelfName name = ShelfName.of("[SHELF_ID]");
-   *   libraryServiceClient.deleteShelf(name);
+   * package com.google.cloud.example.library.v1;
+   *
+   * 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 +631,23 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +666,25 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +702,28 @@ 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.cloud.example.library.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +743,24 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +789,24 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +835,24 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +881,24 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +924,28 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +968,31 @@ 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.cloud.example.library.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1007,24 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1048,24 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1086,28 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1125,31 @@ 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.cloud.example.library.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1164,23 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1200,23 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1235,25 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1271,28 @@ 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.cloud.example.library.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1309,24 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1349,24 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1388,30 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1432,33 @@ 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.cloud.example.library.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1476,40 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1526,23 @@ public final UnaryCallable listBooksCallabl
    * 

Sample code: * *

{@code
-   * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
-   *   BookName name = BookName.of("[SHELF]", "[BOOK]");
-   *   libraryServiceClient.deleteBook(name);
+   * package com.google.cloud.example.library.v1;
+   *
+   * 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 +1562,23 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1597,27 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1635,30 @@ 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.cloud.example.library.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1674,24 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1713,28 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1753,31 @@ 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.cloud.example.library.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1793,25 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1836,25 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1879,25 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1922,25 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +1962,29 @@ 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.cloud.example.library.v1;
+   *
+   * 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 +2003,32 @@ 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.cloud.example.library.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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..15f6d0c376 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,31 @@ *

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.cloud.example.library.v1;
+ *
+ * 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..0f1e142cf9 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,22 @@ *

Sample for LibraryServiceClient: * *

{@code
- * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- *   Shelf shelf = Shelf.newBuilder().build();
- *   Shelf response = libraryServiceClient.createShelf(shelf);
+ * package com.google.cloud.example.library.v1;
+ *
+ * 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..32e1e3f688 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,31 @@ *

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.cloud.example.library.v1.stub;
+ *
+ * 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..7032d218c7 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,29 @@ * 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.cloud.logging.v2;
+ *
+ * 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 +140,42 @@ *

To customize credentials: * *

{@code
- * ConfigSettings configSettings =
- *     ConfigSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * ConfigClient configClient = ConfigClient.create(configSettings);
+ * package com.google.cloud.logging.v2;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class ConfigClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     configClientCreate();
+ *   }
+ *
+ *   public static void configClientCreate() 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.cloud.logging.v2;
+ *
+ * public class ConfigClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     configClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void configClientClassHeaderEndpoint() 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 +238,25 @@ 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.cloud.logging.v2;
+   *
+   * 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 +285,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +331,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +377,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +423,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +466,30 @@ 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.cloud.logging.v2;
+   *
+   * 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 +508,33 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +551,40 @@ 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.cloud.logging.v2;
+   *
+   * 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 +601,29 @@ 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.cloud.logging.v2;
+   *
+   * 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 +641,32 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +682,29 @@ 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.cloud.logging.v2;
+   *
+   * 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 +723,32 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +772,32 @@ 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.cloud.logging.v2;
+   *
+   * 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 +824,35 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +868,29 @@ 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.cloud.logging.v2;
+   *
+   * 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 +909,32 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +950,29 @@ 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.cloud.logging.v2;
+   *
+   * 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 +991,32 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1031,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1068,29 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1109,32 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1150,39 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1199,30 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1240,33 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1281,28 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1320,31 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1360,29 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1401,32 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1441,30 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1482,33 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1523,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1563,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1603,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1643,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1683,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1722,30 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1764,33 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1806,40 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1856,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1899,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1939,27 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1977,30 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +2018,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2066,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2114,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2162,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2210,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2255,29 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2298,32 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +2342,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2394,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2443,26 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2504,29 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2571,31 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2617,34 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +2660,23 @@ public final UnaryCallable updateSinkCallable() { *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
-   *   configClient.deleteSink(sinkName);
+   * package com.google.cloud.logging.v2;
+   *
+   * 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 +2705,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2747,27 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2786,30 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +2824,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2866,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2908,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2950,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +2992,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3031,30 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3073,34 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3117,40 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3168,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3209,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3249,28 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3288,31 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3328,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3374,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3420,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3466,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3512,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3555,28 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3595,31 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3634,26 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3691,26 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3748,31 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3790,34 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3832,23 @@ public final UnaryCallable updateExclusion *

Sample code: * *

{@code
-   * try (ConfigClient configClient = ConfigClient.create()) {
-   *   LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
-   *   configClient.deleteExclusion(name);
+   * package com.google.cloud.logging.v2;
+   *
+   * 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 +3873,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3913,28 @@ 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.cloud.logging.v2;
+   *
+   * 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 +3952,31 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3997,27 @@ 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.cloud.logging.v2;
+   *
+   * 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 +4041,30 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +4090,29 @@ 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.cloud.logging.v2;
+   *
+   * 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 +4141,33 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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..7c8144fc6a 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,30 @@ *

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.cloud.logging.v2;
+ *
+ * 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..b6940e5f6d 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,23 @@ * 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.cloud.logging.v2;
+ *
+ * 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 +112,42 @@ *

To customize credentials: * *

{@code
- * LoggingSettings loggingSettings =
- *     LoggingSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * LoggingClient loggingClient = LoggingClient.create(loggingSettings);
+ * package com.google.cloud.logging.v2;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class LoggingClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     loggingClientCreate();
+ *   }
+ *
+ *   public static void loggingClientCreate() 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.cloud.logging.v2;
+ *
+ * public class LoggingClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     loggingClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void loggingClientClassHeaderEndpoint() 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 +212,23 @@ public LoggingServiceV2Stub getStub() { *

Sample code: * *

{@code
-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
-   *   loggingClient.deleteLog(logName);
+   * package com.google.cloud.logging.v2;
+   *
+   * 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 +257,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +299,27 @@ 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.cloud.logging.v2;
+   *
+   * 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 +339,30 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +380,33 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.MonitoredResource;
+   * 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 +475,33 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.MonitoredResource;
+   * 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 +570,36 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.MonitoredResource;
+   * 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 +620,40 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.MonitoredResource;
+   * import com.google.api.core.ApiFuture;
+   * 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 +671,28 @@ 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.cloud.logging.v2;
+   *
+   * 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 +740,32 @@ 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.cloud.logging.v2;
+   *
+   * 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 +786,35 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +833,42 @@ 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.cloud.logging.v2;
+   *
+   * 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 +886,29 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.MonitoredResourceDescriptor;
+   * 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 +928,32 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.MonitoredResourceDescriptor;
+   * import com.google.api.core.ApiFuture;
+   * 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 +971,39 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.MonitoredResourceDescriptor;
+   * 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 +1023,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1063,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1103,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1143,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1183,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1222,31 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1266,34 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1310,41 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1362,35 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.gax.rpc.BidiStream;
+   * 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..c4347f986d 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,30 @@ *

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.cloud.logging.v2;
+ *
+ * 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..fd88e739a7 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,23 @@ * 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.cloud.logging.v2;
+ *
+ * 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 +100,42 @@ *

To customize credentials: * *

{@code
- * MetricsSettings metricsSettings =
- *     MetricsSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * MetricsClient metricsClient = MetricsClient.create(metricsSettings);
+ * package com.google.cloud.logging.v2;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class MetricsClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     metricsClientCreate();
+ *   }
+ *
+ *   public static void metricsClientCreate() 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.cloud.logging.v2;
+ *
+ * public class MetricsClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     metricsClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void metricsClientClassHeaderEndpoint() 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 +198,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +239,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +277,30 @@ 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.cloud.logging.v2;
+   *
+   * 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 +319,33 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +362,40 @@ 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.cloud.logging.v2;
+   *
+   * 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 +413,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +452,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +489,27 @@ 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.cloud.logging.v2;
+   *
+   * 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 +527,30 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +565,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +609,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +650,28 @@ 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.cloud.logging.v2;
+   *
+   * 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 +689,31 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +728,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +773,24 @@ 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.cloud.logging.v2;
+   *
+   * 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 +815,28 @@ 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.cloud.logging.v2;
+   *
+   * 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 +854,31 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +893,23 @@ public final UnaryCallable updateLogMetricCal *

Sample code: * *

{@code
-   * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
-   *   metricsClient.deleteLogMetric(metricName);
+   * package com.google.cloud.logging.v2;
+   *
+   * 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 +932,23 @@ 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.cloud.logging.v2;
+   *
+   * 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 +969,27 @@ 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.cloud.logging.v2;
+   *
+   * 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 +1007,30 @@ 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.cloud.logging.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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..4e979bf6c6 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,30 @@ *

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.cloud.logging.v2;
+ *
+ * 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..90fcb9b6be 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,23 @@ *

Sample for LoggingClient: * *

{@code
- * try (LoggingClient loggingClient = LoggingClient.create()) {
- *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
- *   loggingClient.deleteLog(logName);
+ * package com.google.cloud.logging.v2;
+ *
+ * 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 +51,29 @@ *

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.cloud.logging.v2;
+ *
+ * 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 +84,23 @@ *

Sample for MetricsClient: * *

{@code
- * try (MetricsClient metricsClient = MetricsClient.create()) {
- *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
- *   LogMetric response = metricsClient.getLogMetric(metricName);
+ * package com.google.cloud.logging.v2;
+ *
+ * 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..4d86c0c508 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,31 @@ *

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.cloud.logging.v2.stub;
+ *
+ * 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..fa2b16e052 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,31 @@ *

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.cloud.logging.v2.stub;
+ *
+ * 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..3f949e192e 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,31 @@ *

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.cloud.logging.v2.stub;
+ *
+ * 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..11d50908be 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,25 @@ * 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.cloud.pubsub.v1;
+ *
+ * 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 +110,43 @@ *

To customize credentials: * *

{@code
- * SchemaServiceSettings schemaServiceSettings =
- *     SchemaServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings);
+ * package com.google.cloud.pubsub.v1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class SchemaServiceClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     schemaServiceClientCreate();
+ *   }
+ *
+ *   public static void schemaServiceClientCreate() 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.cloud.pubsub.v1;
+ *
+ * public class SchemaServiceClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     schemaServiceClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void schemaServiceClientClassHeaderEndpoint() 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 +211,25 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +261,25 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +311,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +351,32 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +391,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +428,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +464,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +504,32 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +544,24 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +585,24 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +623,32 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +667,35 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +712,42 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +764,23 @@ public final UnaryCallable listSchemasC
    * 

Sample code: * *

{@code
-   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
-   *   schemaServiceClient.deleteSchema(name);
+   * package com.google.cloud.pubsub.v1;
+   *
+   * 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 +801,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +837,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +875,30 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +913,25 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +956,25 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +996,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1036,33 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1078,31 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1120,35 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1166,28 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1207,31 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1247,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1288,32 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1333,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1378,33 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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..b652251dc2 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,30 @@ *

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.cloud.pubsub.v1;
+ *
+ * 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..1a481e40d8 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,29 @@ * 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.cloud.pubsub.v1;
+ *
+ * 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 +133,45 @@ *

To customize credentials: * *

{@code
- * SubscriptionAdminSettings subscriptionAdminSettings =
- *     SubscriptionAdminSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * SubscriptionAdminClient subscriptionAdminClient =
- *     SubscriptionAdminClient.create(subscriptionAdminSettings);
+ * package com.google.cloud.pubsub.v1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class SubscriptionAdminClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     subscriptionAdminClientCreate();
+ *   }
+ *
+ *   public static void subscriptionAdminClientCreate() 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.cloud.pubsub.v1;
+ *
+ * public class SubscriptionAdminClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     subscriptionAdminClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void subscriptionAdminClientClassHeaderEndpoint() 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 +245,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +327,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +409,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +491,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +573,46 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +639,50 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +697,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +736,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +773,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +811,31 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +851,28 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +891,32 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +931,24 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +972,24 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1011,30 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1053,34 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1097,41 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1152,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1194,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1234,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1275,31 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1317,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1374,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1431,30 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1475,34 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1521,26 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1570,26 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1616,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1660,32 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1701,24 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1745,24 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1786,26 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1840,26 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1893,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1934,32 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1979,40 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.gax.rpc.BidiStream;
+   * 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 +2034,25 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2085,25 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2136,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2181,33 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +2225,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2267,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2306,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2347,31 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +2389,24 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2433,24 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2474,30 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2519,34 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +2566,41 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2628,25 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2691,25 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2754,25 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2817,25 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2877,31 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +2930,35 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +2976,28 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +3018,32 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3064,23 @@ public final UnaryCallable updateSnapshotCallab *

Sample code: * *

{@code
-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   subscriptionAdminClient.deleteSnapshot(snapshot);
+   * package com.google.cloud.pubsub.v1;
+   *
+   * 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 +3109,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +3152,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +3196,31 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3240,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +3283,30 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3323,28 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +3364,31 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3404,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +3445,32 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +3490,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +3535,33 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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..ef81bae680 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,31 @@ *

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.cloud.pubsub.v1;
+ *
+ * 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..4083cb705a 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,23 @@ * 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.cloud.pubsub.v1;
+ *
+ * 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 +114,43 @@ *

To customize credentials: * *

{@code
- * TopicAdminSettings topicAdminSettings =
- *     TopicAdminSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
+ * package com.google.cloud.pubsub.v1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class TopicAdminClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     topicAdminClientCreate();
+ *   }
+ *
+ *   public static void topicAdminClientCreate() 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.cloud.pubsub.v1;
+ *
+ * public class TopicAdminClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     topicAdminClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void topicAdminClientClassHeaderEndpoint() 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 +214,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +254,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +294,36 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +342,39 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +389,28 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +428,31 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +467,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +512,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +554,30 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +595,33 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +636,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +673,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +709,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +747,30 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +785,24 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +826,24 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +864,30 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +906,33 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +948,40 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +998,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1038,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1076,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1118,33 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1161,40 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1215,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1258,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1299,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1344,33 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1390,40 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1444,23 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(
    * 

Sample code: * *

{@code
-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   topicAdminClient.deleteTopic(topic);
+   * package com.google.cloud.pubsub.v1;
+   *
+   * 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 +1484,23 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1523,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1564,30 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1604,27 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1644,31 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1686,28 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1727,31 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1767,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1808,32 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1853,29 @@ 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.cloud.pubsub.v1;
+   *
+   * 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 +1898,33 @@ 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.cloud.pubsub.v1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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..ac44c7a901 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,30 @@ *

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.cloud.pubsub.v1;
+ *
+ * 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..737ed4df56 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,23 @@ *

Sample for TopicAdminClient: * *

{@code
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
- *   Topic response = topicAdminClient.createTopic(name);
+ * package com.google.cloud.pubsub.v1;
+ *
+ * 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 +56,29 @@ *

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.cloud.pubsub.v1;
+ *
+ * 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 +89,25 @@ *

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.cloud.pubsub.v1;
+ *
+ * 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..20ea368a4c 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,30 @@ *

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.cloud.pubsub.v1.stub;
+ *
+ * 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..3478c6d199 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,31 @@ *

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.cloud.pubsub.v1.stub;
+ *
+ * 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..b87e0e654b 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,31 @@ *

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.cloud.pubsub.v1.stub;
+ *
+ * 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..cc367d783c 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,20 @@ * 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.cloud.redis.v1beta1;
+ *
+ * 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 +113,43 @@ *

To customize credentials: * *

{@code
- * CloudRedisSettings cloudRedisSettings =
- *     CloudRedisSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
+ * package com.google.cloud.redis.v1beta1;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class CloudRedisClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     cloudRedisClientCreate();
+ *   }
+ *
+ *   public static void cloudRedisClientCreate() 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.cloud.redis.v1beta1;
+ *
+ * public class CloudRedisClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     cloudRedisClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void cloudRedisClientClassHeaderEndpoint() 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 +234,21 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +282,21 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +327,26 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +375,31 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +426,36 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +472,20 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +507,20 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +541,23 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +575,27 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +621,22 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +684,22 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +747,25 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +794,31 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * 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 +845,30 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +887,23 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +932,26 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +973,31 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * 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 +1017,30 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1055,21 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1096,21 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1134,24 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1169,30 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * 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 +1208,29 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1251,21 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1295,24 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1336,30 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * 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 +1381,29 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1423,21 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1466,24 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1506,30 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * 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 +1550,29 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1588,22 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1632,22 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1676,23 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1712,29 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * 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 +1751,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();
-   *   ApiFuture future = cloudRedisClient.failoverInstanceCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
+   * package com.google.cloud.redis.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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 +1787,22 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1824,22 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1860,25 @@ 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.cloud.redis.v1beta1;
+   *
+   * 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 +1896,30 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.gax.longrunning.OperationFuture;
+   * 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 +1935,28 @@ 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.cloud.redis.v1beta1;
+   *
+   * import com.google.api.core.ApiFuture;
+   * 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..655e42ef46 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,30 @@ *

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.cloud.redis.v1beta1;
+ *
+ * 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..96a1264672 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,20 @@ *

Sample for CloudRedisClient: * *

{@code
- * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- *   Instance response = cloudRedisClient.getInstance(name);
+ * package com.google.cloud.redis.v1beta1;
+ *
+ * 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..0275f3739e 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,30 @@ *

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.cloud.redis.v1beta1.stub;
+ *
+ * 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..a5ad65debe 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,25 @@ * 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.storage.v2;
+ *
+ * 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 +86,42 @@ *

To customize credentials: * *

{@code
- * StorageSettings storageSettings =
- *     StorageSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * StorageClient storageClient = StorageClient.create(storageSettings);
+ * package com.google.storage.v2;
+ *
+ * import com.google.api.gax.core.FixedCredentialsProvider;
+ *
+ * public class StorageClientCreate {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     storageClientCreate();
+ *   }
+ *
+ *   public static void storageClientCreate() 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.storage.v2;
+ *
+ * public class StorageClientClassHeaderEndpoint {
+ *
+ *   public static void main(String[] args) throws Exception {
+ *     storageClientClassHeaderEndpoint();
+ *   }
+ *
+ *   public static void storageClientClassHeaderEndpoint() 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 +184,39 @@ 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.storage.v2;
+   *
+   * import com.google.api.gax.rpc.ServerStream;
+   * import com.google.protobuf.FieldMask;
+   *
+   * 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 +251,48 @@ 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.storage.v2;
+   *
+   * import com.google.api.gax.rpc.ApiStreamObserver;
+   *
+   * 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 +309,25 @@ 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.storage.v2;
+   *
+   * 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 +346,30 @@ 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.storage.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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 +395,20 @@ public final StartResumableWriteResponse startResumableWrite(StartResumableWrite *

Sample code: * *

{@code
-   * try (StorageClient storageClient = StorageClient.create()) {
-   *   String uploadId = "uploadId1563990780";
-   *   QueryWriteStatusResponse response = storageClient.queryWriteStatus(uploadId);
+   * package com.google.storage.v2;
+   *
+   * 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 +439,25 @@ 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.storage.v2;
+   *
+   * 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 +485,30 @@ 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.storage.v2;
+   *
+   * import com.google.api.core.ApiFuture;
+   *
+   * 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..98d363266d 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,30 @@ *

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.storage.v2;
+ *
+ * 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..fe1cd16012 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,25 @@ *

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.storage.v2;
+ *
+ * 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..ce5a3fae3e 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,30 @@ *

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.storage.v2.stub;
+ *
+ * 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") From 78e13aa7f0e44eaed0f6ff117f462a331b5fa9da Mon Sep 17 00:00:00 2001 From: Emily Ball Date: Tue, 30 Nov 2021 17:36:03 -0800 Subject: [PATCH 07/13] chore: formatting --- .../engine/writer/ImportWriterVisitor.java | 1 - .../composer/samplecode/ExecutableSample.java | 26 +- .../samplecode/ExecutableSampleComposer.java | 190 +-- .../gapic/composer/samplecode/SampleUtil.java | 46 +- .../ServiceClientSampleCodeComposer.java | 206 ++- .../SettingsSampleCodeComposer.java | 10 +- .../ExecutableSampleComposerTest.java | 289 +++-- .../samplecode/SampleCodeWriterTest.java | 7 +- .../composer/samplecode/SampleUtilTest.java | 97 +- .../ServiceClientSampleCodeComposerTest.java | 1112 +++++++++-------- .../SettingsSampleCodeComposerTest.java | 111 +- 11 files changed, 1076 insertions(+), 1019 deletions(-) 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 ff29a2613d..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; 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 index b99f7f4371..ef26cf2f34 100644 --- 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 @@ -16,20 +16,22 @@ import com.google.api.generator.engine.ast.AssignmentExpr; import com.google.api.generator.engine.ast.Statement; - import java.util.List; public class ExecutableSample { - final String samplePackageName; - final String sampleMethodName; - final List sampleVariableAssignments; - final List sampleBody; + final String samplePackageName; + final String sampleMethodName; + final List sampleVariableAssignments; + final List sampleBody; - public ExecutableSample(String samplePackageName, String sampleMethodName, - List sampleVariableAssignments, List sampleBody) { - this.samplePackageName = samplePackageName; - this.sampleMethodName = sampleMethodName; - this.sampleVariableAssignments = sampleVariableAssignments; - this.sampleBody = sampleBody; - } + public ExecutableSample( + String samplePackageName, + String sampleMethodName, + List sampleVariableAssignments, + List sampleBody) { + this.samplePackageName = samplePackageName; + this.sampleMethodName = sampleMethodName; + this.sampleVariableAssignments = sampleVariableAssignments; + this.sampleBody = 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 index 798496f0f2..03c7d9e382 100644 --- 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 @@ -17,7 +17,6 @@ import com.google.api.generator.engine.ast.*; 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; @@ -25,98 +24,121 @@ import java.util.stream.Collectors; public class ExecutableSampleComposer { - public static String createExecutableSample(ExecutableSample executableSample){ - return SampleCodeWriter.write( - composeExecutableSample(executableSample.samplePackageName, executableSample.sampleMethodName, - executableSample.sampleVariableAssignments, executableSample.sampleBody)); - } + public static String createExecutableSample(ExecutableSample executableSample) { + return SampleCodeWriter.write( + composeExecutableSample( + executableSample.samplePackageName, + executableSample.sampleMethodName, + executableSample.sampleVariableAssignments, + executableSample.sampleBody)); + } - public static Optional createExecutableSample(Optional executableSample){ - if (executableSample.isPresent()) { - ExecutableSample sample = executableSample.get(); - return Optional.of(SampleCodeWriter.write( + public static Optional createExecutableSample( + Optional executableSample) { + if (executableSample.isPresent()) { + ExecutableSample sample = executableSample.get(); + return Optional.of( + SampleCodeWriter.write( composeExecutableSample( - sample.samplePackageName, - sample.sampleMethodName, - sample.sampleVariableAssignments, - sample.sampleBody))); - } - return Optional.empty(); + sample.samplePackageName, + sample.sampleMethodName, + sample.sampleVariableAssignments, + sample.sampleBody))); } + return Optional.empty(); + } - static ClassDefinition composeExecutableSample(String samplePackageName, String sampleMethodName, - List sampleVariableAssignments, - List sampleBody){ + static ClassDefinition composeExecutableSample( + String samplePackageName, + 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( - samplePackageName, - sampleClassName, - mainMethod, - sampleMethod); - } + 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(samplePackageName, sampleClassName, mainMethod, sampleMethod); + } - static List composeSampleMethodArgs(List sampleVariableAssignments){ - return sampleVariableAssignments.stream() - .map(v -> v.variableExpr().toBuilder().setIsDecl(true).build()) - .collect(Collectors.toList()); - } + static List composeSampleMethodArgs( + List sampleVariableAssignments) { + return sampleVariableAssignments.stream() + .map(v -> v.variableExpr().toBuilder().setIsDecl(true).build()) + .collect(Collectors.toList()); + } - 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()); - } + 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()); + } - 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; - } + 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; + } - static ClassDefinition composeSampleClass(String samplePackageName, String sampleClassName, - MethodDefinition mainMethod, MethodDefinition sampleMethod){ - return ClassDefinition.builder() - .setScope(ScopeNode.PUBLIC) - .setPackageString(samplePackageName) - .setName(sampleClassName) - .setMethods(ImmutableList.of(mainMethod, sampleMethod)) - .build(); - } + static ClassDefinition composeSampleClass( + String samplePackageName, + String sampleClassName, + MethodDefinition mainMethod, + MethodDefinition sampleMethod) { + return ClassDefinition.builder() + .setScope(ScopeNode.PUBLIC) + .setPackageString(samplePackageName) + .setName(sampleClassName) + .setMethods(ImmutableList.of(mainMethod, sampleMethod)) + .build(); + } - 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(); - } + 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(); + } - 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(); - } + 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/SampleUtil.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleUtil.java index 4f13fa7e4a..a074bf8b78 100644 --- 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 @@ -18,29 +18,33 @@ import com.google.api.generator.gapic.utils.JavaStyle; public class SampleUtil { - public static String composeSampleMethodName(String clientName, String methodName){ - if (clientName.equals("") || methodName.equals("")) { - throw new IllegalArgumentException("clientName and methodName must exist"); - } - return JavaStyle.toLowerCamelCase(clientName + JavaStyle.toUpperCamelCase(methodName)); + public static String composeSampleMethodName(String clientName, String methodName) { + if (clientName.equals("") || methodName.equals("")) { + throw new IllegalArgumentException("clientName and methodName must exist"); } + return JavaStyle.toLowerCamelCase(clientName + JavaStyle.toUpperCamelCase(methodName)); + } - public static MethodInvocationExpr systemOutPrint(String content){ - return composeSystemOutPrint(ValueExpr.withValue(StringObjectValue.withValue(content))); - } + 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()); - } + public static MethodInvocationExpr systemOutPrint(VariableExpr variableExpr) { + return composeSystemOutPrint(variableExpr.toBuilder().setIsDecl(false).build()); + } - static MethodInvocationExpr composeSystemOutPrint(Expr content){ - VaporReference out = VaporReference.builder() - .setSupertypeReference(ConcreteReference.withClazz(System.class)) - .setEnclosingClassNames("System").setName("out").setPakkage("java.lang").build(); - return MethodInvocationExpr.builder() - .setStaticReferenceType(TypeNode.withReference(out)) - .setMethodName("println") - .setArguments(content) - .build(); - } + static MethodInvocationExpr composeSystemOutPrint(Expr content) { + VaporReference out = + VaporReference.builder() + .setSupertypeReference(ConcreteReference.withClazz(System.class)) + .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 a2c00aacbe..12cc213372 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; @@ -63,9 +66,6 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; -import static com.google.api.generator.gapic.composer.samplecode.ExecutableSampleComposer.createExecutableSample; -import static com.google.api.generator.gapic.composer.samplecode.SampleUtil.composeSampleMethodName; - public class ServiceClientSampleCodeComposer { public static String composeClassHeaderMethodSampleCode( @@ -82,14 +82,17 @@ public static String composeClassHeaderMethodSampleCode( .orElse(service.methods().get(0)); if (method.stream() == Stream.NONE) { if (method.methodSignatures().isEmpty()) { - return createExecutableSample(composeRpcDefaultMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + return createExecutableSample( + composeRpcDefaultMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); } - return createExecutableSample(composeRpcMethodHeaderSampleCode( - method, clientType, method.methodSignatures().get(0), resourceNames, messageTypes)); + return createExecutableSample( + composeRpcMethodHeaderSampleCode( + method, clientType, method.methodSignatures().get(0), resourceNames, messageTypes)); } - return createExecutableSample(composeStreamCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + return createExecutableSample( + composeStreamCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); } public static ExecutableSample composeClassHeaderCredentialsSampleCode( @@ -102,10 +105,7 @@ public static ExecutableSample composeClassHeaderCredentialsSampleCode( String packageName = clientType.reference().pakkage(); TypeNode myCredentialsType = TypeNode.withReference( - VaporReference.builder() - .setName("myCredentials") - .setPakkage(packageName) - .build()); + VaporReference.builder().setName("myCredentials").setPakkage(packageName).build()); VariableExpr settingsVarExpr = VariableExpr.withVariable( Variable.builder().setName(settingsName).setType(settingsType).build()); @@ -160,15 +160,12 @@ public static ExecutableSample composeClassHeaderCredentialsSampleCode( .setValueExpr(createMethodExpr) .build(); - List sampleBody = Arrays.asList( - ExprStatement.withExpr(initSettingsVarExpr), - ExprStatement.withExpr(initClientVarExpr)); + List sampleBody = + Arrays.asList( + ExprStatement.withExpr(initSettingsVarExpr), ExprStatement.withExpr(initClientVarExpr)); return new ExecutableSample( - packageName, - composeSampleMethodName(clientName, "create"), - new ArrayList<>(), - sampleBody); + packageName, composeSampleMethodName(clientName, "create"), new ArrayList<>(), sampleBody); } public static ExecutableSample composeClassHeaderEndpointSampleCode( @@ -180,10 +177,7 @@ public static ExecutableSample composeClassHeaderEndpointSampleCode( String packageName = clientType.reference().pakkage(); TypeNode myEndpointType = TypeNode.withReference( - VaporReference.builder() - .setName("myEndpoint") - .setPakkage(packageName) - .build()); + VaporReference.builder().setName("myEndpoint").setPakkage(packageName).build()); VariableExpr settingsVarExpr = VariableExpr.withVariable( Variable.builder().setName(settingsName).setType(settingsType).build()); @@ -231,15 +225,15 @@ public static ExecutableSample composeClassHeaderEndpointSampleCode( .setValueExpr(createMethodExpr) .build(); - List sampleBody = Arrays.asList( - ExprStatement.withExpr(initSettingsVarExpr), - ExprStatement.withExpr(initClientVarExpr)); + List sampleBody = + Arrays.asList( + ExprStatement.withExpr(initSettingsVarExpr), ExprStatement.withExpr(initClientVarExpr)); return new ExecutableSample( - packageName, - composeSampleMethodName(clientName, "ClassHeaderEndpoint"), - new ArrayList<>(), - sampleBody); + packageName, + composeSampleMethodName(clientName, "ClassHeaderEndpoint"), + new ArrayList<>(), + sampleBody); } public static ExecutableSample composeRpcMethodHeaderSampleCode( @@ -251,10 +245,7 @@ public static ExecutableSample composeRpcMethodHeaderSampleCode( String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name()); VariableExpr clientVarExpr = VariableExpr.withVariable( - Variable.builder() - .setName(clientName) - .setType(clientType) - .build()); + Variable.builder().setName(clientName).setType(clientType).build()); // Assign method's arguments variable with the default values. List rpcMethodArgVarExprs = createRpcMethodArgumentVariableExprs(arguments); @@ -282,17 +273,19 @@ public static ExecutableSample composeRpcMethodHeaderSampleCode( method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs)); } - List sampleBody = Arrays.asList(TryCatchStatement.builder() - .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr)) - .setTryBody(bodyStatements) - .setIsSampleCode(true) - .build()); + List sampleBody = + Arrays.asList( + TryCatchStatement.builder() + .setTryResourceExpr(assignClientVariableWithCreateMethodExpr(clientVarExpr)) + .setTryBody(bodyStatements) + .setIsSampleCode(true) + .build()); String packageName = clientType.reference().pakkage(); return new ExecutableSample( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + packageName, + composeSampleMethodName(clientName, method.name()), + new ArrayList<>(), + sampleBody); } public static ExecutableSample composeRpcDefaultMethodHeaderSampleCode( @@ -304,10 +297,7 @@ public static ExecutableSample composeRpcDefaultMethodHeaderSampleCode( String packageName = clientType.reference().pakkage(); VariableExpr clientVarExpr = VariableExpr.withVariable( - Variable.builder() - .setName(clientName) - .setType(clientType) - .build()); + Variable.builder().setName(clientName).setType(clientType).build()); // Create request variable expression and assign with its default value. VariableExpr requestVarExpr = @@ -346,17 +336,19 @@ public static ExecutableSample composeRpcDefaultMethodHeaderSampleCode( method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs)); } - List sampleBody = Arrays.asList(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( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + packageName, + composeSampleMethodName(clientName, method.name()), + new ArrayList<>(), + sampleBody); } // Compose sample code for the method where it is CallableMethodKind.LRO. @@ -369,10 +361,7 @@ public static ExecutableSample composeLroCallableMethodHeaderSampleCode( String packageName = clientType.reference().pakkage(); VariableExpr clientVarExpr = VariableExpr.withVariable( - Variable.builder() - .setName(clientName) - .setType(clientType) - .build()); + Variable.builder().setName(clientName).setType(clientType).build()); // Assign method's request variable with the default value. VariableExpr requestVarExpr = VariableExpr.withVariable( @@ -465,17 +454,19 @@ public static ExecutableSample composeLroCallableMethodHeaderSampleCode( bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList())); bodyExprs.clear(); - List sampleBody = Arrays.asList(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( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + packageName, + composeSampleMethodName(clientName, method.name()), + new ArrayList<>(), + sampleBody); } // Compose sample code for the method where it is CallableMethodKind.PAGED. @@ -488,10 +479,7 @@ public static ExecutableSample composePagedCallableMethodHeaderSampleCode( String packageName = clientType.reference().pakkage(); VariableExpr clientVarExpr = VariableExpr.withVariable( - Variable.builder() - .setName(clientName) - .setType(clientType) - .build()); + Variable.builder().setName(clientName).setType(clientType).build()); // Assign method's request variable with the default value. VariableExpr requestVarExpr = VariableExpr.withVariable( @@ -591,17 +579,19 @@ public static ExecutableSample composePagedCallableMethodHeaderSampleCode( .build(); bodyStatements.add(repeatedResponseForStatement); - List sampleBody = Arrays.asList(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( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + packageName, + composeSampleMethodName(clientName, method.name()), + new ArrayList<>(), + sampleBody); } // Compose sample code for the method where it is CallableMethodKind.REGULAR. @@ -614,10 +604,7 @@ public static ExecutableSample composeRegularCallableMethodHeaderSampleCode( String packageName = clientType.reference().pakkage(); VariableExpr clientVarExpr = VariableExpr.withVariable( - Variable.builder() - .setName(clientName) - .setType(clientType) - .build()); + Variable.builder().setName(clientName).setType(clientType).build()); // Assign method's request variable with the default value. VariableExpr requestVarExpr = @@ -648,17 +635,19 @@ public static ExecutableSample composeRegularCallableMethodHeaderSampleCode( composeUnaryOrLroCallableBodyStatements(method, clientVarExpr, requestVarExpr)); } - List sampleBody = Arrays.asList(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( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + packageName, + composeSampleMethodName(clientName, method.name()), + new ArrayList<>(), + sampleBody); } public static ExecutableSample composeStreamCallableMethodHeaderSampleCode( @@ -670,10 +659,7 @@ public static ExecutableSample composeStreamCallableMethodHeaderSampleCode( String packageName = clientType.reference().pakkage(); VariableExpr clientVarExpr = VariableExpr.withVariable( - Variable.builder() - .setName(clientName) - .setType(clientType) - .build()); + Variable.builder().setName(clientName).setType(clientType).build()); // Assign method's request variable with the default value. VariableExpr requestVarExpr = VariableExpr.withVariable( @@ -704,17 +690,19 @@ public static ExecutableSample composeStreamCallableMethodHeaderSampleCode( composeStreamClientBodyStatements(method, clientVarExpr, requestAssignmentExpr)); } - List sampleBody = Arrays.asList(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( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + packageName, + 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 9a1d320e15..2d2578f8ff 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 @@ -33,8 +33,6 @@ import java.util.Optional; import java.util.stream.Collectors; -import static com.google.api.generator.gapic.composer.samplecode.SampleUtil.composeSampleMethodName; - public final class SettingsSampleCodeComposer { public static Optional composeSampleCode( @@ -121,11 +119,7 @@ public static Optional composeSampleCode( // Initialize clientSetting with builder() method. // e.g: FoobarSettings foobarSettings = foobarSettingsBuilder.build(); VariableExpr settingsVarExpr = - VariableExpr.withVariable( - Variable.builder() - .setType(classType) - .setName(name) - .build()); + VariableExpr.withVariable(Variable.builder().setType(classType).setName(name).build()); AssignmentExpr settingBuildAssignmentExpr = AssignmentExpr.builder() .setVariableExpr(settingsVarExpr.toBuilder().setIsDecl(true).build()) @@ -146,8 +140,6 @@ public static Optional composeSampleCode( .map(e -> ExprStatement.withExpr(e)) .collect(Collectors.toList()); - - return Optional.of(new ExecutableSample(packageName, name, new ArrayList<>(), sampleBody)); } } 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 index 742e8f8641..3a3d448f5d 100644 --- 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 @@ -14,143 +14,168 @@ package com.google.api.generator.gapic.composer.samplecode; +import static org.junit.Assert.assertEquals; + import com.google.api.generator.engine.ast.*; import com.google.api.generator.testutils.LineFormatter; import com.google.common.collect.ImmutableList; -import org.junit.Test; - import java.util.ArrayList; - -import static org.junit.Assert.assertEquals; +import org.junit.Test; public class ExecutableSampleComposerTest { - @Test - public void createExecutableSampleEmptySample() { - String packageName = "com.google.example"; - String sampleMethodName = "echoClientWait"; - - ExecutableSample executableSample = new ExecutableSample(packageName, 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 packageName = "com.google.example"; - String sampleMethodName = "echoClientWait"; - Statement sampleBody = ExprStatement.withExpr(SampleUtil.systemOutPrint("Testing " + sampleMethodName)); - ExecutableSample executableSample = new ExecutableSample(packageName, 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 packageName = "com.google.example"; - 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(packageName, 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 packageName = "com.google.example"; - 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(packageName, 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); - } + @Test + public void createExecutableSampleEmptySample() { + String packageName = "com.google.example"; + String sampleMethodName = "echoClientWait"; + + ExecutableSample executableSample = + new ExecutableSample(packageName, 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 packageName = "com.google.example"; + String sampleMethodName = "echoClientWait"; + Statement sampleBody = + ExprStatement.withExpr(SampleUtil.systemOutPrint("Testing " + sampleMethodName)); + ExecutableSample executableSample = + new ExecutableSample( + packageName, 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 packageName = "com.google.example"; + 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( + packageName, + 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 packageName = "com.google.example"; + 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( + packageName, + 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 e0495a4211..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 @@ -14,16 +14,15 @@ package com.google.api.generator.gapic.composer.samplecode; +import static junit.framework.TestCase.assertEquals; + import com.google.api.gax.rpc.ClientSettings; 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; -import java.util.Arrays; - -import static junit.framework.TestCase.assertEquals; - public class SampleCodeWriterTest { private static String packageName; private static MethodInvocationExpr methodInvocationExpr; 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 index 64a24760bc..0b647c0b37 100644 --- 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 @@ -14,70 +14,71 @@ package com.google.api.generator.gapic.composer.samplecode; -import com.google.api.generator.engine.ast.*; -import org.junit.Test; - -import java.util.UUID; 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"; + @Test + public void composeSampleMethodName() { + String expected = "echoClientWait"; - String clientName = "EchoClient"; - String methodName = "wait"; - String result = SampleUtil.composeSampleMethodName(clientName, methodName); - assertEquals(expected, result); + 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); + 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() { + @Test + public void composeSampleMethodNameEmpty() { String emptyclientName = ""; String methodName = "wait"; assertThrows( - IllegalArgumentException.class, - () -> SampleUtil.composeSampleMethodName(emptyclientName, methodName)); + IllegalArgumentException.class, + () -> SampleUtil.composeSampleMethodName(emptyclientName, methodName)); String clientName = "EchoClient"; String emptyMethodName = ""; assertThrows( - IllegalArgumentException.class, - () -> SampleUtil.composeSampleMethodName(clientName, emptyMethodName));; - - } + 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 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); - } + @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 753411c348..513f62ce7f 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 @@ -71,20 +71,20 @@ public void composeClassHeaderMethodSampleCode_unaryRpc() { echoProtoService, clientType, resourceNames, messageTypes); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\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"); + "package com.google.showcase.v1beta1;\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); } @@ -164,23 +164,23 @@ public void composeClassHeaderMethodSampleCode_firstMethodIsNotUnaryRpc() { service, clientType, resourceNames, messageTypes); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.protobuf.Duration;\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.protobuf.Duration;\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); } @@ -230,27 +230,27 @@ public void composeClassHeaderMethodSampleCode_firstMethodHasNoSignatures() { service, clientType, resourceNames, messageTypes); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\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"); + "package com.google.showcase.v1beta1;\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); } @@ -300,27 +300,27 @@ public void composeClassHeaderMethodSampleCode_firstMethodIsStream() { service, clientType, resourceNames, messageTypes); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.api.gax.rpc.ServerStream;\n", - "\n", - "public class EchoClientExpand {\n", - "\n", - " public static void main(String[] args) throws Exception {\n", - " echoClientExpand();\n", - " }\n", - "\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.rpc.ServerStream;\n", + "\n", + "public class EchoClientExpand {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientExpand();\n", + " }\n", + "\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); } @@ -339,28 +339,29 @@ public void composeClassHeaderCredentialsSampleCode() { .setPakkage(SHOWCASE_PACKAGE_NAME) .build()); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeClassHeaderCredentialsSampleCode( - clientType, settingsType)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeClassHeaderCredentialsSampleCode( + clientType, settingsType)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.api.gax.core.FixedCredentialsProvider;\n", - "\n", - "public class EchoClientCreate {\n", - "\n", - " public static void main(String[] args) throws Exception {\n", - " echoClientCreate();\n", - " }\n", - "\n", - " public static void echoClientCreate() throws Exception {\n", - " EchoSettings echoSettings =\n", - " EchoSettings.newBuilder()\n", - " .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))\n", - " .build();\n", - " EchoClient echoClient = EchoClient.create(echoSettings);\n", - " }\n", - "}\n"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.core.FixedCredentialsProvider;\n", + "\n", + "public class EchoClientCreate {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientCreate();\n", + " }\n", + "\n", + " public static void echoClientCreate() 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); } @@ -379,23 +380,24 @@ public void composeClassHeaderEndpointSampleCode() { .setPakkage(SHOWCASE_PACKAGE_NAME) .build()); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeClassHeaderEndpointSampleCode( - clientType, settingsType)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeClassHeaderEndpointSampleCode( + clientType, settingsType)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "public class EchoClientClassHeaderEndpoint {\n", - "\n", - " public static void main(String[] args) throws Exception {\n", - " echoClientClassHeaderEndpoint();\n", - " }\n", - "\n", - " public static void echoClientClassHeaderEndpoint() throws Exception {\n", - " EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();\n", - " EchoClient echoClient = EchoClient.create(echoSettings);\n", - " }\n", - "}\n"); + "package com.google.showcase.v1beta1;\n", + "\n", + "public class EchoClientClassHeaderEndpoint {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientClassHeaderEndpoint();\n", + " }\n", + "\n", + " public static void echoClientClassHeaderEndpoint() throws Exception {\n", + " EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();\n", + " EchoClient echoClient = EchoClient.create(echoSettings);\n", + " }\n", + "}\n"); assertEquals(expected, results); } @@ -1105,31 +1107,32 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithMultipleMethodArgu messageTypes.put("com.google.showcase.v1beta1.ListContentResponse", listContentResponseMessage); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( - method, clientType, arguments, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( + method, clientType, arguments, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\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", - "\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"); + "package com.google.showcase.v1beta1;\n", + "\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", + "\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); } @@ -1191,26 +1194,27 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithNoMethodArguments( messageTypes.put("com.google.showcase.v1beta1.ListContentResponse", listContentResponseMessage); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( - method, clientType, arguments, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( + method, clientType, arguments, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "public class EchoClientListContent {\n", - "\n", - " public static void main(String[] args) throws Exception {\n", - " echoClientListContent();\n", - " }\n", - "\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "public class EchoClientListContent {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientListContent();\n", + " }\n", + "\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); } @@ -1362,24 +1366,25 @@ public void validComposeRpcMethodHeaderSampleCode_lroUnaryRpcWithNoMethodArgumen .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( - method, clientType, Collections.emptyList(), resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( + method, clientType, Collections.emptyList(), resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\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"); + "package com.google.showcase.v1beta1;\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); } @@ -1446,27 +1451,28 @@ public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnResponseType() .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( - method, clientType, arguments, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( + method, clientType, arguments, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.protobuf.Duration;\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.protobuf.Duration;\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); } @@ -1530,28 +1536,29 @@ public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnVoid() { .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( - method, clientType, arguments, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcMethodHeaderSampleCode( + method, clientType, arguments, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.protobuf.Duration;\n", - "import com.google.protobuf.Empty;\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.protobuf.Duration;\n", + "import com.google.protobuf.Empty;\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); } @@ -1588,32 +1595,33 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_isPagedMethod() { .setPageSizeFieldName(PAGINATED_FIELD_NAME) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\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", - " for (EchoResponse element : echoClient.pagedExpand(request).iterateAll()) {\n", - " // doThingsWith(element);\n", - " }\n", - " }\n", - " }\n", - "}\n"); + "package com.google.showcase.v1beta1;\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", + " for (EchoResponse element : echoClient.pagedExpand(request).iterateAll()) {\n", + " // doThingsWith(element);\n", + " }\n", + " }\n", + " }\n", + "}\n"); assertEquals(expected, results); } @@ -1698,27 +1706,28 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_hasLroMethodWithReturnR .setLro(lro) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.protobuf.Empty;\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.protobuf.Empty;\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); } @@ -1768,25 +1777,26 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_hasLroMethodWithReturnV .setLro(lro) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\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"); + "package com.google.showcase.v1beta1;\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); } @@ -1818,33 +1828,34 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_pureUnaryReturnVoid() { .setMethodSignatures(Collections.emptyList()) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.protobuf.Empty;\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.protobuf.Empty;\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); } @@ -1879,31 +1890,32 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_pureUnaryReturnResponse .setMethodSignatures(Collections.emptyList()) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRpcDefaultMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\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"); + "package com.google.showcase.v1beta1;\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); } @@ -1953,30 +1965,31 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnResponse() { .setLro(lro) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeLroCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeLroCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.api.gax.longrunning.OperationFuture;\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.longrunning.OperationFuture;\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); } @@ -2022,31 +2035,32 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnVoid() { .setLro(lro) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeLroCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeLroCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.api.gax.longrunning.OperationFuture;\n", - "import com.google.protobuf.Empty;\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.longrunning.OperationFuture;\n", + "import com.google.protobuf.Empty;\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); } @@ -2082,36 +2096,37 @@ public void validComposePagedCallableMethodHeaderSampleCode() { .setPageSizeFieldName(PAGINATED_FIELD_NAME) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composePagedCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composePagedCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.api.core.ApiFuture;\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", - " ApiFuture future = echoClient.pagedExpandPagedCallable().futureCall(request);\n", - " // Do something.\n", - " for (EchoResponse element : future.get().iterateAll()) {\n", - " // doThingsWith(element);\n", - " }\n", - " }\n", - " }\n", - "}\n"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.core.ApiFuture;\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", + " 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); } @@ -2272,31 +2287,32 @@ public void validComposeStreamCallableMethodHeaderSampleCode_serverStream() { .setStream(Stream.SERVER) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.api.gax.rpc.ServerStream;\n", - "\n", - "public class EchoClientExpand {\n", - "\n", - " public static void main(String[] args) throws Exception {\n", - " echoClientExpand();\n", - " }\n", - "\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.rpc.ServerStream;\n", + "\n", + "public class EchoClientExpand {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientExpand();\n", + " }\n", + "\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); } @@ -2368,37 +2384,38 @@ public void validComposeStreamCallableMethodHeaderSampleCode_bidiStream() { .setStream(Stream.BIDI) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.api.gax.rpc.BidiStream;\n", - "\n", - "public class EchoClientChat {\n", - "\n", - " public static void main(String[] args) throws Exception {\n", - " echoClientChat();\n", - " }\n", - "\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.gax.rpc.BidiStream;\n", + "\n", + "public class EchoClientChat {\n", + "\n", + " public static void main(String[] args) throws Exception {\n", + " echoClientChat();\n", + " }\n", + "\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); } @@ -2470,8 +2487,9 @@ public void validComposeStreamCallableMethodHeaderSampleCode_clientStream() { .setStream(Stream.CLIENT) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( "package com.google.showcase.v1beta1;\n", @@ -2583,35 +2601,36 @@ public void validComposeRegularCallableMethodHeaderSampleCode_unaryRpc() { Method method = Method.builder().setName("Echo").setInputType(inputType).setOutputType(outputType).build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.api.core.ApiFuture;\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.core.ApiFuture;\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); } @@ -2660,30 +2679,31 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpc() { .setLro(lro) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.api.core.ApiFuture;\n", - "import com.google.longrunning.Operation;\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.core.ApiFuture;\n", + "import com.google.longrunning.Operation;\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); } @@ -2729,30 +2749,31 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpcWithReturnVo .setLro(lro) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.api.core.ApiFuture;\n", - "import com.google.longrunning.Operation;\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"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.api.core.ApiFuture;\n", + "import com.google.longrunning.Operation;\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); } @@ -2788,43 +2809,44 @@ public void validComposeRegularCallableMethodHeaderSampleCode_pageRpc() { .setPageSizeFieldName(PAGINATED_FIELD_NAME) .build(); String results = - createExecutableSample(ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( - method, clientType, resourceNames, messageTypes)); + createExecutableSample( + ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( + method, clientType, resourceNames, messageTypes)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\n", - "import com.google.common.base.Strings;\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", - "}\n"); + "package com.google.showcase.v1beta1;\n", + "\n", + "import com.google.common.base.Strings;\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", + "}\n"); assertEquals(expected, results); } 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 5ca35fb44e..e9ba58da1c 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,8 +32,9 @@ public void composeSettingsSampleCode_noMethods() { .setPakkage("com.google.showcase.v1beta1") .build()); Optional results = - ExecutableSampleComposer.createExecutableSample(SettingsSampleCodeComposer - .composeSampleCode(Optional.empty(), "EchoSettings", classType)); + ExecutableSampleComposer.createExecutableSample( + SettingsSampleCodeComposer.composeSampleCode( + Optional.empty(), "EchoSettings", classType)); assertEquals(results, Optional.empty()); } @@ -45,35 +46,36 @@ public void composeSettingsSampleCode_serviceSettingsClass() { .setName("EchoSettings") .setPakkage("com.google.showcase.v1beta1") .build()); - Optional results = ExecutableSampleComposer.createExecutableSample( + Optional results = + ExecutableSampleComposer.createExecutableSample( SettingsSampleCodeComposer.composeSampleCode( - Optional.of("Echo"), "EchoSettings", classType)); + Optional.of("Echo"), "EchoSettings", classType)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\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"); + "package com.google.showcase.v1beta1;\n", + "\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()); } @@ -86,34 +88,35 @@ public void composeSettingsSampleCode_serviceStubClass() { .setPakkage("com.google.showcase.v1beta1") .build()); Optional results = - ExecutableSampleComposer.createExecutableSample(SettingsSampleCodeComposer.composeSampleCode( - Optional.of("Echo"), "EchoSettings", classType)); + ExecutableSampleComposer.createExecutableSample( + SettingsSampleCodeComposer.composeSampleCode( + Optional.of("Echo"), "EchoSettings", classType)); String expected = LineFormatter.lines( - "package com.google.showcase.v1beta1;\n", - "\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"); + "package com.google.showcase.v1beta1;\n", + "\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()); } } From 066fc4dd6766cb55ce63dd5c7ffa42f4438984be Mon Sep 17 00:00:00 2001 From: Emily Ball Date: Wed, 1 Dec 2021 15:43:12 -0800 Subject: [PATCH 08/13] use example package instead and include needed imports --- .../composer/samplecode/ExecutableSample.java | 3 - .../samplecode/ExecutableSampleComposer.java | 16 +- .../ServiceClientSampleCodeComposer.java | 55 +- .../SettingsSampleCodeComposer.java | 3 +- .../grpc/goldens/BookshopClient.golden | 33 +- .../goldens/DeprecatedServiceClient.golden | 31 +- .../goldens/DeprecatedServiceSettings.golden | 3 +- .../DeprecatedServiceStubSettings.golden | 3 +- .../composer/grpc/goldens/EchoClient.golden | 196 +++++- .../composer/grpc/goldens/EchoSettings.golden | 3 +- .../grpc/goldens/EchoStubSettings.golden | 3 +- .../grpc/goldens/IdentityClient.golden | 119 +++- .../LoggingServiceV2StubSettings.golden | 3 +- .../grpc/goldens/MessagingClient.golden | 283 ++++++-- .../grpc/goldens/PublisherStubSettings.golden | 3 +- .../rest/goldens/ComplianceSettings.golden | 3 +- .../goldens/ComplianceStubSettings.golden | 3 +- .../ExecutableSampleComposerTest.java | 15 +- .../ServiceClientSampleCodeComposerTest.java | 146 ++++- .../SettingsSampleCodeComposerTest.java | 6 +- .../cloud/asset/v1/AssetServiceClient.java | 273 ++++++-- .../cloud/asset/v1/AssetServiceSettings.java | 3 +- .../google/cloud/asset/v1/package-info.java | 10 +- .../v1/stub/AssetServiceStubSettings.java | 3 +- .../cloud/compute/v1/AddressesClient.java | 101 ++- .../cloud/compute/v1/AddressesSettings.java | 3 +- .../compute/v1/RegionOperationsClient.java | 48 +- .../compute/v1/RegionOperationsSettings.java | 3 +- .../google/cloud/compute/v1/package-info.java | 9 +- .../v1/stub/AddressesStubSettings.java | 3 +- .../v1/stub/RegionOperationsStubSettings.java | 3 +- .../credentials/v1/IamCredentialsClient.java | 104 ++- .../v1/IamCredentialsSettings.java | 3 +- .../iam/credentials/v1/package-info.java | 5 +- .../v1/stub/IamCredentialsStubSettings.java | 3 +- .../com/google/iam/v1/IAMPolicyClient.java | 51 +- .../com/google/iam/v1/IAMPolicySettings.java | 3 +- .../iam/com/google/iam/v1/package-info.java | 6 +- .../iam/v1/stub/IAMPolicyStubSettings.java | 3 +- .../kms/v1/KeyManagementServiceClient.java | 611 +++++++++++++++--- .../kms/v1/KeyManagementServiceSettings.java | 3 +- .../com/google/cloud/kms/v1/package-info.java | 6 +- .../KeyManagementServiceStubSettings.java | 3 +- .../library/v1/LibraryServiceClient.java | 152 +++-- .../library/v1/LibraryServiceSettings.java | 3 +- .../example/library/v1/package-info.java | 3 +- .../v1/stub/LibraryServiceStubSettings.java | 3 +- .../google/cloud/logging/v2/ConfigClient.java | 284 +++++--- .../cloud/logging/v2/ConfigSettings.java | 3 +- .../cloud/logging/v2/LoggingClient.java | 86 ++- .../cloud/logging/v2/LoggingSettings.java | 3 +- .../cloud/logging/v2/MetricsClient.java | 77 ++- .../cloud/logging/v2/MetricsSettings.java | 3 +- .../google/cloud/logging/v2/package-info.java | 9 +- .../v2/stub/ConfigServiceV2StubSettings.java | 3 +- .../v2/stub/LoggingServiceV2StubSettings.java | 3 +- .../v2/stub/MetricsServiceV2StubSettings.java | 3 +- .../cloud/pubsub/v1/SchemaServiceClient.java | 101 ++- .../pubsub/v1/SchemaServiceSettings.java | 3 +- .../pubsub/v1/SubscriptionAdminClient.java | 221 ++++--- .../pubsub/v1/SubscriptionAdminSettings.java | 3 +- .../cloud/pubsub/v1/TopicAdminClient.java | 137 ++-- .../cloud/pubsub/v1/TopicAdminSettings.java | 3 +- .../google/cloud/pubsub/v1/package-info.java | 9 +- .../pubsub/v1/stub/PublisherStubSettings.java | 3 +- .../v1/stub/SchemaServiceStubSettings.java | 3 +- .../v1/stub/SubscriberStubSettings.java | 3 +- .../cloud/redis/v1beta1/CloudRedisClient.java | 257 ++++++-- .../redis/v1beta1/CloudRedisSettings.java | 3 +- .../cloud/redis/v1beta1/package-info.java | 6 +- .../v1beta1/stub/CloudRedisStubSettings.java | 3 +- .../com/google/storage/v2/StorageClient.java | 72 ++- .../google/storage/v2/StorageSettings.java | 3 +- .../com/google/storage/v2/package-info.java | 9 +- .../storage/v2/stub/StorageStubSettings.java | 3 +- 75 files changed, 2796 insertions(+), 871 deletions(-) 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 index ef26cf2f34..4d65484a32 100644 --- 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 @@ -19,17 +19,14 @@ import java.util.List; public class ExecutableSample { - final String samplePackageName; final String sampleMethodName; final List sampleVariableAssignments; final List sampleBody; public ExecutableSample( - String samplePackageName, String sampleMethodName, List sampleVariableAssignments, List sampleBody) { - this.samplePackageName = samplePackageName; this.sampleMethodName = sampleMethodName; this.sampleVariableAssignments = sampleVariableAssignments; this.sampleBody = 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 index 03c7d9e382..e61b91a300 100644 --- 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 @@ -27,7 +27,6 @@ public class ExecutableSampleComposer { public static String createExecutableSample(ExecutableSample executableSample) { return SampleCodeWriter.write( composeExecutableSample( - executableSample.samplePackageName, executableSample.sampleMethodName, executableSample.sampleVariableAssignments, executableSample.sampleBody)); @@ -40,16 +39,12 @@ public static Optional createExecutableSample( return Optional.of( SampleCodeWriter.write( composeExecutableSample( - sample.samplePackageName, - sample.sampleMethodName, - sample.sampleVariableAssignments, - sample.sampleBody))); + sample.sampleMethodName, sample.sampleVariableAssignments, sample.sampleBody))); } return Optional.empty(); } static ClassDefinition composeExecutableSample( - String samplePackageName, String sampleMethodName, List sampleVariableAssignments, List sampleBody) { @@ -63,7 +58,7 @@ static ClassDefinition composeExecutableSample( composeInvokeMethodStatement(sampleMethodName, sampleMethodArgs))); MethodDefinition sampleMethod = composeSampleMethod(sampleMethodName, sampleMethodArgs, sampleBody); - return composeSampleClass(samplePackageName, sampleClassName, mainMethod, sampleMethod); + return composeSampleClass(sampleClassName, mainMethod, sampleMethod); } static List composeSampleMethodArgs( @@ -98,13 +93,10 @@ static List composeMainBody( } static ClassDefinition composeSampleClass( - String samplePackageName, - String sampleClassName, - MethodDefinition mainMethod, - MethodDefinition sampleMethod) { + String sampleClassName, MethodDefinition mainMethod, MethodDefinition sampleMethod) { return ClassDefinition.builder() .setScope(ScopeNode.PUBLIC) - .setPackageString(samplePackageName) + .setPackageString("com.google.example") .setName(sampleClassName) .setMethods(ImmutableList.of(mainMethod, sampleMethod)) .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 12cc213372..08252fca7d 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 @@ -102,10 +102,12 @@ public static ExecutableSample composeClassHeaderCredentialsSampleCode( // EchoSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create("myCredentials")).build(); String settingsName = JavaStyle.toLowerCamelCase(settingsType.reference().name()); String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name()); - String packageName = clientType.reference().pakkage(); TypeNode myCredentialsType = TypeNode.withReference( - VaporReference.builder().setName("myCredentials").setPakkage(packageName).build()); + VaporReference.builder() + .setName("myCredentials") + .setPakkage(clientType.reference().pakkage()) + .build()); VariableExpr settingsVarExpr = VariableExpr.withVariable( Variable.builder().setName(settingsName).setType(settingsType).build()); @@ -165,7 +167,7 @@ public static ExecutableSample composeClassHeaderCredentialsSampleCode( ExprStatement.withExpr(initSettingsVarExpr), ExprStatement.withExpr(initClientVarExpr)); return new ExecutableSample( - packageName, composeSampleMethodName(clientName, "create"), new ArrayList<>(), sampleBody); + composeSampleMethodName(clientName, "create"), new ArrayList<>(), sampleBody); } public static ExecutableSample composeClassHeaderEndpointSampleCode( @@ -174,10 +176,12 @@ public static ExecutableSample composeClassHeaderEndpointSampleCode( // e.g. EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint("myEndpoint").build(); String settingsName = JavaStyle.toLowerCamelCase(settingsType.reference().name()); String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name()); - String packageName = clientType.reference().pakkage(); TypeNode myEndpointType = TypeNode.withReference( - VaporReference.builder().setName("myEndpoint").setPakkage(packageName).build()); + VaporReference.builder() + .setName("myEndpoint") + .setPakkage(clientType.reference().pakkage()) + .build()); VariableExpr settingsVarExpr = VariableExpr.withVariable( Variable.builder().setName(settingsName).setType(settingsType).build()); @@ -230,10 +234,7 @@ public static ExecutableSample composeClassHeaderEndpointSampleCode( ExprStatement.withExpr(initSettingsVarExpr), ExprStatement.withExpr(initClientVarExpr)); return new ExecutableSample( - packageName, - composeSampleMethodName(clientName, "ClassHeaderEndpoint"), - new ArrayList<>(), - sampleBody); + composeSampleMethodName(clientName, "ClassHeaderEndpoint"), new ArrayList<>(), sampleBody); } public static ExecutableSample composeRpcMethodHeaderSampleCode( @@ -280,12 +281,8 @@ public static ExecutableSample composeRpcMethodHeaderSampleCode( .setTryBody(bodyStatements) .setIsSampleCode(true) .build()); - String packageName = clientType.reference().pakkage(); return new ExecutableSample( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + composeSampleMethodName(clientName, method.name()), new ArrayList<>(), sampleBody); } public static ExecutableSample composeRpcDefaultMethodHeaderSampleCode( @@ -294,7 +291,6 @@ public static ExecutableSample composeRpcDefaultMethodHeaderSampleCode( Map resourceNames, Map messageTypes) { String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name()); - String packageName = clientType.reference().pakkage(); VariableExpr clientVarExpr = VariableExpr.withVariable( Variable.builder().setName(clientName).setType(clientType).build()); @@ -345,10 +341,7 @@ public static ExecutableSample composeRpcDefaultMethodHeaderSampleCode( .build()); return new ExecutableSample( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + composeSampleMethodName(clientName, method.name()), new ArrayList<>(), sampleBody); } // Compose sample code for the method where it is CallableMethodKind.LRO. @@ -358,7 +351,6 @@ public static ExecutableSample composeLroCallableMethodHeaderSampleCode( Map resourceNames, Map messageTypes) { String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name()); - String packageName = clientType.reference().pakkage(); VariableExpr clientVarExpr = VariableExpr.withVariable( Variable.builder().setName(clientName).setType(clientType).build()); @@ -463,10 +455,7 @@ public static ExecutableSample composeLroCallableMethodHeaderSampleCode( .build()); return new ExecutableSample( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + composeSampleMethodName(clientName, method.name()), new ArrayList<>(), sampleBody); } // Compose sample code for the method where it is CallableMethodKind.PAGED. @@ -476,7 +465,6 @@ public static ExecutableSample composePagedCallableMethodHeaderSampleCode( Map resourceNames, Map messageTypes) { String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name()); - String packageName = clientType.reference().pakkage(); VariableExpr clientVarExpr = VariableExpr.withVariable( Variable.builder().setName(clientName).setType(clientType).build()); @@ -588,10 +576,7 @@ public static ExecutableSample composePagedCallableMethodHeaderSampleCode( .build()); return new ExecutableSample( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + composeSampleMethodName(clientName, method.name()), new ArrayList<>(), sampleBody); } // Compose sample code for the method where it is CallableMethodKind.REGULAR. @@ -601,7 +586,6 @@ public static ExecutableSample composeRegularCallableMethodHeaderSampleCode( Map resourceNames, Map messageTypes) { String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name()); - String packageName = clientType.reference().pakkage(); VariableExpr clientVarExpr = VariableExpr.withVariable( Variable.builder().setName(clientName).setType(clientType).build()); @@ -644,10 +628,7 @@ public static ExecutableSample composeRegularCallableMethodHeaderSampleCode( .build()); return new ExecutableSample( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + composeSampleMethodName(clientName, method.name()), new ArrayList<>(), sampleBody); } public static ExecutableSample composeStreamCallableMethodHeaderSampleCode( @@ -656,7 +637,6 @@ public static ExecutableSample composeStreamCallableMethodHeaderSampleCode( Map resourceNames, Map messageTypes) { String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name()); - String packageName = clientType.reference().pakkage(); VariableExpr clientVarExpr = VariableExpr.withVariable( Variable.builder().setName(clientName).setType(clientType).build()); @@ -699,10 +679,7 @@ public static ExecutableSample composeStreamCallableMethodHeaderSampleCode( .build()); return new ExecutableSample( - packageName, - composeSampleMethodName(clientName, method.name()), - new ArrayList<>(), - sampleBody); + 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 2d2578f8ff..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 @@ -115,7 +115,6 @@ public static Optional composeSampleCode( .build(); String name = JavaStyle.toLowerCamelCase(settingsClassName); - String packageName = classType.reference().pakkage(); // Initialize clientSetting with builder() method. // e.g: FoobarSettings foobarSettings = foobarSettingsBuilder.build(); VariableExpr settingsVarExpr = @@ -140,6 +139,6 @@ public static Optional composeSampleCode( .map(e -> ExprStatement.withExpr(e)) .collect(Collectors.toList()); - return Optional.of(new ExecutableSample(packageName, name, new ArrayList<>(), sampleBody)); + 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 b83a8cba76..ff44517058 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,8 +16,10 @@ import javax.annotation.Generated; * that map to API methods. Sample code to get started: * *
{@code
- * package com.google.bookshop.v1beta1;
+ * package com.google.example;
  *
+ * import com.google.bookshop.v1beta1.Book;
+ * import com.google.bookshop.v1beta1.BookshopClient;
  * import java.util.ArrayList;
  * import java.util.List;
  *
@@ -66,9 +68,12 @@ import javax.annotation.Generated;
  * 

To customize credentials: * *

{@code
- * package com.google.bookshop.v1beta1;
+ * 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 BookshopClientCreate {
  *
@@ -89,7 +94,11 @@ import javax.annotation.Generated;
  * 

To customize the endpoint: * *

{@code
- * package com.google.bookshop.v1beta1;
+ * package com.google.example;
+ *
+ * import com.google.bookshop.v1beta1.BookshopClient;
+ * import com.google.bookshop.v1beta1.BookshopSettings;
+ * import com.google.bookshop.v1beta1.myEndpoint;
  *
  * public class BookshopClientClassHeaderEndpoint {
  *
@@ -164,8 +173,10 @@ public class BookshopClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.bookshop.v1beta1;
+   * package com.google.example;
    *
+   * import com.google.bookshop.v1beta1.Book;
+   * import com.google.bookshop.v1beta1.BookshopClient;
    * import java.util.ArrayList;
    * import java.util.List;
    *
@@ -200,8 +211,10 @@ public class BookshopClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.bookshop.v1beta1;
+   * package com.google.example;
    *
+   * import com.google.bookshop.v1beta1.Book;
+   * import com.google.bookshop.v1beta1.BookshopClient;
    * import java.util.ArrayList;
    * import java.util.List;
    *
@@ -236,8 +249,11 @@ public class BookshopClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.bookshop.v1beta1;
+   * 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 {
@@ -272,9 +288,12 @@ public class BookshopClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.bookshop.v1beta1;
+   * 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 {
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 bcf24b3360..cc41174103 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,11 @@ import javax.annotation.Generated;
  * that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.testdata.v1;
+ * package com.google.example;
  *
  * import com.google.protobuf.Empty;
+ * import com.google.testdata.v1.DeprecatedServiceClient;
+ * import com.google.testdata.v1.FibonacciRequest;
  *
  * public class DeprecatedServiceClientFastFibonacci {
  *
@@ -65,9 +67,12 @@ import javax.annotation.Generated;
  * 

To customize credentials: * *

{@code
- * package com.google.testdata.v1;
+ * 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 DeprecatedServiceClientCreate {
  *
@@ -89,7 +94,11 @@ import javax.annotation.Generated;
  * 

To customize the endpoint: * *

{@code
- * package com.google.testdata.v1;
+ * package com.google.example;
+ *
+ * import com.google.testdata.v1.DeprecatedServiceClient;
+ * import com.google.testdata.v1.DeprecatedServiceSettings;
+ * import com.google.testdata.v1.myEndpoint;
  *
  * public class DeprecatedServiceClientClassHeaderEndpoint {
  *
@@ -169,9 +178,11 @@ public class DeprecatedServiceClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.testdata.v1;
+   * package com.google.example;
    *
    * import com.google.protobuf.Empty;
+   * import com.google.testdata.v1.DeprecatedServiceClient;
+   * import com.google.testdata.v1.FibonacciRequest;
    *
    * public class DeprecatedServiceClientFastFibonacci {
    *
@@ -200,10 +211,12 @@ public class DeprecatedServiceClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.testdata.v1;
+   * 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 {
    *
@@ -231,9 +244,11 @@ public class DeprecatedServiceClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.testdata.v1;
+   * package com.google.example;
    *
    * import com.google.protobuf.Empty;
+   * import com.google.testdata.v1.DeprecatedServiceClient;
+   * import com.google.testdata.v1.FibonacciRequest;
    *
    * public class DeprecatedServiceClientSlowFibonacci {
    *
@@ -264,10 +279,12 @@ public class DeprecatedServiceClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.testdata.v1;
+   * 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 {
    *
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 03d79bb0b3..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,8 +35,9 @@ import javax.annotation.Generated;
  * 

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

{@code
- * package com.google.testdata.v1;
+ * package com.google.example;
  *
+ * import com.google.testdata.v1.DeprecatedServiceSettings;
  * import java.time.Duration;
  *
  * public class DeprecatedServiceSettings {
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 6ffb0f77c2..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,8 +44,9 @@ import org.threeten.bp.Duration;
  * 

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

{@code
- * package com.google.testdata.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.testdata.v1.stub.DeprecatedServiceStubSettings;
  * import java.time.Duration;
  *
  * public class DeprecatedServiceSettings {
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 5db74cd0d2..ee075aa115 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,7 +34,10 @@ import javax.annotation.Generated;
  * that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.showcase.v1beta1;
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.EchoClient;
+ * import com.google.showcase.v1beta1.EchoResponse;
  *
  * public class EchoClientEcho {
  *
@@ -79,9 +82,12 @@ import javax.annotation.Generated;
  * 

To customize credentials: * *

{@code
- * package com.google.showcase.v1beta1;
+ * 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 EchoClientCreate {
  *
@@ -102,7 +108,11 @@ import javax.annotation.Generated;
  * 

To customize the endpoint: * *

{@code
- * package com.google.showcase.v1beta1;
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.EchoClient;
+ * import com.google.showcase.v1beta1.EchoSettings;
+ * import com.google.showcase.v1beta1.myEndpoint;
  *
  * public class EchoClientClassHeaderEndpoint {
  *
@@ -187,7 +197,10 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
    *
    * public class EchoClientEcho {
    *
@@ -216,9 +229,12 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -249,9 +265,11 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
    *
    * import com.google.rpc.Status;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
    *
    * public class EchoClientEcho {
    *
@@ -281,7 +299,11 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -312,7 +334,10 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
    *
    * public class EchoClientEcho {
    *
@@ -342,7 +367,11 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -372,7 +401,11 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -402,7 +435,11 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -435,7 +472,14 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -470,9 +514,15 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -506,9 +556,12 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -538,9 +591,15 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
    *
    * 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;
    *
    * public class EchoClientCollect {
    *
@@ -591,9 +650,15 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -629,9 +694,15 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -667,7 +738,11 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -703,9 +778,12 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -741,9 +819,13 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -785,7 +867,10 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.EchoResponse;
    *
    * public class EchoClientSimplePagedExpand {
    *
@@ -816,7 +901,11 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -852,9 +941,12 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -891,9 +983,13 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -935,9 +1031,11 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
    *
    * import com.google.protobuf.Duration;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.WaitResponse;
    *
    * public class EchoClientWait {
    *
@@ -967,9 +1065,11 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
    *
    * import com.google.protobuf.Timestamp;
+   * import com.google.showcase.v1beta1.EchoClient;
+   * import com.google.showcase.v1beta1.WaitResponse;
    *
    * public class EchoClientWait {
    *
@@ -999,7 +1099,11 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1028,9 +1132,13 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1059,10 +1167,12 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1090,7 +1200,11 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1119,9 +1233,12 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1149,7 +1266,14 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1184,9 +1308,15 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
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 63b3504260..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,8 +42,9 @@ import javax.annotation.Generated;
  * 

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

{@code
- * package com.google.showcase.v1beta1;
+ * package com.google.example;
  *
+ * import com.google.showcase.v1beta1.EchoSettings;
  * import java.time.Duration;
  *
  * public class EchoSettings {
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 03af69b3d0..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,8 +70,9 @@ import org.threeten.bp.Duration;
  * 

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

{@code
- * package com.google.showcase.v1beta1.stub;
+ * package com.google.example;
  *
+ * import com.google.showcase.v1beta1.stub.EchoStubSettings;
  * import java.time.Duration;
  *
  * public class EchoSettings {
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 68dd6e4a5c..f5475d161e 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,7 +24,11 @@ import javax.annotation.Generated;
  * that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.showcase.v1beta1;
+ * 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 {
  *
@@ -72,9 +76,12 @@ import javax.annotation.Generated;
  * 

To customize credentials: * *

{@code
- * package com.google.showcase.v1beta1;
+ * 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 IdentityClientCreate {
  *
@@ -95,7 +102,11 @@ import javax.annotation.Generated;
  * 

To customize the endpoint: * *

{@code
- * package com.google.showcase.v1beta1;
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.IdentityClient;
+ * import com.google.showcase.v1beta1.IdentitySettings;
+ * import com.google.showcase.v1beta1.myEndpoint;
  *
  * public class IdentityClientClassHeaderEndpoint {
  *
@@ -170,7 +181,11 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -208,7 +223,11 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -271,7 +290,11 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -367,7 +390,12 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -400,9 +428,13 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -434,7 +466,11 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -465,7 +501,11 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -495,7 +535,12 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -525,9 +570,13 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -556,7 +605,11 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -586,9 +639,12 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -617,9 +673,11 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
    *
    * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.UserName;
    *
    * public class IdentityClientDeleteUser {
    *
@@ -650,9 +708,11 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
    *
    * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.IdentityClient;
+   * import com.google.showcase.v1beta1.UserName;
    *
    * public class IdentityClientDeleteUser {
    *
@@ -682,9 +742,12 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -714,10 +777,13 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -746,7 +812,11 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -781,9 +851,12 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -817,9 +890,13 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
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 2a1e49ab83..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,8 +77,9 @@ import org.threeten.bp.Duration;
  * 

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

{@code
- * package com.google.logging.v2.stub;
+ * package com.google.example;
  *
+ * import com.google.logging.v2.stub.LoggingServiceV2StubSettings;
  * import java.time.Duration;
  *
  * public class LoggingServiceV2Settings {
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 64742dd403..1d77e7a1ed 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,7 +32,10 @@ import javax.annotation.Generated;
  * that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.showcase.v1beta1;
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.MessagingClient;
+ * import com.google.showcase.v1beta1.Room;
  *
  * public class MessagingClientCreateRoom {
  *
@@ -79,9 +82,12 @@ import javax.annotation.Generated;
  * 

To customize credentials: * *

{@code
- * package com.google.showcase.v1beta1;
+ * 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 MessagingClientCreate {
  *
@@ -102,7 +108,11 @@ import javax.annotation.Generated;
  * 

To customize the endpoint: * *

{@code
- * package com.google.showcase.v1beta1;
+ * package com.google.example;
+ *
+ * import com.google.showcase.v1beta1.MessagingClient;
+ * import com.google.showcase.v1beta1.MessagingSettings;
+ * import com.google.showcase.v1beta1.myEndpoint;
  *
  * public class MessagingClientClassHeaderEndpoint {
  *
@@ -188,7 +198,10 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.Room;
    *
    * public class MessagingClientCreateRoom {
    *
@@ -224,7 +237,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -254,9 +271,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -285,7 +305,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -316,7 +340,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -346,7 +374,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -376,9 +409,13 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -407,7 +444,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -437,9 +478,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -468,9 +512,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
    *
    * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.RoomName;
    *
    * public class MessagingClientDeleteRoom {
    *
@@ -501,9 +547,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
    *
    * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.RoomName;
    *
    * public class MessagingClientDeleteRoom {
    *
@@ -533,9 +581,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -565,10 +616,13 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -597,7 +651,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -632,9 +690,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -668,9 +729,13 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -711,9 +776,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -749,7 +817,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -785,9 +857,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -823,7 +898,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -859,9 +938,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -897,7 +979,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -933,7 +1019,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -966,9 +1057,13 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1000,7 +1095,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1031,7 +1130,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1062,7 +1165,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1096,9 +1204,13 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1131,7 +1243,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1161,9 +1277,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1192,9 +1311,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
    *
    * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.BlurbName;
+   * import com.google.showcase.v1beta1.MessagingClient;
    *
    * public class MessagingClientDeleteBlurb {
    *
@@ -1225,9 +1346,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
    *
    * import com.google.protobuf.Empty;
+   * import com.google.showcase.v1beta1.BlurbName;
+   * import com.google.showcase.v1beta1.MessagingClient;
    *
    * public class MessagingClientDeleteBlurb {
    *
@@ -1258,9 +1381,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1294,10 +1420,13 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1330,7 +1459,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1363,7 +1496,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1396,7 +1533,11 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1428,7 +1569,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1464,9 +1610,13 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1501,9 +1651,14 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1545,7 +1700,10 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
+   *
+   * import com.google.showcase.v1beta1.MessagingClient;
+   * import com.google.showcase.v1beta1.SearchBlurbsResponse;
    *
    * public class MessagingClientSearchBlurbs {
    *
@@ -1576,7 +1734,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1612,9 +1775,14 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1650,10 +1818,13 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1687,9 +1858,13 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
@@ -1721,9 +1896,14 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * package com.google.example;
    *
    * 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;
    *
    * public class MessagingClientSendBlurbs {
    *
@@ -1773,9 +1953,12 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
-   * package com.google.showcase.v1beta1;
+   * 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 {
    *
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 f7424fd43d..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,8 +78,9 @@ import org.threeten.bp.Duration;
  * 

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

{@code
- * package com.google.pubsub.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.pubsub.v1.stub.PublisherStubSettings;
  * import java.time.Duration;
  *
  * public class PublisherSettings {
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 6dd90df67e..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,8 +34,9 @@ import javax.annotation.Generated;
  * 

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

{@code
- * package com.google.showcase.v1beta1;
+ * package com.google.example;
  *
+ * import com.google.showcase.v1beta1.ComplianceSettings;
  * import java.time.Duration;
  *
  * public class ComplianceSettings {
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 4c3cf9426c..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,8 +43,9 @@ import javax.annotation.Generated;
  * 

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

{@code
- * package com.google.showcase.v1beta1.stub;
+ * package com.google.example;
  *
+ * import com.google.showcase.v1beta1.stub.ComplianceStubSettings;
  * import java.time.Duration;
  *
  * public class ComplianceSettings {
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
index 3a3d448f5d..7fcccde74b 100644
--- 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
@@ -26,11 +26,10 @@ public class ExecutableSampleComposerTest {
 
   @Test
   public void createExecutableSampleEmptySample() {
-    String packageName = "com.google.example";
     String sampleMethodName = "echoClientWait";
 
     ExecutableSample executableSample =
-        new ExecutableSample(packageName, sampleMethodName, new ArrayList<>(), new ArrayList<>());
+        new ExecutableSample(sampleMethodName, new ArrayList<>(), new ArrayList<>());
     String sampleResult = ExecutableSampleComposer.createExecutableSample(executableSample);
 
     String expected =
@@ -51,13 +50,11 @@ public void createExecutableSampleEmptySample() {
 
   @Test
   public void createExecutableSampleMethodArgsNoVar() {
-    String packageName = "com.google.example";
     String sampleMethodName = "echoClientWait";
     Statement sampleBody =
         ExprStatement.withExpr(SampleUtil.systemOutPrint("Testing " + sampleMethodName));
     ExecutableSample executableSample =
-        new ExecutableSample(
-            packageName, sampleMethodName, new ArrayList<>(), ImmutableList.of(sampleBody));
+        new ExecutableSample(sampleMethodName, new ArrayList<>(), ImmutableList.of(sampleBody));
 
     String sampleResult = ExecutableSampleComposer.createExecutableSample(executableSample);
     String expected =
@@ -80,7 +77,6 @@ public void createExecutableSampleMethodArgsNoVar() {
 
   @Test
   public void createExecutableSampleMethod() {
-    String packageName = "com.google.example";
     String sampleMethodName = "echoClientWait";
     VariableExpr variableExpr =
         VariableExpr.builder()
@@ -96,10 +92,7 @@ public void createExecutableSampleMethod() {
     Statement sampleBody = ExprStatement.withExpr(SampleUtil.systemOutPrint(variableExpr));
     ExecutableSample executableSample =
         new ExecutableSample(
-            packageName,
-            sampleMethodName,
-            ImmutableList.of(varAssignment),
-            ImmutableList.of(sampleBody));
+            sampleMethodName, ImmutableList.of(varAssignment), ImmutableList.of(sampleBody));
 
     String sampleResult = ExecutableSampleComposer.createExecutableSample(executableSample);
     String expected =
@@ -123,7 +116,6 @@ public void createExecutableSampleMethod() {
 
   @Test
   public void createExecutableSampleMethodMultipleStatements() {
-    String packageName = "com.google.example";
     String sampleMethodName = "echoClientWait";
     VariableExpr variableExpr =
         VariableExpr.builder()
@@ -152,7 +144,6 @@ public void createExecutableSampleMethodMultipleStatements() {
     Statement bodyStatement2 = ExprStatement.withExpr(SampleUtil.systemOutPrint(variableExpr2));
     ExecutableSample executableSample =
         new ExecutableSample(
-            packageName,
             sampleMethodName,
             ImmutableList.of(varAssignment, varAssignment2),
             ImmutableList.of(bodyStatement, bodyStatement2));
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 513f62ce7f..ea9a25e5a2 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
@@ -71,7 +71,10 @@ public void composeClassHeaderMethodSampleCode_unaryRpc() {
             echoProtoService, clientType, resourceNames, messageTypes);
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\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",
@@ -164,9 +167,11 @@ public void composeClassHeaderMethodSampleCode_firstMethodIsNotUnaryRpc() {
             service, clientType, resourceNames, messageTypes);
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -230,7 +235,14 @@ public void composeClassHeaderMethodSampleCode_firstMethodHasNoSignatures() {
             service, clientType, resourceNames, messageTypes);
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -300,9 +312,12 @@ public void composeClassHeaderMethodSampleCode_firstMethodIsStream() {
             service, clientType, resourceNames, messageTypes);
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\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",
@@ -344,9 +359,12 @@ public void composeClassHeaderCredentialsSampleCode() {
                 clientType, settingsType));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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 EchoClientCreate {\n",
             "\n",
@@ -385,7 +403,11 @@ public void composeClassHeaderEndpointSampleCode() {
                 clientType, settingsType));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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 EchoClientClassHeaderEndpoint {\n",
             "\n",
@@ -1112,8 +1134,10 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithMultipleMethodArgu
                 method, clientType, arguments, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\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",
@@ -1199,7 +1223,10 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithNoMethodArguments(
                 method, clientType, arguments, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\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",
@@ -1371,7 +1398,10 @@ public void validComposeRpcMethodHeaderSampleCode_lroUnaryRpcWithNoMethodArgumen
                 method, clientType, Collections.emptyList(), resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -1456,9 +1486,11 @@ public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnResponseType()
                 method, clientType, arguments, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -1541,10 +1573,11 @@ public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnVoid() {
                 method, clientType, arguments, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -1600,7 +1633,11 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_isPagedMethod() {
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\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",
@@ -1711,9 +1748,11 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_hasLroMethodWithReturnR
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -1782,7 +1821,11 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_hasLroMethodWithReturnV
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -1833,9 +1876,14 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_pureUnaryReturnVoid() {
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -1895,7 +1943,14 @@ public void validComposeRpcDefaultMethodHeaderSampleCode_pureUnaryReturnResponse
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -1970,9 +2025,13 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnResponse() {
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -2040,10 +2099,13 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnVoid() {
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -2101,9 +2163,12 @@ public void validComposePagedCallableMethodHeaderSampleCode() {
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\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",
@@ -2292,9 +2357,12 @@ public void validComposeStreamCallableMethodHeaderSampleCode_serverStream() {
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\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",
@@ -2389,9 +2457,15 @@ public void validComposeStreamCallableMethodHeaderSampleCode_bidiStream() {
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\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",
@@ -2492,9 +2566,15 @@ public void validComposeStreamCallableMethodHeaderSampleCode_clientStream() {
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "package com.google.example;\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",
             "public class EchoClientCollect {\n",
             "\n",
@@ -2606,9 +2686,15 @@ public void validComposeRegularCallableMethodHeaderSampleCode_unaryRpc() {
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\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.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",
@@ -2684,10 +2770,12 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpc() {
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -2754,10 +2842,12 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpcWithReturnVo
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "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",
@@ -2814,9 +2904,13 @@ public void validComposeRegularCallableMethodHeaderSampleCode_pageRpc() {
                 method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\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",
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 e9ba58da1c..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
@@ -52,8 +52,9 @@ public void composeSettingsSampleCode_serviceSettingsClass() {
                 Optional.of("Echo"), "EchoSettings", classType));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "package com.google.example;\n",
             "\n",
+            "import com.google.showcase.v1beta1.EchoSettings;\n",
             "import java.time.Duration;\n",
             "\n",
             "public class EchoSettings {\n",
@@ -93,8 +94,9 @@ public void composeSettingsSampleCode_serviceStubClass() {
                 Optional.of("Echo"), "EchoSettings", classType));
     String expected =
         LineFormatter.lines(
-            "package com.google.showcase.v1beta1;\n",
+            "package com.google.example;\n",
             "\n",
+            "import com.google.showcase.v1beta1.EchoStubSettings;\n",
             "import java.time.Duration;\n",
             "\n",
             "public class EchoSettings {\n",
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 9a366b817f..1e94ffff8b 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,8 +47,14 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.asset.v1;
+ * 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 {
@@ -102,9 +108,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.asset.v1;
+ * 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 AssetServiceClientCreate {
  *
@@ -125,7 +134,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.asset.v1;
+ * 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 AssetServiceClientClassHeaderEndpoint {
  *
@@ -220,8 +233,14 @@ public final OperationsClient getOperationsClient() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
-   *
+   * 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;
    *
@@ -270,9 +289,15 @@ public final OperationFuture exportAs
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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;
    *
@@ -321,9 +346,14 @@ public final OperationFuture exportAs
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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;
@@ -364,9 +394,12 @@ public final UnaryCallable exportAssetsCallable(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -404,7 +437,11 @@ public final ListAssetsPagedResponse listAssets(ResourceName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -441,8 +478,13 @@ public final ListAssetsPagedResponse listAssets(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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;
    *
@@ -486,9 +528,14 @@ public final ListAssetsPagedResponse listAssets(ListAssetsRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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;
    *
@@ -531,8 +578,14 @@ public final UnaryCallable listAsset
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
-   *
+   * 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;
@@ -587,8 +640,14 @@ public final UnaryCallable listAssetsCall
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
-   *
+   * 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 {
@@ -632,9 +691,15 @@ public final BatchGetAssetsHistoryResponse batchGetAssetsHistory(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -674,7 +739,10 @@ public final BatchGetAssetsHistoryResponse batchGetAssetsHistory(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.Feed;
    *
    * public class AssetServiceClientCreateFeed {
    *
@@ -709,7 +777,11 @@ public final Feed createFeed(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -745,9 +817,12 @@ public final Feed createFeed(CreateFeedRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -782,7 +857,11 @@ public final UnaryCallable createFeedCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -817,7 +896,11 @@ public final Feed getFeed(FeedName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -851,7 +934,12 @@ public final Feed getFeed(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -885,9 +973,13 @@ public final Feed getFeed(GetFeedRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -920,7 +1012,10 @@ public final UnaryCallable getFeedCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.ListFeedsResponse;
    *
    * public class AssetServiceClientListFeeds {
    *
@@ -954,7 +1049,11 @@ public final ListFeedsResponse listFeeds(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -986,9 +1085,12 @@ public final ListFeedsResponse listFeeds(ListFeedsRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -1020,7 +1122,10 @@ public final UnaryCallable listFeedsCallabl
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.Feed;
    *
    * public class AssetServiceClientUpdateFeed {
    *
@@ -1054,8 +1159,11 @@ public final Feed updateFeed(Feed feed) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -1091,9 +1199,12 @@ public final Feed updateFeed(UpdateFeedRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -1128,8 +1239,10 @@ public final UnaryCallable updateFeedCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -1165,8 +1278,10 @@ public final void deleteFeed(FeedName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -1201,8 +1316,11 @@ public final void deleteFeed(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -1237,9 +1355,12 @@ public final void deleteFeed(DeleteFeedRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -1275,8 +1396,10 @@ public final UnaryCallable deleteFeedCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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;
    *
@@ -1383,8 +1506,11 @@ public final SearchAllResourcesPagedResponse searchAllResources(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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;
    *
@@ -1432,9 +1558,12 @@ public final SearchAllResourcesPagedResponse searchAllResources(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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;
    *
@@ -1481,8 +1610,12 @@ public final SearchAllResourcesPagedResponse searchAllResources(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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;
@@ -1537,7 +1670,10 @@ public final SearchAllResourcesPagedResponse searchAllResources(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * package com.google.example;
+   *
+   * import com.google.cloud.asset.v1.AssetServiceClient;
+   * import com.google.cloud.asset.v1.IamPolicySearchResult;
    *
    * public class AssetServiceClientSearchAllIamPolicies {
    *
@@ -1624,8 +1760,11 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(String scope
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -1671,9 +1810,12 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -1718,8 +1860,12 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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;
    *
@@ -1770,8 +1916,12 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -1807,9 +1957,13 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -1853,7 +2007,13 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -1898,9 +2058,15 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -1947,9 +2113,13 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
@@ -1989,7 +2159,11 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
@@ -2027,9 +2201,12 @@ public final AnalyzeMoveResponse analyzeMove(AnalyzeMoveRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.asset.v1;
+   * 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 {
    *
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 bc9ce047e5..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,8 +58,9 @@
  * 

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

{@code
- * package com.google.cloud.asset.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.asset.v1.AssetServiceSettings;
  * import java.time.Duration;
  *
  * public class AssetServiceSettings {
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 496c0611f0..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,8 +24,14 @@
  * 

Sample for AssetServiceClient: * *

{@code
- * package com.google.cloud.asset.v1;
- *
+ * 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 {
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 f04d1e8c80..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,8 +102,9 @@
  * 

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

{@code
- * package com.google.cloud.asset.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.asset.v1.stub.AssetServiceStubSettings;
  * import java.time.Duration;
  *
  * public class AssetServiceSettings {
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 812a5d90c0..10f2bc35b7 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,8 +46,10 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.compute.v1;
+ * 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 {
@@ -97,9 +99,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.compute.v1;
+ * 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 AddressesClientCreate {
  *
@@ -120,7 +125,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.compute.v1;
+ * 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 AddressesClientClassHeaderEndpoint {
  *
@@ -196,8 +205,10 @@ public AddressesStub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
@@ -234,8 +245,11 @@ public final AggregatedListPagedResponse aggregatedList(String project) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
@@ -278,9 +292,12 @@ public final AggregatedListPagedResponse aggregatedList(AggregatedListAddressesR
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
@@ -323,8 +340,12 @@ public final AggregatedListPagedResponse aggregatedList(AggregatedListAddressesR
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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;
    *
@@ -374,7 +395,10 @@ public final AggregatedListPagedResponse aggregatedList(AggregatedListAddressesR
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.AddressesClient;
+   * import com.google.cloud.compute.v1.Operation;
    *
    * public class AddressesClientDelete {
    *
@@ -416,7 +440,11 @@ public final OperationFuture deleteAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
    *
@@ -455,9 +483,12 @@ public final OperationFuture deleteAsync(DeleteAddressRequ
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
    *
@@ -495,9 +526,11 @@ public final OperationFuture deleteAsync(DeleteAddressRequ
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
@@ -534,7 +567,11 @@ public final UnaryCallable deleteCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
    *
@@ -576,7 +613,12 @@ public final OperationFuture insertAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
    *
@@ -615,9 +657,13 @@ public final OperationFuture insertAsync(InsertAddressRequ
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
    *
@@ -655,9 +701,12 @@ public final OperationFuture insertAsync(InsertAddressRequ
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
@@ -694,7 +743,10 @@ public final UnaryCallable insertCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.Address;
+   * import com.google.cloud.compute.v1.AddressesClient;
    *
    * public class AddressesClientList {
    *
@@ -743,7 +795,11 @@ public final ListPagedResponse list(String project, String region, String orderB
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
    *
@@ -784,9 +840,12 @@ public final ListPagedResponse list(ListAddressesRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
    *
@@ -826,8 +885,12 @@ public final UnaryCallable listPagedCal
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
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 64d15ee238..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,8 +55,9 @@
  * 

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

{@code
- * package com.google.cloud.compute.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.compute.v1.AddressesSettings;
  * import java.time.Duration;
  *
  * public class AddressesSettings {
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 151b7fac59..eb354d8a7b 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,7 +33,10 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.compute.v1;
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.Operation;
+ * import com.google.cloud.compute.v1.RegionOperationsClient;
  *
  * public class RegionOperationsClientGet {
  *
@@ -82,9 +85,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.compute.v1;
+ * 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 RegionOperationsClientCreate {
  *
@@ -106,7 +112,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.compute.v1;
+ * 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 RegionOperationsClientClassHeaderEndpoint {
  *
@@ -185,7 +195,10 @@ public RegionOperationsStub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.Operation;
+   * import com.google.cloud.compute.v1.RegionOperationsClient;
    *
    * public class RegionOperationsClientGet {
    *
@@ -226,7 +239,11 @@ public final Operation get(String project, String region, String operation) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
    *
@@ -262,9 +279,12 @@ public final Operation get(GetRegionOperationRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
    *
@@ -308,7 +328,10 @@ public final UnaryCallable getCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * package com.google.example;
+   *
+   * import com.google.cloud.compute.v1.Operation;
+   * import com.google.cloud.compute.v1.RegionOperationsClient;
    *
    * public class RegionOperationsClientWait {
    *
@@ -358,7 +381,11 @@ public final Operation wait(String project, String region, String operation) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
    *
@@ -403,9 +430,12 @@ public final Operation wait(WaitRegionOperationRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.compute.v1;
+   * 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 {
    *
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 0ea54b961b..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,8 +50,9 @@
  * 

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

{@code
- * package com.google.cloud.compute.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.compute.v1.RegionOperationsSettings;
  * import java.time.Duration;
  *
  * public class RegionOperationsSettings {
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 e909ea3433..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,8 +26,10 @@
  * 

Sample for AddressesClient: * *

{@code
- * package com.google.cloud.compute.v1;
+ * 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 {
@@ -55,7 +57,10 @@
  * 

Sample for RegionOperationsClient: * *

{@code
- * package com.google.cloud.compute.v1;
+ * package com.google.example;
+ *
+ * import com.google.cloud.compute.v1.Operation;
+ * import com.google.cloud.compute.v1.RegionOperationsClient;
  *
  * public class RegionOperationsClientGet {
  *
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 ba339e5398..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,8 +83,9 @@
  * 

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

{@code
- * package com.google.cloud.compute.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.compute.v1.stub.AddressesStubSettings;
  * import java.time.Duration;
  *
  * public class AddressesSettings {
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 f4730bab7b..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,8 +61,9 @@
  * 

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

{@code
- * package com.google.cloud.compute.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.compute.v1.stub.RegionOperationsStubSettings;
  * import java.time.Duration;
  *
  * public class RegionOperationsSettings {
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 b76f09b31b..057216d482 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,8 +43,11 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.iam.credentials.v1;
+ * 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;
@@ -97,9 +100,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.iam.credentials.v1;
+ * 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 IamCredentialsClientCreate {
  *
@@ -120,7 +126,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.iam.credentials.v1;
+ * 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 IamCredentialsClientClassHeaderEndpoint {
  *
@@ -198,8 +208,11 @@ public IamCredentialsStub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
@@ -262,8 +275,11 @@ public final GenerateAccessTokenResponse generateAccessToken(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
@@ -326,8 +342,12 @@ public final GenerateAccessTokenResponse generateAccessToken(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
    *
@@ -366,9 +386,13 @@ public final GenerateAccessTokenResponse generateAccessToken(GenerateAccessToken
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
    *
@@ -408,8 +432,11 @@ public final GenerateAccessTokenResponse generateAccessToken(GenerateAccessToken
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
    *
@@ -469,8 +496,11 @@ public final GenerateIdTokenResponse generateIdToken(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
    *
@@ -530,8 +560,12 @@ public final GenerateIdTokenResponse generateIdToken(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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 {
@@ -569,9 +603,13 @@ public final GenerateIdTokenResponse generateIdToken(GenerateIdTokenRequest requ
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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 {
@@ -610,8 +648,11 @@ public final GenerateIdTokenResponse generateIdToken(GenerateIdTokenRequest requ
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
@@ -666,8 +707,11 @@ public final SignBlobResponse signBlob(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
@@ -721,8 +765,12 @@ public final SignBlobResponse signBlob(String name, List delegates, Byte
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
    *
@@ -760,9 +808,13 @@ public final SignBlobResponse signBlob(SignBlobRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
    *
@@ -800,8 +852,11 @@ public final UnaryCallable signBlobCallable()
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
    *
@@ -855,8 +910,11 @@ public final SignJwtResponse signJwt(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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;
    *
@@ -909,8 +967,12 @@ public final SignJwtResponse signJwt(String name, List delegates, String
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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 {
@@ -947,9 +1009,13 @@ public final SignJwtResponse signJwt(SignJwtRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.iam.credentials.v1;
+   * 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 {
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 cf38a24e52..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,8 +51,9 @@
  * 

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

{@code
- * package com.google.cloud.iam.credentials.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.iam.credentials.v1.IamCredentialsSettings;
  * import java.time.Duration;
  *
  * public class IamCredentialsSettings {
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 271fda0111..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,8 +31,11 @@
  * 

Sample for IamCredentialsClient: * *

{@code
- * package com.google.cloud.iam.credentials.v1;
+ * 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;
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 4225509e4c..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,8 +67,9 @@
  * 

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

{@code
- * package com.google.cloud.iam.credentials.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.iam.credentials.v1.stub.IamCredentialsStubSettings;
  * import java.time.Duration;
  *
  * public class IamCredentialsSettings {
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 f5a4920b3f..0a71f98eb6 100644
--- a/test/integration/goldens/iam/com/google/iam/v1/IAMPolicyClient.java
+++ b/test/integration/goldens/iam/com/google/iam/v1/IAMPolicyClient.java
@@ -54,7 +54,11 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.iam.v1;
+ * 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 {
  *
@@ -104,9 +108,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.iam.v1;
+ * 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 IAMPolicyClientCreate {
  *
@@ -127,7 +134,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.iam.v1;
+ * package com.google.example;
+ *
+ * import com.google.iam.v1.IAMPolicyClient;
+ * import com.google.iam.v1.IAMPolicySettings;
+ * import com.google.iam.v1.myEndpoint;
  *
  * public class IAMPolicyClientClassHeaderEndpoint {
  *
@@ -203,7 +214,11 @@ public IAMPolicyStub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.iam.v1;
+   * 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 {
    *
@@ -238,9 +253,12 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.iam.v1;
+   * 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 {
    *
@@ -275,7 +293,12 @@ public final UnaryCallable setIamPolicyCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.iam.v1;
+   * 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 {
    *
@@ -311,9 +334,13 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.iam.v1;
+   * 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 {
    *
@@ -352,8 +379,11 @@ public final UnaryCallable getIamPolicyCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.iam.v1;
+   * 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 {
@@ -394,9 +424,12 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
-   * package com.google.iam.v1;
+   * 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 {
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 7804f2bcb5..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,8 +50,9 @@
  * 

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

{@code
- * package com.google.iam.v1;
+ * package com.google.example;
  *
+ * import com.google.iam.v1.IAMPolicySettings;
  * import java.time.Duration;
  *
  * public class IAMPolicySettings {
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 5e8e9f2189..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,7 +45,11 @@
  * 

Sample for IAMPolicyClient: * *

{@code
- * package com.google.iam.v1;
+ * 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 {
  *
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 da232e2df3..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,8 +63,9 @@
  * 

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

{@code
- * package com.google.iam.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.iam.v1.stub.IAMPolicyStubSettings;
  * import java.time.Duration;
  *
  * public class IAMPolicySettings {
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 e94b3e7a11..2f974c045f 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,7 +65,11 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.kms.v1;
+ * 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 {
  *
@@ -113,9 +117,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.kms.v1;
+ * 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 KeyManagementServiceClientCreate {
  *
@@ -137,7 +144,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.kms.v1;
+ * 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 KeyManagementServiceClientClassHeaderEndpoint {
  *
@@ -216,7 +227,11 @@ public KeyManagementServiceStub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -255,7 +270,11 @@ public final ListKeyRingsPagedResponse listKeyRings(LocationName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -291,7 +310,12 @@ public final ListKeyRingsPagedResponse listKeyRings(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -332,9 +356,13 @@ public final ListKeyRingsPagedResponse listKeyRings(ListKeyRingsRequest request)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -376,8 +404,13 @@ public final ListKeyRingsPagedResponse listKeyRings(ListKeyRingsRequest request)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -426,7 +459,11 @@ public final UnaryCallable listKeyRin
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -465,7 +502,11 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(KeyRingName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -501,7 +542,12 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -542,9 +588,13 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(ListCryptoKeysRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -586,8 +636,13 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(ListCryptoKeysRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -637,7 +692,11 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(ListCryptoKeysRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -678,7 +737,11 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(CryptoKeyN
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -717,7 +780,12 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(String par
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -762,9 +830,13 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -808,8 +880,13 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -861,7 +938,11 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -900,7 +981,11 @@ public final ListImportJobsPagedResponse listImportJobs(KeyRingName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -936,7 +1021,12 @@ public final ListImportJobsPagedResponse listImportJobs(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -977,9 +1067,13 @@ public final ListImportJobsPagedResponse listImportJobs(ListImportJobsRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1021,8 +1115,13 @@ public final ListImportJobsPagedResponse listImportJobs(ListImportJobsRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -1072,7 +1171,11 @@ public final ListImportJobsPagedResponse listImportJobs(ListImportJobsRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1107,7 +1210,11 @@ public final KeyRing getKeyRing(KeyRingName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1141,7 +1248,12 @@ public final KeyRing getKeyRing(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1176,9 +1288,13 @@ public final KeyRing getKeyRing(GetKeyRingRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1215,7 +1331,11 @@ public final UnaryCallable getKeyRingCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1253,7 +1373,11 @@ public final CryptoKey getCryptoKey(CryptoKeyName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1290,7 +1414,12 @@ public final CryptoKey getCryptoKey(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1329,9 +1458,13 @@ public final CryptoKey getCryptoKey(GetCryptoKeyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1368,7 +1501,11 @@ public final UnaryCallable getCryptoKeyCallable(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1407,7 +1544,11 @@ public final CryptoKeyVersion getCryptoKeyVersion(CryptoKeyVersionName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1445,7 +1586,12 @@ public final CryptoKeyVersion getCryptoKeyVersion(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1487,9 +1633,13 @@ public final CryptoKeyVersion getCryptoKeyVersion(GetCryptoKeyVersionRequest req
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1535,7 +1685,11 @@ public final CryptoKeyVersion getCryptoKeyVersion(GetCryptoKeyVersionRequest req
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1575,7 +1729,11 @@ public final PublicKey getPublicKey(CryptoKeyVersionName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1615,7 +1773,12 @@ public final PublicKey getPublicKey(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1660,9 +1823,13 @@ public final PublicKey getPublicKey(GetPublicKeyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1704,7 +1871,11 @@ public final UnaryCallable getPublicKeyCallable(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1740,7 +1911,11 @@ public final ImportJob getImportJob(ImportJobName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1775,7 +1950,12 @@ public final ImportJob getImportJob(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1812,9 +1992,13 @@ public final ImportJob getImportJob(GetImportJobRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1851,7 +2035,11 @@ public final UnaryCallable getImportJobCallable(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1895,7 +2083,11 @@ public final KeyRing createKeyRing(LocationName parent, String keyRingId, KeyRin
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1939,7 +2131,12 @@ public final KeyRing createKeyRing(String parent, String keyRingId, KeyRing keyR
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -1976,9 +2173,13 @@ public final KeyRing createKeyRing(CreateKeyRingRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2020,7 +2221,11 @@ public final UnaryCallable createKeyRingCallable(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2072,7 +2277,11 @@ public final CryptoKey createCryptoKey(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2123,7 +2332,12 @@ public final CryptoKey createCryptoKey(String parent, String cryptoKeyId, Crypto
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2166,9 +2380,13 @@ public final CryptoKey createCryptoKey(CreateCryptoKeyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2211,7 +2429,11 @@ public final UnaryCallable createCryptoKeyCal
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2261,7 +2483,11 @@ public final CryptoKeyVersion createCryptoKeyVersion(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2311,7 +2537,12 @@ public final CryptoKeyVersion createCryptoKeyVersion(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2354,9 +2585,13 @@ public final CryptoKeyVersion createCryptoKeyVersion(CreateCryptoKeyVersionReque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2400,7 +2635,12 @@ public final CryptoKeyVersion createCryptoKeyVersion(CreateCryptoKeyVersionReque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2443,9 +2683,13 @@ public final CryptoKeyVersion importCryptoKeyVersion(ImportCryptoKeyVersionReque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2487,7 +2731,11 @@ public final CryptoKeyVersion importCryptoKeyVersion(ImportCryptoKeyVersionReque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2538,7 +2786,11 @@ public final ImportJob createImportJob(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2588,7 +2840,12 @@ public final ImportJob createImportJob(String parent, String importJobId, Import
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2628,9 +2885,13 @@ public final ImportJob createImportJob(CreateImportJobRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -2667,8 +2928,10 @@ public final UnaryCallable createImportJobCal
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -2708,8 +2971,11 @@ public final CryptoKey updateCryptoKey(CryptoKey cryptoKey, FieldMask updateMask
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -2746,9 +3012,12 @@ public final CryptoKey updateCryptoKey(UpdateCryptoKeyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -2793,8 +3062,10 @@ public final UnaryCallable updateCryptoKeyCal
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -2845,8 +3116,11 @@ public final CryptoKeyVersion updateCryptoKeyVersion(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -2891,9 +3165,12 @@ public final CryptoKeyVersion updateCryptoKeyVersion(UpdateCryptoKeyVersionReque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -2934,9 +3211,12 @@ public final CryptoKeyVersion updateCryptoKeyVersion(UpdateCryptoKeyVersionReque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -2988,8 +3268,11 @@ public final EncryptResponse encrypt(ResourceName name, ByteString plaintext) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -3039,8 +3322,12 @@ public final EncryptResponse encrypt(String name, ByteString plaintext) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
    *
@@ -3086,9 +3373,13 @@ public final EncryptResponse encrypt(EncryptRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
    *
@@ -3134,8 +3425,11 @@ public final UnaryCallable encryptCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -3181,8 +3475,11 @@ public final DecryptResponse decrypt(CryptoKeyName name, ByteString ciphertext)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -3225,8 +3522,12 @@ public final DecryptResponse decrypt(String name, ByteString ciphertext) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
    *
@@ -3272,9 +3573,13 @@ public final DecryptResponse decrypt(DecryptRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
    *
@@ -3320,7 +3625,12 @@ public final UnaryCallable decryptCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -3367,7 +3677,12 @@ public final AsymmetricSignResponse asymmetricSign(CryptoKeyVersionName name, Di
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -3412,8 +3727,13 @@ public final AsymmetricSignResponse asymmetricSign(String name, Digest digest) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -3461,9 +3781,14 @@ public final AsymmetricSignResponse asymmetricSign(AsymmetricSignRequest request
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -3512,8 +3837,11 @@ public final AsymmetricSignResponse asymmetricSign(AsymmetricSignRequest request
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -3562,8 +3890,11 @@ public final AsymmetricDecryptResponse asymmetricDecrypt(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
@@ -3609,8 +3940,12 @@ public final AsymmetricDecryptResponse asymmetricDecrypt(String name, ByteString
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
    *
@@ -3659,9 +3994,13 @@ public final AsymmetricDecryptResponse asymmetricDecrypt(AsymmetricDecryptReques
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
    *
@@ -3711,7 +4050,11 @@ public final AsymmetricDecryptResponse asymmetricDecrypt(AsymmetricDecryptReques
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -3758,7 +4101,11 @@ public final CryptoKey updateCryptoKeyPrimaryVersion(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -3804,7 +4151,12 @@ public final CryptoKey updateCryptoKeyPrimaryVersion(String name, String cryptoK
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -3846,9 +4198,13 @@ public final CryptoKey updateCryptoKeyPrimaryVersion(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -3900,7 +4256,11 @@ public final CryptoKey updateCryptoKeyPrimaryVersion(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -3952,7 +4312,11 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(CryptoKeyVersionName name)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -4003,7 +4367,12 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -4058,9 +4427,13 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(DestroyCryptoKeyVersionReq
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -4110,7 +4483,11 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(DestroyCryptoKeyVersionReq
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -4156,7 +4533,11 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(CryptoKeyVersionName name)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -4201,7 +4582,12 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -4250,9 +4636,13 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(RestoreCryptoKeyVersionReq
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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 {
    *
@@ -4296,8 +4686,10 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(RestoreCryptoKeyVersionReq
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
@@ -4339,9 +4731,11 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
@@ -4382,8 +4776,9 @@ public final UnaryCallable getIamPolicyCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
    * import com.google.cloud.location.ListLocationsRequest;
    * import com.google.cloud.location.Location;
    *
@@ -4425,9 +4820,10 @@ public final ListLocationsPagedResponse listLocations(ListLocationsRequest reque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
    *
@@ -4470,8 +4866,9 @@ public final ListLocationsPagedResponse listLocations(ListLocationsRequest reque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
@@ -4522,8 +4919,9 @@ public final UnaryCallable listLoca
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.kms.v1.KeyManagementServiceClient;
    * import com.google.cloud.location.GetLocationRequest;
    * import com.google.cloud.location.Location;
    *
@@ -4557,9 +4955,10 @@ public final Location getLocation(GetLocationRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
    *
@@ -4594,8 +4993,10 @@ public final UnaryCallable getLocationCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
@@ -4637,9 +5038,11 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
-   * package com.google.cloud.kms.v1;
+   * 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;
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 8e5b2a1b2f..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,8 +65,9 @@
  * 

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

{@code
- * package com.google.cloud.kms.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.kms.v1.KeyManagementServiceSettings;
  * import java.time.Duration;
  *
  * public class KeyManagementServiceSettings {
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 8994c0736f..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,7 +39,11 @@
  * 

Sample for KeyManagementServiceClient: * *

{@code
- * package com.google.cloud.kms.v1;
+ * 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 {
  *
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 c06a196e12..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,8 +115,9 @@
  * 

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

{@code
- * package com.google.cloud.kms.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.kms.v1.stub.KeyManagementServiceStubSettings;
  * import java.time.Duration;
  *
  * public class KeyManagementServiceSettings {
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 82c67e9048..5d149d9582 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,8 +67,9 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.example.library.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.example.library.v1.LibraryServiceClient;
  * import com.google.example.library.v1.Shelf;
  *
  * public class LibraryServiceClientCreateShelf {
@@ -115,9 +116,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.example.library.v1;
+ * 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 LibraryServiceClientCreate {
  *
@@ -138,7 +142,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.example.library.v1;
+ * 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 LibraryServiceClientClassHeaderEndpoint {
  *
@@ -216,8 +224,9 @@ public LibraryServiceStub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
    * import com.google.example.library.v1.Shelf;
    *
    * public class LibraryServiceClientCreateShelf {
@@ -250,8 +259,9 @@ public final Shelf createShelf(Shelf shelf) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -285,9 +295,10 @@ public final Shelf createShelf(CreateShelfRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -320,8 +331,9 @@ public final UnaryCallable createShelfCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -356,8 +368,9 @@ public final Shelf getShelf(ShelfName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -391,8 +404,9 @@ public final Shelf getShelf(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -427,9 +441,10 @@ public final Shelf getShelf(GetShelfRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -464,8 +479,9 @@ public final UnaryCallable getShelfCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -505,9 +521,10 @@ public final ListShelvesPagedResponse listShelves(ListShelvesRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -547,8 +564,9 @@ public final ListShelvesPagedResponse listShelves(ListShelvesRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -595,8 +613,9 @@ public final UnaryCallable listShelvesC
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
    * import com.google.example.library.v1.ShelfName;
    * import com.google.protobuf.Empty;
    *
@@ -631,8 +650,9 @@ public final void deleteShelf(ShelfName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
    * import com.google.example.library.v1.ShelfName;
    * import com.google.protobuf.Empty;
    *
@@ -666,8 +686,9 @@ public final void deleteShelf(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -702,9 +723,10 @@ public final void deleteShelf(DeleteShelfRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -743,8 +765,9 @@ public final UnaryCallable deleteShelfCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -789,8 +812,9 @@ public final Shelf mergeShelves(ShelfName name, ShelfName otherShelf) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -835,8 +859,9 @@ public final Shelf mergeShelves(ShelfName name, String otherShelf) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -881,8 +906,9 @@ public final Shelf mergeShelves(String name, ShelfName otherShelf) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -924,8 +950,9 @@ public final Shelf mergeShelves(String name, String otherShelf) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -968,9 +995,10 @@ public final Shelf mergeShelves(MergeShelvesRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1007,8 +1035,9 @@ public final UnaryCallable mergeShelvesCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -1048,8 +1077,9 @@ public final Book createBook(ShelfName parent, Book book) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -1086,8 +1116,9 @@ public final Book createBook(String parent, Book book) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1125,9 +1156,10 @@ public final Book createBook(CreateBookRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1164,8 +1196,9 @@ public final UnaryCallable createBookCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -1200,8 +1233,9 @@ public final Book getBook(BookName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -1235,8 +1269,9 @@ public final Book getBook(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1271,9 +1306,10 @@ public final Book getBook(GetBookRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1309,8 +1345,9 @@ public final UnaryCallable getBookCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -1349,8 +1386,9 @@ public final ListBooksPagedResponse listBooks(ShelfName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
    *
@@ -1388,8 +1426,9 @@ public final ListBooksPagedResponse listBooks(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1432,9 +1471,10 @@ public final ListBooksPagedResponse listBooks(ListBooksRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1476,8 +1516,9 @@ public final UnaryCallable listBooksPa
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1526,8 +1567,9 @@ public final UnaryCallable listBooksCallabl
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
    * import com.google.example.library.v1.BookName;
    * import com.google.protobuf.Empty;
    *
@@ -1562,8 +1604,9 @@ public final void deleteBook(BookName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
    * import com.google.example.library.v1.BookName;
    * import com.google.protobuf.Empty;
    *
@@ -1597,8 +1640,9 @@ public final void deleteBook(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1635,9 +1679,10 @@ public final void deleteBook(DeleteBookRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1674,8 +1719,9 @@ public final UnaryCallable deleteBookCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.example.library.v1.LibraryServiceClient;
    * import com.google.example.library.v1.Book;
    * import com.google.protobuf.FieldMask;
    *
@@ -1713,8 +1759,9 @@ public final Book updateBook(Book book, FieldMask updateMask) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1753,9 +1800,10 @@ public final Book updateBook(UpdateBookRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1793,8 +1841,9 @@ public final UnaryCallable updateBookCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1836,8 +1885,9 @@ public final Book moveBook(BookName name, ShelfName otherShelfName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1879,8 +1929,9 @@ public final Book moveBook(BookName name, String otherShelfName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1922,8 +1973,9 @@ public final Book moveBook(String name, ShelfName otherShelfName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -1962,8 +2014,9 @@ public final Book moveBook(String name, String otherShelfName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
@@ -2003,9 +2056,10 @@ public final Book moveBook(MoveBookRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.example.library.v1;
+   * 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;
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 15f6d0c376..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,8 +71,9 @@
  * 

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

{@code
- * package com.google.cloud.example.library.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.example.library.v1.LibraryServiceSettings;
  * import java.time.Duration;
  *
  * public class LibraryServiceSettings {
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 0f1e142cf9..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,8 +31,9 @@
  * 

Sample for LibraryServiceClient: * *

{@code
- * package com.google.cloud.example.library.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.example.library.v1.LibraryServiceClient;
  * import com.google.example.library.v1.Shelf;
  *
  * public class LibraryServiceClientCreateShelf {
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 32e1e3f688..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,8 +85,9 @@
  * 

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

{@code
- * package com.google.cloud.example.library.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.example.library.v1.stub.LibraryServiceStubSettings;
  * import java.time.Duration;
  *
  * public class LibraryServiceSettings {
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 7032d218c7..4c704b7c64 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,8 +85,9 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.logging.v2;
+ * 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;
@@ -140,9 +141,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.logging.v2;
+ * 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 ConfigClientCreate {
  *
@@ -163,7 +167,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.logging.v2;
+ * 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 ConfigClientClassHeaderEndpoint {
  *
@@ -238,8 +246,9 @@ public ConfigServiceV2Stub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.BillingAccountLocationName;
    * import com.google.logging.v2.LogBucket;
    *
@@ -285,8 +294,9 @@ public final ListBucketsPagedResponse listBuckets(BillingAccountLocationName par
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.FolderLocationName;
    * import com.google.logging.v2.LogBucket;
    *
@@ -331,8 +341,9 @@ public final ListBucketsPagedResponse listBuckets(FolderLocationName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LocationName;
    * import com.google.logging.v2.LogBucket;
    *
@@ -377,8 +388,9 @@ public final ListBucketsPagedResponse listBuckets(LocationName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogBucket;
    * import com.google.logging.v2.OrganizationLocationName;
    *
@@ -423,8 +435,9 @@ public final ListBucketsPagedResponse listBuckets(OrganizationLocationName paren
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LocationName;
    * import com.google.logging.v2.LogBucket;
    *
@@ -466,8 +479,9 @@ public final ListBucketsPagedResponse listBuckets(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -508,9 +522,10 @@ public final ListBucketsPagedResponse listBuckets(ListBucketsRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -551,8 +566,9 @@ public final ListBucketsPagedResponse listBuckets(ListBucketsRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -601,8 +617,9 @@ public final UnaryCallable listBucketsC
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -641,9 +658,10 @@ public final LogBucket getBucket(GetBucketRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -682,8 +700,9 @@ public final UnaryCallable getBucketCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -723,9 +742,10 @@ public final LogBucket createBucket(CreateBucketRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -772,8 +792,9 @@ public final UnaryCallable createBucketCallable(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -824,9 +845,10 @@ public final LogBucket updateBucket(UpdateBucketRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -868,8 +890,9 @@ public final UnaryCallable updateBucketCallable(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -909,9 +932,10 @@ public final void deleteBucket(DeleteBucketRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -950,8 +974,9 @@ public final UnaryCallable deleteBucketCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -991,9 +1016,10 @@ public final void undeleteBucket(UndeleteBucketRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1031,8 +1057,9 @@ public final UnaryCallable undeleteBucketCallable(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogView;
    *
    * public class ConfigClientListViews {
@@ -1068,8 +1095,9 @@ public final ListViewsPagedResponse listViews(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.ListViewsRequest;
    * import com.google.logging.v2.LogView;
    *
@@ -1109,9 +1137,10 @@ public final ListViewsPagedResponse listViews(ListViewsRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
    *
@@ -1150,8 +1179,9 @@ public final UnaryCallable listViewsPa
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1199,8 +1229,9 @@ public final UnaryCallable listViewsCallabl
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1240,9 +1271,10 @@ public final LogView getView(GetViewRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1281,8 +1313,9 @@ public final UnaryCallable getViewCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.CreateViewRequest;
    * import com.google.logging.v2.LogView;
    *
@@ -1320,9 +1353,10 @@ public final LogView createView(CreateViewRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
    *
@@ -1360,8 +1394,9 @@ public final UnaryCallable createViewCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1401,9 +1436,10 @@ public final LogView updateView(UpdateViewRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1441,8 +1477,9 @@ public final UnaryCallable updateViewCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1482,9 +1519,10 @@ public final void deleteView(DeleteViewRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1523,8 +1561,9 @@ public final UnaryCallable deleteViewCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.BillingAccountName;
    * import com.google.logging.v2.LogSink;
    *
@@ -1563,8 +1602,9 @@ public final ListSinksPagedResponse listSinks(BillingAccountName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.FolderName;
    * import com.google.logging.v2.LogSink;
    *
@@ -1603,8 +1643,9 @@ public final ListSinksPagedResponse listSinks(FolderName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSink;
    * import com.google.logging.v2.OrganizationName;
    *
@@ -1643,8 +1684,9 @@ public final ListSinksPagedResponse listSinks(OrganizationName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSink;
    * import com.google.logging.v2.ProjectName;
    *
@@ -1683,8 +1725,9 @@ public final ListSinksPagedResponse listSinks(ProjectName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSink;
    * import com.google.logging.v2.ProjectName;
    *
@@ -1722,8 +1765,9 @@ public final ListSinksPagedResponse listSinks(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1764,9 +1808,10 @@ public final ListSinksPagedResponse listSinks(ListSinksRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1806,8 +1851,9 @@ public final UnaryCallable listSinksPa
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1856,8 +1902,9 @@ public final UnaryCallable listSinksCallabl
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSink;
    * import com.google.logging.v2.LogSinkName;
    *
@@ -1899,8 +1946,9 @@ public final LogSink getSink(LogSinkName sinkName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSink;
    * import com.google.logging.v2.LogSinkName;
    *
@@ -1939,8 +1987,9 @@ public final LogSink getSink(String sinkName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1977,9 +2026,10 @@ public final LogSink getSink(GetSinkRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -2018,8 +2068,9 @@ public final UnaryCallable getSinkCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.BillingAccountName;
    * import com.google.logging.v2.LogSink;
    *
@@ -2066,8 +2117,9 @@ public final LogSink createSink(BillingAccountName parent, LogSink sink) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.FolderName;
    * import com.google.logging.v2.LogSink;
    *
@@ -2114,8 +2166,9 @@ public final LogSink createSink(FolderName parent, LogSink sink) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSink;
    * import com.google.logging.v2.OrganizationName;
    *
@@ -2162,8 +2215,9 @@ public final LogSink createSink(OrganizationName parent, LogSink sink) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSink;
    * import com.google.logging.v2.ProjectName;
    *
@@ -2210,8 +2264,9 @@ public final LogSink createSink(ProjectName parent, LogSink sink) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSink;
    * import com.google.logging.v2.ProjectName;
    *
@@ -2255,8 +2310,9 @@ public final LogSink createSink(String parent, LogSink sink) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -2298,9 +2354,10 @@ public final LogSink createSink(CreateSinkRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -2342,8 +2399,9 @@ public final UnaryCallable createSinkCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSink;
    * import com.google.logging.v2.LogSinkName;
    *
@@ -2394,8 +2452,9 @@ public final LogSink updateSink(LogSinkName sinkName, LogSink sink) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSink;
    * import com.google.logging.v2.LogSinkName;
    *
@@ -2443,8 +2502,9 @@ public final LogSink updateSink(String sinkName, LogSink sink) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -2507,8 +2567,9 @@ public final LogSink updateSink(LogSinkName sinkName, LogSink sink, FieldMask up
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -2571,8 +2632,9 @@ public final LogSink updateSink(String sinkName, LogSink sink, FieldMask updateM
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -2617,9 +2679,10 @@ public final LogSink updateSink(UpdateSinkRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -2660,8 +2723,9 @@ public final UnaryCallable updateSinkCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSinkName;
    * import com.google.protobuf.Empty;
    *
@@ -2705,8 +2769,9 @@ public final void deleteSink(LogSinkName sinkName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogSinkName;
    * import com.google.protobuf.Empty;
    *
@@ -2747,8 +2812,9 @@ public final void deleteSink(String sinkName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -2786,9 +2852,10 @@ public final void deleteSink(DeleteSinkRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -2824,8 +2891,9 @@ public final UnaryCallable deleteSinkCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.BillingAccountName;
    * import com.google.logging.v2.LogExclusion;
    *
@@ -2866,8 +2934,9 @@ public final ListExclusionsPagedResponse listExclusions(BillingAccountName paren
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.FolderName;
    * import com.google.logging.v2.LogExclusion;
    *
@@ -2908,8 +2977,9 @@ public final ListExclusionsPagedResponse listExclusions(FolderName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogExclusion;
    * import com.google.logging.v2.OrganizationName;
    *
@@ -2950,8 +3020,9 @@ public final ListExclusionsPagedResponse listExclusions(OrganizationName parent)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogExclusion;
    * import com.google.logging.v2.ProjectName;
    *
@@ -2992,8 +3063,9 @@ public final ListExclusionsPagedResponse listExclusions(ProjectName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogExclusion;
    * import com.google.logging.v2.ProjectName;
    *
@@ -3031,8 +3103,9 @@ public final ListExclusionsPagedResponse listExclusions(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3073,9 +3146,10 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3117,8 +3191,9 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3168,8 +3243,9 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogExclusion;
    * import com.google.logging.v2.LogExclusionName;
    *
@@ -3209,8 +3285,9 @@ public final LogExclusion getExclusion(LogExclusionName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogExclusion;
    * import com.google.logging.v2.LogExclusionName;
    *
@@ -3249,8 +3326,9 @@ public final LogExclusion getExclusion(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3288,9 +3366,10 @@ public final LogExclusion getExclusion(GetExclusionRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3328,8 +3407,9 @@ public final UnaryCallable getExclusionCallab
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.BillingAccountName;
    * import com.google.logging.v2.LogExclusion;
    *
@@ -3374,8 +3454,9 @@ public final LogExclusion createExclusion(BillingAccountName parent, LogExclusio
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.FolderName;
    * import com.google.logging.v2.LogExclusion;
    *
@@ -3420,8 +3501,9 @@ public final LogExclusion createExclusion(FolderName parent, LogExclusion exclus
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogExclusion;
    * import com.google.logging.v2.OrganizationName;
    *
@@ -3466,8 +3548,9 @@ public final LogExclusion createExclusion(OrganizationName parent, LogExclusion
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogExclusion;
    * import com.google.logging.v2.ProjectName;
    *
@@ -3512,8 +3595,9 @@ public final LogExclusion createExclusion(ProjectName parent, LogExclusion exclu
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogExclusion;
    * import com.google.logging.v2.ProjectName;
    *
@@ -3555,8 +3639,9 @@ public final LogExclusion createExclusion(String parent, LogExclusion exclusion)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3595,9 +3680,10 @@ public final LogExclusion createExclusion(CreateExclusionRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3634,8 +3720,9 @@ public final UnaryCallable createExclusion
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3691,8 +3778,9 @@ public final LogExclusion updateExclusion(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3748,8 +3836,9 @@ public final LogExclusion updateExclusion(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3790,9 +3879,10 @@ public final LogExclusion updateExclusion(UpdateExclusionRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3832,8 +3922,9 @@ public final UnaryCallable updateExclusion
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogExclusionName;
    * import com.google.protobuf.Empty;
    *
@@ -3873,8 +3964,9 @@ public final void deleteExclusion(LogExclusionName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.ConfigClient;
    * import com.google.logging.v2.LogExclusionName;
    * import com.google.protobuf.Empty;
    *
@@ -3913,8 +4005,9 @@ public final void deleteExclusion(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3952,9 +4045,10 @@ public final void deleteExclusion(DeleteExclusionRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -3997,8 +4091,9 @@ public final UnaryCallable deleteExclusionCallabl
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -4041,9 +4136,10 @@ public final CmekSettings getCmekSettings(GetCmekSettingsRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -4090,8 +4186,9 @@ public final UnaryCallable getCmekSettings
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -4141,9 +4238,10 @@ public final CmekSettings updateCmekSettings(UpdateCmekSettingsRequest request)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
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 7c8144fc6a..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,8 +89,9 @@
  * 

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

{@code
- * package com.google.cloud.logging.v2;
+ * package com.google.example;
  *
+ * import com.google.cloud.logging.v2.ConfigSettings;
  * import java.time.Duration;
  *
  * public class ConfigSettings {
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 b6940e5f6d..f0e8c9c9a2 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,8 +63,9 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.logging.v2;
+ * package com.google.example;
  *
+ * import com.google.cloud.logging.v2.LoggingClient;
  * import com.google.logging.v2.LogName;
  * import com.google.protobuf.Empty;
  *
@@ -112,9 +113,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.logging.v2;
+ * 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 LoggingClientCreate {
  *
@@ -135,7 +139,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.logging.v2;
+ * 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 LoggingClientClassHeaderEndpoint {
  *
@@ -212,8 +220,9 @@ public LoggingServiceV2Stub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.LoggingClient;
    * import com.google.logging.v2.LogName;
    * import com.google.protobuf.Empty;
    *
@@ -257,8 +266,9 @@ public final void deleteLog(LogName logName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.LoggingClient;
    * import com.google.logging.v2.LogName;
    * import com.google.protobuf.Empty;
    *
@@ -299,8 +309,9 @@ public final void deleteLog(String logName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -339,9 +350,10 @@ public final void deleteLog(DeleteLogRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -380,9 +392,10 @@ public final UnaryCallable deleteLogCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -475,9 +488,10 @@ public final WriteLogEntriesResponse writeLogEntries(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -570,9 +584,10 @@ public final WriteLogEntriesResponse writeLogEntries(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -620,10 +635,11 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -671,8 +687,9 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -740,8 +757,9 @@ public final ListLogEntriesPagedResponse listLogEntries(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -786,9 +804,10 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -833,8 +852,9 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -886,9 +906,10 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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 {
@@ -928,10 +949,11 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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 {
@@ -971,9 +993,10 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1023,8 +1046,9 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.LoggingClient;
    * import com.google.logging.v2.BillingAccountName;
    *
    * public class LoggingClientListLogs {
@@ -1063,8 +1087,9 @@ public final ListLogsPagedResponse listLogs(BillingAccountName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.LoggingClient;
    * import com.google.logging.v2.FolderName;
    *
    * public class LoggingClientListLogs {
@@ -1103,8 +1128,9 @@ public final ListLogsPagedResponse listLogs(FolderName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.LoggingClient;
    * import com.google.logging.v2.OrganizationName;
    *
    * public class LoggingClientListLogs {
@@ -1143,8 +1169,9 @@ public final ListLogsPagedResponse listLogs(OrganizationName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.LoggingClient;
    * import com.google.logging.v2.ProjectName;
    *
    * public class LoggingClientListLogs {
@@ -1183,8 +1210,9 @@ public final ListLogsPagedResponse listLogs(ProjectName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.LoggingClient;
    * import com.google.logging.v2.ProjectName;
    *
    * public class LoggingClientListLogs {
@@ -1222,8 +1250,9 @@ public final ListLogsPagedResponse listLogs(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1266,9 +1295,10 @@ public final ListLogsPagedResponse listLogs(ListLogsRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1310,8 +1340,9 @@ public final UnaryCallable listLogsPaged
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1362,9 +1393,10 @@ public final UnaryCallable listLogsCallable()
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
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 c4347f986d..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,8 +69,9 @@
  * 

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

{@code
- * package com.google.cloud.logging.v2;
+ * package com.google.example;
  *
+ * import com.google.cloud.logging.v2.LoggingSettings;
  * import java.time.Duration;
  *
  * public class LoggingSettings {
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 fd88e739a7..4bcec74020 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,8 +51,9 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.logging.v2;
+ * package com.google.example;
  *
+ * import com.google.cloud.logging.v2.MetricsClient;
  * import com.google.logging.v2.LogMetric;
  * import com.google.logging.v2.LogMetricName;
  *
@@ -100,9 +101,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.logging.v2;
+ * 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 MetricsClientCreate {
  *
@@ -123,7 +127,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.logging.v2;
+ * 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 MetricsClientClassHeaderEndpoint {
  *
@@ -198,8 +206,9 @@ public MetricsServiceV2Stub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.MetricsClient;
    * import com.google.logging.v2.LogMetric;
    * import com.google.logging.v2.ProjectName;
    *
@@ -239,8 +248,9 @@ public final ListLogMetricsPagedResponse listLogMetrics(ProjectName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.MetricsClient;
    * import com.google.logging.v2.LogMetric;
    * import com.google.logging.v2.ProjectName;
    *
@@ -277,8 +287,9 @@ public final ListLogMetricsPagedResponse listLogMetrics(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -319,9 +330,10 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -362,8 +374,9 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -413,8 +426,9 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.MetricsClient;
    * import com.google.logging.v2.LogMetric;
    * import com.google.logging.v2.LogMetricName;
    *
@@ -452,8 +466,9 @@ public final LogMetric getLogMetric(LogMetricName metricName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.MetricsClient;
    * import com.google.logging.v2.LogMetric;
    * import com.google.logging.v2.LogMetricName;
    *
@@ -489,8 +504,9 @@ public final LogMetric getLogMetric(String metricName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -527,9 +543,10 @@ public final LogMetric getLogMetric(GetLogMetricRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -565,8 +582,9 @@ public final UnaryCallable getLogMetricCallable(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.MetricsClient;
    * import com.google.logging.v2.LogMetric;
    * import com.google.logging.v2.ProjectName;
    *
@@ -609,8 +627,9 @@ public final LogMetric createLogMetric(ProjectName parent, LogMetric metric) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.MetricsClient;
    * import com.google.logging.v2.LogMetric;
    * import com.google.logging.v2.ProjectName;
    *
@@ -650,8 +669,9 @@ public final LogMetric createLogMetric(String parent, LogMetric metric) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -689,9 +709,10 @@ public final LogMetric createLogMetric(CreateLogMetricRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -728,8 +749,9 @@ public final UnaryCallable createLogMetricCal
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.MetricsClient;
    * import com.google.logging.v2.LogMetric;
    * import com.google.logging.v2.LogMetricName;
    *
@@ -773,8 +795,9 @@ public final LogMetric updateLogMetric(LogMetricName metricName, LogMetric metri
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.MetricsClient;
    * import com.google.logging.v2.LogMetric;
    * import com.google.logging.v2.LogMetricName;
    *
@@ -815,8 +838,9 @@ public final LogMetric updateLogMetric(String metricName, LogMetric metric) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -854,9 +878,10 @@ public final LogMetric updateLogMetric(UpdateLogMetricRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -893,8 +918,9 @@ public final UnaryCallable updateLogMetricCal
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.MetricsClient;
    * import com.google.logging.v2.LogMetricName;
    * import com.google.protobuf.Empty;
    *
@@ -932,8 +958,9 @@ public final void deleteLogMetric(LogMetricName metricName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * package com.google.example;
    *
+   * import com.google.cloud.logging.v2.MetricsClient;
    * import com.google.logging.v2.LogMetricName;
    * import com.google.protobuf.Empty;
    *
@@ -969,8 +996,9 @@ public final void deleteLogMetric(String metricName) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
@@ -1007,9 +1035,10 @@ public final void deleteLogMetric(DeleteLogMetricRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.logging.v2;
+   * 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;
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 4e979bf6c6..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,8 +61,9 @@
  * 

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

{@code
- * package com.google.cloud.logging.v2;
+ * package com.google.example;
  *
+ * import com.google.cloud.logging.v2.MetricsSettings;
  * import java.time.Duration;
  *
  * public class MetricsSettings {
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 90fcb9b6be..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,8 +24,9 @@
  * 

Sample for LoggingClient: * *

{@code
- * package com.google.cloud.logging.v2;
+ * package com.google.example;
  *
+ * import com.google.cloud.logging.v2.LoggingClient;
  * import com.google.logging.v2.LogName;
  * import com.google.protobuf.Empty;
  *
@@ -51,8 +52,9 @@
  * 

Sample for ConfigClient: * *

{@code
- * package com.google.cloud.logging.v2;
+ * 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;
@@ -84,8 +86,9 @@
  * 

Sample for MetricsClient: * *

{@code
- * package com.google.cloud.logging.v2;
+ * package com.google.example;
  *
+ * import com.google.cloud.logging.v2.MetricsClient;
  * import com.google.logging.v2.LogMetric;
  * import com.google.logging.v2.LogMetricName;
  *
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 4d86c0c508..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,8 +103,9 @@
  * 

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

{@code
- * package com.google.cloud.logging.v2.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.logging.v2.stub.ConfigServiceV2StubSettings;
  * import java.time.Duration;
  *
  * public class ConfigSettings {
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 fa2b16e052..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,8 +93,9 @@
  * 

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

{@code
- * package com.google.cloud.logging.v2.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.logging.v2.stub.LoggingServiceV2StubSettings;
  * import java.time.Duration;
  *
  * public class LoggingSettings {
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 3f949e192e..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,8 +75,9 @@
  * 

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

{@code
- * package com.google.cloud.logging.v2.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.logging.v2.stub.MetricsServiceV2StubSettings;
  * import java.time.Duration;
  *
  * public class MetricsSettings {
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 11d50908be..b85b76fe95 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,8 +59,9 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.pubsub.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.pubsub.v1.SchemaServiceClient;
  * import com.google.pubsub.v1.ProjectName;
  * import com.google.pubsub.v1.Schema;
  *
@@ -110,9 +111,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.pubsub.v1;
+ * 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 SchemaServiceClientCreate {
  *
@@ -133,7 +137,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.pubsub.v1;
+ * 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 SchemaServiceClientClassHeaderEndpoint {
  *
@@ -211,8 +219,9 @@ public SchemaServiceStub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
    * import com.google.pubsub.v1.ProjectName;
    * import com.google.pubsub.v1.Schema;
    *
@@ -261,8 +270,9 @@ public final Schema createSchema(ProjectName parent, Schema schema, String schem
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
    * import com.google.pubsub.v1.ProjectName;
    * import com.google.pubsub.v1.Schema;
    *
@@ -311,8 +321,9 @@ public final Schema createSchema(String parent, Schema schema, String schemaId)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -351,9 +362,10 @@ public final Schema createSchema(CreateSchemaRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -391,8 +403,9 @@ public final UnaryCallable createSchemaCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
    * import com.google.pubsub.v1.Schema;
    * import com.google.pubsub.v1.SchemaName;
    *
@@ -428,8 +441,9 @@ public final Schema getSchema(SchemaName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
    * import com.google.pubsub.v1.Schema;
    * import com.google.pubsub.v1.SchemaName;
    *
@@ -464,8 +478,9 @@ public final Schema getSchema(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -504,9 +519,10 @@ public final Schema getSchema(GetSchemaRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -544,8 +560,9 @@ public final UnaryCallable getSchemaCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
    * import com.google.pubsub.v1.ProjectName;
    * import com.google.pubsub.v1.Schema;
    *
@@ -585,8 +602,9 @@ public final ListSchemasPagedResponse listSchemas(ProjectName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
    * import com.google.pubsub.v1.ProjectName;
    * import com.google.pubsub.v1.Schema;
    *
@@ -623,8 +641,9 @@ public final ListSchemasPagedResponse listSchemas(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -667,9 +686,10 @@ public final ListSchemasPagedResponse listSchemas(ListSchemasRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -712,8 +732,9 @@ public final ListSchemasPagedResponse listSchemas(ListSchemasRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -764,8 +785,9 @@ public final UnaryCallable listSchemasC
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
    * import com.google.protobuf.Empty;
    * import com.google.pubsub.v1.SchemaName;
    *
@@ -801,8 +823,9 @@ public final void deleteSchema(SchemaName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SchemaServiceClient;
    * import com.google.protobuf.Empty;
    * import com.google.pubsub.v1.SchemaName;
    *
@@ -837,8 +860,9 @@ public final void deleteSchema(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -875,9 +899,10 @@ public final void deleteSchema(DeleteSchemaRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -913,8 +938,9 @@ public final UnaryCallable deleteSchemaCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -956,8 +982,9 @@ public final ValidateSchemaResponse validateSchema(ProjectName parent, Schema sc
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -996,8 +1023,9 @@ public final ValidateSchemaResponse validateSchema(String parent, Schema schema)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1036,9 +1064,10 @@ public final ValidateSchemaResponse validateSchema(ValidateSchemaRequest request
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1078,8 +1107,9 @@ public final ValidateSchemaResponse validateSchema(ValidateSchemaRequest request
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1120,9 +1150,10 @@ public final ValidateMessageResponse validateMessage(ValidateMessageRequest requ
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1166,8 +1197,9 @@ public final ValidateMessageResponse validateMessage(ValidateMessageRequest requ
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1207,9 +1239,10 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1247,8 +1280,9 @@ public final UnaryCallable setIamPolicyCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1288,9 +1322,10 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1333,8 +1368,9 @@ public final UnaryCallable getIamPolicyCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1378,9 +1414,10 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
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 b652251dc2..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,8 +69,9 @@
  * 

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

{@code
- * package com.google.cloud.pubsub.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.pubsub.v1.SchemaServiceSettings;
  * import java.time.Duration;
  *
  * public class SchemaServiceSettings {
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 1a481e40d8..e46af4fc5c 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,8 +77,9 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.pubsub.v1;
+ * 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;
@@ -133,9 +134,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.pubsub.v1;
+ * 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 SubscriptionAdminClientCreate {
  *
@@ -157,7 +161,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.pubsub.v1;
+ * 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 SubscriptionAdminClientClassHeaderEndpoint {
  *
@@ -245,8 +253,9 @@ public SubscriberStub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -327,8 +336,9 @@ public final Subscription createSubscription(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -409,8 +419,9 @@ public final Subscription createSubscription(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -491,8 +502,9 @@ public final Subscription createSubscription(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -573,8 +585,9 @@ public final Subscription createSubscription(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -639,9 +652,10 @@ public final Subscription createSubscription(Subscription request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -697,8 +711,9 @@ public final UnaryCallable createSubscriptionCallabl
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.Subscription;
    * import com.google.pubsub.v1.SubscriptionName;
    *
@@ -736,8 +751,9 @@ public final Subscription getSubscription(SubscriptionName subscription) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.Subscription;
    * import com.google.pubsub.v1.SubscriptionName;
    *
@@ -773,8 +789,9 @@ public final Subscription getSubscription(String subscription) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -811,9 +828,10 @@ public final Subscription getSubscription(GetSubscriptionRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -851,8 +869,9 @@ public final UnaryCallable getSubscription
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -891,9 +910,10 @@ public final Subscription updateSubscription(UpdateSubscriptionRequest request)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -931,8 +951,9 @@ public final UnaryCallable updateSubscr
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.ProjectName;
    * import com.google.pubsub.v1.Subscription;
    *
@@ -972,8 +993,9 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ProjectName projec
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.ProjectName;
    * import com.google.pubsub.v1.Subscription;
    *
@@ -1011,8 +1033,9 @@ public final ListSubscriptionsPagedResponse listSubscriptions(String project) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1053,9 +1076,10 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1097,8 +1121,9 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1152,8 +1177,9 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.protobuf.Empty;
    * import com.google.pubsub.v1.SubscriptionName;
    *
@@ -1194,8 +1220,9 @@ public final void deleteSubscription(SubscriptionName subscription) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.protobuf.Empty;
    * import com.google.pubsub.v1.SubscriptionName;
    *
@@ -1234,8 +1261,9 @@ public final void deleteSubscription(String subscription) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1275,9 +1303,10 @@ public final void deleteSubscription(DeleteSubscriptionRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1317,8 +1346,9 @@ public final UnaryCallable deleteSubscriptionC
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1374,8 +1404,9 @@ public final void modifyAckDeadline(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1431,8 +1462,9 @@ public final void modifyAckDeadline(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1475,9 +1507,10 @@ public final void modifyAckDeadline(ModifyAckDeadlineRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1521,8 +1554,9 @@ public final UnaryCallable modifyAckDeadlineCal
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1570,8 +1604,9 @@ public final void acknowledge(SubscriptionName subscription, List ackIds
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1616,8 +1651,9 @@ public final void acknowledge(String subscription, List ackIds) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1660,9 +1696,10 @@ public final void acknowledge(AcknowledgeRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1701,8 +1738,9 @@ public final UnaryCallable acknowledgeCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.PullResponse;
    * import com.google.pubsub.v1.SubscriptionName;
    *
@@ -1745,8 +1783,9 @@ public final PullResponse pull(SubscriptionName subscription, int maxMessages) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.PullResponse;
    * import com.google.pubsub.v1.SubscriptionName;
    *
@@ -1786,8 +1825,9 @@ public final PullResponse pull(String subscription, int maxMessages) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.PullResponse;
    * import com.google.pubsub.v1.SubscriptionName;
    *
@@ -1840,8 +1880,9 @@ public final PullResponse pull(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.PullResponse;
    * import com.google.pubsub.v1.SubscriptionName;
    *
@@ -1893,8 +1934,9 @@ public final PullResponse pull(String subscription, boolean returnImmediately, i
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1934,9 +1976,10 @@ public final PullResponse pull(PullRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1979,9 +2022,10 @@ public final UnaryCallable pullCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2034,8 +2078,9 @@ public final UnaryCallable pullCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2085,8 +2130,9 @@ public final void modifyPushConfig(SubscriptionName subscription, PushConfig pus
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2136,8 +2182,9 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2181,9 +2228,10 @@ public final void modifyPushConfig(ModifyPushConfigRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2225,8 +2273,9 @@ public final UnaryCallable modifyPushConfigCalla
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.Snapshot;
    * import com.google.pubsub.v1.SnapshotName;
    *
@@ -2267,8 +2316,9 @@ public final Snapshot getSnapshot(SnapshotName snapshot) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.Snapshot;
    * import com.google.pubsub.v1.SnapshotName;
    *
@@ -2306,8 +2356,9 @@ public final Snapshot getSnapshot(String snapshot) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2347,9 +2398,10 @@ public final Snapshot getSnapshot(GetSnapshotRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2389,8 +2441,9 @@ public final UnaryCallable getSnapshotCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.ProjectName;
    * import com.google.pubsub.v1.Snapshot;
    *
@@ -2433,8 +2486,9 @@ public final ListSnapshotsPagedResponse listSnapshots(ProjectName project) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.pubsub.v1.ProjectName;
    * import com.google.pubsub.v1.Snapshot;
    *
@@ -2474,8 +2528,9 @@ public final ListSnapshotsPagedResponse listSnapshots(String project) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2519,9 +2574,10 @@ public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest reque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2566,8 +2622,9 @@ public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest reque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2628,8 +2685,9 @@ public final UnaryCallable listSnap
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2691,8 +2749,9 @@ public final Snapshot createSnapshot(SnapshotName name, SubscriptionName subscri
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2754,8 +2813,9 @@ public final Snapshot createSnapshot(SnapshotName name, String subscription) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2817,8 +2877,9 @@ public final Snapshot createSnapshot(String name, SubscriptionName subscription)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2877,8 +2938,9 @@ public final Snapshot createSnapshot(String name, String subscription) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2930,9 +2992,10 @@ public final Snapshot createSnapshot(CreateSnapshotRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -2976,8 +3039,9 @@ public final UnaryCallable createSnapshotCallab
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -3018,9 +3082,10 @@ public final Snapshot updateSnapshot(UpdateSnapshotRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -3064,8 +3129,9 @@ public final UnaryCallable updateSnapshotCallab
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.protobuf.Empty;
    * import com.google.pubsub.v1.SnapshotName;
    *
@@ -3109,8 +3175,9 @@ public final void deleteSnapshot(SnapshotName snapshot) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
    * import com.google.protobuf.Empty;
    * import com.google.pubsub.v1.SnapshotName;
    *
@@ -3152,8 +3219,9 @@ public final void deleteSnapshot(String snapshot) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -3196,9 +3264,10 @@ public final void deleteSnapshot(DeleteSnapshotRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -3240,8 +3309,9 @@ public final UnaryCallable deleteSnapshotCallable(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -3283,9 +3353,10 @@ public final SeekResponse seek(SeekRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -3323,8 +3394,9 @@ public final UnaryCallable seekCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -3364,9 +3436,10 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -3404,8 +3477,9 @@ public final UnaryCallable setIamPolicyCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -3445,9 +3519,10 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -3490,8 +3565,9 @@ public final UnaryCallable getIamPolicyCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -3535,9 +3611,10 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
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 ef81bae680..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,8 +83,9 @@
  * 

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

{@code
- * package com.google.cloud.pubsub.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.pubsub.v1.SubscriptionAdminSettings;
  * import java.time.Duration;
  *
  * public class SubscriptionAdminSettings {
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 4083cb705a..60c11bc77f 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,8 +65,9 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.pubsub.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.pubsub.v1.TopicAdminClient;
  * import com.google.pubsub.v1.Topic;
  * import com.google.pubsub.v1.TopicName;
  *
@@ -114,9 +115,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.pubsub.v1;
+ * 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 TopicAdminClientCreate {
  *
@@ -137,7 +141,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.pubsub.v1;
+ * 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 TopicAdminClientClassHeaderEndpoint {
  *
@@ -214,8 +222,9 @@ public PublisherStub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.Topic;
    * import com.google.pubsub.v1.TopicName;
    *
@@ -254,8 +263,9 @@ public final Topic createTopic(TopicName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.Topic;
    * import com.google.pubsub.v1.TopicName;
    *
@@ -294,8 +304,9 @@ public final Topic createTopic(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -342,9 +353,10 @@ public final Topic createTopic(Topic request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -389,8 +401,9 @@ public final UnaryCallable createTopicCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -428,9 +441,10 @@ public final Topic updateTopic(UpdateTopicRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -467,8 +481,9 @@ public final UnaryCallable updateTopicCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -512,8 +527,9 @@ public final PublishResponse publish(TopicName topic, List messag
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -554,8 +570,9 @@ public final PublishResponse publish(String topic, List messages)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -595,9 +612,10 @@ public final PublishResponse publish(PublishRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -636,8 +654,9 @@ public final UnaryCallable publishCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.Topic;
    * import com.google.pubsub.v1.TopicName;
    *
@@ -673,8 +692,9 @@ public final Topic getTopic(TopicName topic) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.Topic;
    * import com.google.pubsub.v1.TopicName;
    *
@@ -709,8 +729,9 @@ public final Topic getTopic(String topic) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -747,9 +768,10 @@ public final Topic getTopic(GetTopicRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -785,8 +807,9 @@ public final UnaryCallable getTopicCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.ProjectName;
    * import com.google.pubsub.v1.Topic;
    *
@@ -826,8 +849,9 @@ public final ListTopicsPagedResponse listTopics(ProjectName project) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.ProjectName;
    * import com.google.pubsub.v1.Topic;
    *
@@ -864,8 +888,9 @@ public final ListTopicsPagedResponse listTopics(String project) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -906,9 +931,10 @@ public final ListTopicsPagedResponse listTopics(ListTopicsRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -948,8 +974,9 @@ public final UnaryCallable listTopic
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -998,8 +1025,9 @@ public final UnaryCallable listTopicsCall
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.TopicName;
    *
    * public class TopicAdminClientListTopicSubscriptions {
@@ -1038,8 +1066,9 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(TopicNam
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.TopicName;
    *
    * public class TopicAdminClientListTopicSubscriptions {
@@ -1076,8 +1105,9 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(String t
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
    * import com.google.pubsub.v1.TopicName;
    *
@@ -1118,9 +1148,10 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
    *
@@ -1161,8 +1192,9 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1215,8 +1247,9 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.TopicName;
    *
    * public class TopicAdminClientListTopicSnapshots {
@@ -1258,8 +1291,9 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(TopicName topic)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.TopicName;
    *
    * public class TopicAdminClientListTopicSnapshots {
@@ -1299,8 +1333,9 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(String topic) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.pubsub.v1.ListTopicSnapshotsRequest;
    * import com.google.pubsub.v1.TopicName;
    *
@@ -1344,9 +1379,10 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
    *
@@ -1390,8 +1426,9 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1444,8 +1481,9 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.protobuf.Empty;
    * import com.google.pubsub.v1.TopicName;
    *
@@ -1484,8 +1522,9 @@ public final void deleteTopic(TopicName topic) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * package com.google.example;
    *
+   * import com.google.cloud.pubsub.v1.TopicAdminClient;
    * import com.google.protobuf.Empty;
    * import com.google.pubsub.v1.TopicName;
    *
@@ -1523,8 +1562,9 @@ public final void deleteTopic(String topic) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1564,9 +1604,10 @@ public final void deleteTopic(DeleteTopicRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1604,8 +1645,9 @@ public final UnaryCallable deleteTopicCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1644,9 +1686,10 @@ public final DetachSubscriptionResponse detachSubscription(DetachSubscriptionReq
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1686,8 +1729,9 @@ public final DetachSubscriptionResponse detachSubscription(DetachSubscriptionReq
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1727,9 +1771,10 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1767,8 +1812,9 @@ public final UnaryCallable setIamPolicyCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1808,9 +1854,10 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1853,8 +1900,9 @@ public final UnaryCallable getIamPolicyCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
@@ -1898,9 +1946,10 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
-   * package com.google.cloud.pubsub.v1;
+   * 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;
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 ac44c7a901..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,8 +76,9 @@
  * 

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

{@code
- * package com.google.cloud.pubsub.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.pubsub.v1.TopicAdminSettings;
  * import java.time.Duration;
  *
  * public class TopicAdminSettings {
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 737ed4df56..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,8 +27,9 @@
  * 

Sample for TopicAdminClient: * *

{@code
- * package com.google.cloud.pubsub.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.pubsub.v1.TopicAdminClient;
  * import com.google.pubsub.v1.Topic;
  * import com.google.pubsub.v1.TopicName;
  *
@@ -56,8 +57,9 @@
  * 

Sample for SubscriptionAdminClient: * *

{@code
- * package com.google.cloud.pubsub.v1;
+ * 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;
@@ -89,8 +91,9 @@
  * 

Sample for SchemaServiceClient: * *

{@code
- * package com.google.cloud.pubsub.v1;
+ * package com.google.example;
  *
+ * import com.google.cloud.pubsub.v1.SchemaServiceClient;
  * import com.google.pubsub.v1.ProjectName;
  * import com.google.pubsub.v1.Schema;
  *
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 20ea368a4c..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,8 +99,9 @@
  * 

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

{@code
- * package com.google.cloud.pubsub.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.pubsub.v1.stub.PublisherStubSettings;
  * import java.time.Duration;
  *
  * public class TopicAdminSettings {
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 3478c6d199..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,8 +82,9 @@
  * 

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

{@code
- * package com.google.cloud.pubsub.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.pubsub.v1.stub.SchemaServiceStubSettings;
  * import java.time.Duration;
  *
  * public class SchemaServiceSettings {
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 b87e0e654b..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,8 +97,9 @@
  * 

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

{@code
- * package com.google.cloud.pubsub.v1.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.pubsub.v1.stub.SubscriberStubSettings;
  * import java.time.Duration;
  *
  * public class SubscriptionAdminSettings {
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 cc367d783c..1c9eaa4d77 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,7 +67,11 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.cloud.redis.v1beta1;
+ * 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 {
  *
@@ -113,9 +117,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.cloud.redis.v1beta1;
+ * 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 CloudRedisClientCreate {
  *
@@ -136,7 +143,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.cloud.redis.v1beta1;
+ * 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 CloudRedisClientClassHeaderEndpoint {
  *
@@ -234,7 +245,11 @@ public final OperationsClient getOperationsClient() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -282,7 +297,11 @@ public final ListInstancesPagedResponse listInstances(LocationName parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -327,7 +346,12 @@ public final ListInstancesPagedResponse listInstances(String parent) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -375,9 +399,13 @@ public final ListInstancesPagedResponse listInstances(ListInstancesRequest reque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -426,8 +454,13 @@ public final ListInstancesPagedResponse listInstances(ListInstancesRequest reque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -472,7 +505,11 @@ public final UnaryCallable listInst
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -507,7 +544,11 @@ public final Instance getInstance(InstanceName name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -541,7 +582,12 @@ public final Instance getInstance(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -575,9 +621,13 @@ public final Instance getInstance(GetInstanceRequest request) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -621,7 +671,11 @@ public final UnaryCallable getInstanceCallable() {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -684,7 +738,11 @@ public final OperationFuture createInstanceAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -747,7 +805,12 @@ public final OperationFuture createInstanceAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -794,9 +857,13 @@ public final OperationFuture createInstanceAsync(CreateInstanceRe
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -845,9 +912,13 @@ public final OperationFuture createInstanceAsync(CreateInstanceRe
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -887,8 +958,10 @@ public final UnaryCallable createInstanceCalla
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -932,8 +1005,11 @@ public final OperationFuture updateInstanceAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -973,9 +1049,12 @@ public final OperationFuture updateInstanceAsync(UpdateInstanceRe
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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;
    *
@@ -1017,9 +1096,12 @@ public final OperationFuture updateInstanceAsync(UpdateInstanceRe
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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;
    *
@@ -1055,7 +1137,11 @@ public final UnaryCallable updateInstanceCalla
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -1096,7 +1182,11 @@ public final OperationFuture upgradeInstanceAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -1134,7 +1224,12 @@ public final OperationFuture upgradeInstanceAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -1169,9 +1264,13 @@ public final OperationFuture upgradeInstanceAsync(UpgradeInstance
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -1208,9 +1307,12 @@ public final OperationFuture upgradeInstanceAsync(UpgradeInstance
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -1251,7 +1353,11 @@ public final UnaryCallable upgradeInstanceCal
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -1295,7 +1401,12 @@ public final OperationFuture importInstanceAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -1336,9 +1447,13 @@ public final OperationFuture importInstanceAsync(ImportInstanceRe
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -1381,9 +1496,12 @@ public final OperationFuture importInstanceAsync(ImportInstanceRe
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -1423,7 +1541,11 @@ public final UnaryCallable importInstanceCalla
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -1466,7 +1588,12 @@ public final OperationFuture exportInstanceAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -1506,9 +1633,13 @@ public final OperationFuture exportInstanceAsync(ExportInstanceRe
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -1550,9 +1681,12 @@ public final OperationFuture exportInstanceAsync(ExportInstanceRe
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -1588,7 +1722,12 @@ public final UnaryCallable exportInstanceCalla
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -1632,7 +1771,12 @@ public final OperationFuture failoverInstanceAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -1676,7 +1820,12 @@ public final OperationFuture failoverInstanceAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
    *
@@ -1712,9 +1861,13 @@ public final OperationFuture failoverInstanceAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -1751,9 +1904,12 @@ public final OperationFuture failoverInstanceAsync(
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -1787,8 +1943,10 @@ public final UnaryCallable failoverInstanceC
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -1824,8 +1982,10 @@ public final OperationFuture deleteInstanceAsync(InstanceName name)
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -1860,8 +2020,11 @@ public final OperationFuture deleteInstanceAsync(String name) {
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
@@ -1896,9 +2059,12 @@ public final OperationFuture deleteInstanceAsync(DeleteInstanceReque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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;
    *
@@ -1935,9 +2101,12 @@ public final OperationFuture deleteInstanceAsync(DeleteInstanceReque
    * 

Sample code: * *

{@code
-   * package com.google.cloud.redis.v1beta1;
+   * 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 {
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 655e42ef46..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,8 +57,9 @@
  * 

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

{@code
- * package com.google.cloud.redis.v1beta1;
+ * package com.google.example;
  *
+ * import com.google.cloud.redis.v1beta1.CloudRedisSettings;
  * import java.time.Duration;
  *
  * public class CloudRedisSettings {
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 96a1264672..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,7 +43,11 @@
  * 

Sample for CloudRedisClient: * *

{@code
- * package com.google.cloud.redis.v1beta1;
+ * 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 {
  *
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 0275f3739e..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,8 +85,9 @@
  * 

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

{@code
- * package com.google.cloud.redis.v1beta1.stub;
+ * package com.google.example;
  *
+ * import com.google.cloud.redis.v1beta1.stub.CloudRedisStubSettings;
  * import java.time.Duration;
  *
  * public class CloudRedisSettings {
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 a5ad65debe..97e3d34908 100644
--- a/test/integration/goldens/storage/com/google/storage/v2/StorageClient.java
+++ b/test/integration/goldens/storage/com/google/storage/v2/StorageClient.java
@@ -35,7 +35,14 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
- * package com.google.storage.v2;
+ * 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 {
  *
@@ -86,9 +93,12 @@
  * 

To customize credentials: * *

{@code
- * package com.google.storage.v2;
+ * 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 StorageClientCreate {
  *
@@ -109,7 +119,11 @@
  * 

To customize the endpoint: * *

{@code
- * package com.google.storage.v2;
+ * package com.google.example;
+ *
+ * import com.google.storage.v2.StorageClient;
+ * import com.google.storage.v2.StorageSettings;
+ * import com.google.storage.v2.myEndpoint;
  *
  * public class StorageClientClassHeaderEndpoint {
  *
@@ -184,10 +198,15 @@ public StorageStub getStub() {
    * 

Sample code: * *

{@code
-   * package com.google.storage.v2;
+   * 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 {
    *
@@ -251,9 +270,15 @@ public final ServerStreamingCallable read
    * 

Sample code: * *

{@code
-   * package com.google.storage.v2;
+   * 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 {
    *
@@ -309,7 +334,14 @@ public final ServerStreamingCallable read
    * 

Sample code: * *

{@code
-   * package com.google.storage.v2;
+   * 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 {
    *
@@ -346,9 +378,15 @@ public final StartResumableWriteResponse startResumableWrite(StartResumableWrite
    * 

Sample code: * *

{@code
-   * package com.google.storage.v2;
+   * 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 {
    *
@@ -395,7 +433,10 @@ public final StartResumableWriteResponse startResumableWrite(StartResumableWrite
    * 

Sample code: * *

{@code
-   * package com.google.storage.v2;
+   * package com.google.example;
+   *
+   * import com.google.storage.v2.QueryWriteStatusResponse;
+   * import com.google.storage.v2.StorageClient;
    *
    * public class StorageClientQueryWriteStatus {
    *
@@ -439,7 +480,13 @@ public final QueryWriteStatusResponse queryWriteStatus(String uploadId) {
    * 

Sample code: * *

{@code
-   * package com.google.storage.v2;
+   * 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 {
    *
@@ -485,9 +532,14 @@ public final QueryWriteStatusResponse queryWriteStatus(QueryWriteStatusRequest r
    * 

Sample code: * *

{@code
-   * package com.google.storage.v2;
+   * 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 {
    *
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 98d363266d..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,8 +52,9 @@
  * 

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

{@code
- * package com.google.storage.v2;
+ * package com.google.example;
  *
+ * import com.google.storage.v2.StorageSettings;
  * import java.time.Duration;
  *
  * public class StorageSettings {
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 fe1cd16012..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,7 +24,14 @@
  * 

Sample for StorageClient: * *

{@code
- * package com.google.storage.v2;
+ * 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 {
  *
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 ce5a3fae3e..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,8 +68,9 @@
  * 

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

{@code
- * package com.google.storage.v2.stub;
+ * package com.google.example;
  *
+ * import com.google.storage.v2.stub.StorageStubSettings;
  * import java.time.Duration;
  *
  * public class StorageSettings {

From 36d1985a675a5c3516efd6a2706d860b51d8b6f4 Mon Sep 17 00:00:00 2001
From: Emily Ball 
Date: Wed, 1 Dec 2021 16:53:20 -0800
Subject: [PATCH 09/13] cleanup

---
 .../composer/samplecode/ExecutableSample.java | 22 ++++++++++++++-----
 .../samplecode/ExecutableSampleComposer.java  | 12 +++++-----
 .../gapic/composer/samplecode/SampleUtil.java |  1 -
 .../ServiceClientSampleCodeComposer.java      |  4 ++--
 .../grpc/goldens/BookshopClient.golden        | 12 +++++-----
 .../goldens/DeprecatedServiceClient.golden    | 12 +++++-----
 .../composer/grpc/goldens/EchoClient.golden   | 12 +++++-----
 .../grpc/goldens/IdentityClient.golden        | 12 +++++-----
 .../grpc/goldens/MessagingClient.golden       | 12 +++++-----
 .../ServiceClientSampleCodeComposerTest.java  | 12 +++++-----
 .../cloud/asset/v1/AssetServiceClient.java    | 12 +++++-----
 .../cloud/compute/v1/AddressesClient.java     | 12 +++++-----
 .../compute/v1/RegionOperationsClient.java    | 12 +++++-----
 .../credentials/v1/IamCredentialsClient.java  | 12 +++++-----
 .../com/google/iam/v1/IAMPolicyClient.java    | 12 +++++-----
 .../kms/v1/KeyManagementServiceClient.java    | 12 +++++-----
 .../library/v1/LibraryServiceClient.java      | 12 +++++-----
 .../google/cloud/logging/v2/ConfigClient.java | 12 +++++-----
 .../cloud/logging/v2/LoggingClient.java       | 12 +++++-----
 .../cloud/logging/v2/MetricsClient.java       | 12 +++++-----
 .../cloud/pubsub/v1/SchemaServiceClient.java  | 12 +++++-----
 .../pubsub/v1/SubscriptionAdminClient.java    | 12 +++++-----
 .../cloud/pubsub/v1/TopicAdminClient.java     | 12 +++++-----
 .../cloud/redis/v1beta1/CloudRedisClient.java | 12 +++++-----
 .../com/google/storage/v2/StorageClient.java  | 12 +++++-----
 25 files changed, 152 insertions(+), 139 deletions(-)

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
index 4d65484a32..8fea5296c5 100644
--- 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
@@ -19,16 +19,28 @@
 import java.util.List;
 
 public class ExecutableSample {
-  final String sampleMethodName;
-  final List sampleVariableAssignments;
-  final List sampleBody;
+  private final String sampleName;
+  private final List sampleVariableAssignments;
+  private final List sampleBody;
 
   public ExecutableSample(
-      String sampleMethodName,
+      String sampleName,
       List sampleVariableAssignments,
       List sampleBody) {
-    this.sampleMethodName = sampleMethodName;
+    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
index e61b91a300..bd2455f283 100644
--- 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
@@ -27,19 +27,22 @@ public class ExecutableSampleComposer {
   public static String createExecutableSample(ExecutableSample executableSample) {
     return SampleCodeWriter.write(
         composeExecutableSample(
-            executableSample.sampleMethodName,
-            executableSample.sampleVariableAssignments,
-            executableSample.sampleBody));
+            executableSample.getSampleName(),
+            executableSample.getSampleVariableAssignments(),
+            executableSample.getSampleBody()));
   }
 
   public static Optional createExecutableSample(
       Optional executableSample) {
     if (executableSample.isPresent()) {
       ExecutableSample sample = executableSample.get();
+      String sampleMethodName = JavaStyle.toLowerCamelCase(sample.getSampleName());
       return Optional.of(
           SampleCodeWriter.write(
               composeExecutableSample(
-                  sample.sampleMethodName, sample.sampleVariableAssignments, sample.sampleBody)));
+                  sampleMethodName,
+                  sample.getSampleVariableAssignments(),
+                  sample.getSampleBody())));
     }
     return Optional.empty();
   }
@@ -48,7 +51,6 @@ static ClassDefinition composeExecutableSample(
       String sampleMethodName,
       List sampleVariableAssignments,
       List sampleBody) {
-
     String sampleClassName = JavaStyle.toUpperCamelCase(sampleMethodName);
     List sampleMethodArgs = composeSampleMethodArgs(sampleVariableAssignments);
     MethodDefinition mainMethod =
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
index a074bf8b78..41520574c5 100644
--- 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
@@ -36,7 +36,6 @@ public static MethodInvocationExpr systemOutPrint(VariableExpr variableExpr) {
   static MethodInvocationExpr composeSystemOutPrint(Expr content) {
     VaporReference out =
         VaporReference.builder()
-            .setSupertypeReference(ConcreteReference.withClazz(System.class))
             .setEnclosingClassNames("System")
             .setName("out")
             .setPakkage("java.lang")
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 08252fca7d..19f93da5ed 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
@@ -167,7 +167,7 @@ public static ExecutableSample composeClassHeaderCredentialsSampleCode(
             ExprStatement.withExpr(initSettingsVarExpr), ExprStatement.withExpr(initClientVarExpr));
 
     return new ExecutableSample(
-        composeSampleMethodName(clientName, "create"), new ArrayList<>(), sampleBody);
+        composeSampleMethodName(clientName, "setCredentialsProvider"), new ArrayList<>(), sampleBody);
   }
 
   public static ExecutableSample composeClassHeaderEndpointSampleCode(
@@ -234,7 +234,7 @@ public static ExecutableSample composeClassHeaderEndpointSampleCode(
             ExprStatement.withExpr(initSettingsVarExpr), ExprStatement.withExpr(initClientVarExpr));
 
     return new ExecutableSample(
-        composeSampleMethodName(clientName, "ClassHeaderEndpoint"), new ArrayList<>(), sampleBody);
+        composeSampleMethodName(clientName, "setEndpoint"), new ArrayList<>(), sampleBody);
   }
 
   public static ExecutableSample composeRpcMethodHeaderSampleCode(
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 ff44517058..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
@@ -75,13 +75,13 @@ import javax.annotation.Generated;
  * import com.google.bookshop.v1beta1.BookshopSettings;
  * import com.google.bookshop.v1beta1.myCredentials;
  *
- * public class BookshopClientCreate {
+ * public class BookshopClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     bookshopClientCreate();
+ *     bookshopClientSetCredentialsProvider();
  *   }
  *
- *   public static void bookshopClientCreate() throws Exception {
+ *   public static void bookshopClientSetCredentialsProvider() throws Exception {
  *     BookshopSettings bookshopSettings =
  *         BookshopSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -100,13 +100,13 @@ import javax.annotation.Generated;
  * import com.google.bookshop.v1beta1.BookshopSettings;
  * import com.google.bookshop.v1beta1.myEndpoint;
  *
- * public class BookshopClientClassHeaderEndpoint {
+ * public class BookshopClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     bookshopClientClassHeaderEndpoint();
+ *     bookshopClientSetEndpoint();
  *   }
  *
- *   public static void bookshopClientClassHeaderEndpoint() throws Exception {
+ *   public static void bookshopClientSetEndpoint() throws Exception {
  *     BookshopSettings bookshopSettings =
  *         BookshopSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     BookshopClient bookshopClient = BookshopClient.create(bookshopSettings);
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 cc41174103..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
@@ -74,13 +74,13 @@ import javax.annotation.Generated;
  * import com.google.testdata.v1.DeprecatedServiceSettings;
  * import com.google.testdata.v1.myCredentials;
  *
- * public class DeprecatedServiceClientCreate {
+ * public class DeprecatedServiceClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     deprecatedServiceClientCreate();
+ *     deprecatedServiceClientSetCredentialsProvider();
  *   }
  *
- *   public static void deprecatedServiceClientCreate() throws Exception {
+ *   public static void deprecatedServiceClientSetCredentialsProvider() throws Exception {
  *     DeprecatedServiceSettings deprecatedServiceSettings =
  *         DeprecatedServiceSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -100,13 +100,13 @@ import javax.annotation.Generated;
  * import com.google.testdata.v1.DeprecatedServiceSettings;
  * import com.google.testdata.v1.myEndpoint;
  *
- * public class DeprecatedServiceClientClassHeaderEndpoint {
+ * public class DeprecatedServiceClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     deprecatedServiceClientClassHeaderEndpoint();
+ *     deprecatedServiceClientSetEndpoint();
  *   }
  *
- *   public static void deprecatedServiceClientClassHeaderEndpoint() throws Exception {
+ *   public static void deprecatedServiceClientSetEndpoint() throws Exception {
  *     DeprecatedServiceSettings deprecatedServiceSettings =
  *         DeprecatedServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     DeprecatedServiceClient deprecatedServiceClient =
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 ee075aa115..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
@@ -89,13 +89,13 @@ import javax.annotation.Generated;
  * import com.google.showcase.v1beta1.EchoSettings;
  * import com.google.showcase.v1beta1.myCredentials;
  *
- * public class EchoClientCreate {
+ * public class EchoClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     echoClientCreate();
+ *     echoClientSetCredentialsProvider();
  *   }
  *
- *   public static void echoClientCreate() throws Exception {
+ *   public static void echoClientSetCredentialsProvider() throws Exception {
  *     EchoSettings echoSettings =
  *         EchoSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -114,13 +114,13 @@ import javax.annotation.Generated;
  * import com.google.showcase.v1beta1.EchoSettings;
  * import com.google.showcase.v1beta1.myEndpoint;
  *
- * public class EchoClientClassHeaderEndpoint {
+ * public class EchoClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     echoClientClassHeaderEndpoint();
+ *     echoClientSetEndpoint();
  *   }
  *
- *   public static void echoClientClassHeaderEndpoint() throws Exception {
+ *   public static void echoClientSetEndpoint() throws Exception {
  *     EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     EchoClient echoClient = EchoClient.create(echoSettings);
  *   }
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 f5475d161e..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
@@ -83,13 +83,13 @@ import javax.annotation.Generated;
  * import com.google.showcase.v1beta1.IdentitySettings;
  * import com.google.showcase.v1beta1.myCredentials;
  *
- * public class IdentityClientCreate {
+ * public class IdentityClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     identityClientCreate();
+ *     identityClientSetCredentialsProvider();
  *   }
  *
- *   public static void identityClientCreate() throws Exception {
+ *   public static void identityClientSetCredentialsProvider() throws Exception {
  *     IdentitySettings identitySettings =
  *         IdentitySettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -108,13 +108,13 @@ import javax.annotation.Generated;
  * import com.google.showcase.v1beta1.IdentitySettings;
  * import com.google.showcase.v1beta1.myEndpoint;
  *
- * public class IdentityClientClassHeaderEndpoint {
+ * public class IdentityClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     identityClientClassHeaderEndpoint();
+ *     identityClientSetEndpoint();
  *   }
  *
- *   public static void identityClientClassHeaderEndpoint() throws Exception {
+ *   public static void identityClientSetEndpoint() throws Exception {
  *     IdentitySettings identitySettings =
  *         IdentitySettings.newBuilder().setEndpoint(myEndpoint).build();
  *     IdentityClient identityClient = IdentityClient.create(identitySettings);
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 1d77e7a1ed..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
@@ -89,13 +89,13 @@ import javax.annotation.Generated;
  * import com.google.showcase.v1beta1.MessagingSettings;
  * import com.google.showcase.v1beta1.myCredentials;
  *
- * public class MessagingClientCreate {
+ * public class MessagingClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     messagingClientCreate();
+ *     messagingClientSetCredentialsProvider();
  *   }
  *
- *   public static void messagingClientCreate() throws Exception {
+ *   public static void messagingClientSetCredentialsProvider() throws Exception {
  *     MessagingSettings messagingSettings =
  *         MessagingSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -114,13 +114,13 @@ import javax.annotation.Generated;
  * import com.google.showcase.v1beta1.MessagingSettings;
  * import com.google.showcase.v1beta1.myEndpoint;
  *
- * public class MessagingClientClassHeaderEndpoint {
+ * public class MessagingClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     messagingClientClassHeaderEndpoint();
+ *     messagingClientSetEndpoint();
  *   }
  *
- *   public static void messagingClientClassHeaderEndpoint() throws Exception {
+ *   public static void messagingClientSetEndpoint() throws Exception {
  *     MessagingSettings messagingSettings =
  *         MessagingSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     MessagingClient messagingClient = MessagingClient.create(messagingSettings);
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 ea9a25e5a2..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
@@ -366,13 +366,13 @@ public void composeClassHeaderCredentialsSampleCode() {
             "import com.google.showcase.v1beta1.EchoSettings;\n",
             "import com.google.showcase.v1beta1.myCredentials;\n",
             "\n",
-            "public class EchoClientCreate {\n",
+            "public class EchoClientSetCredentialsProvider {\n",
             "\n",
             "  public static void main(String[] args) throws Exception {\n",
-            "    echoClientCreate();\n",
+            "    echoClientSetCredentialsProvider();\n",
             "  }\n",
             "\n",
-            "  public static void echoClientCreate() throws Exception {\n",
+            "  public static void echoClientSetCredentialsProvider() throws Exception {\n",
             "    EchoSettings echoSettings =\n",
             "        EchoSettings.newBuilder()\n",
             "            .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))\n",
@@ -409,13 +409,13 @@ public void composeClassHeaderEndpointSampleCode() {
             "import com.google.showcase.v1beta1.EchoSettings;\n",
             "import com.google.showcase.v1beta1.myEndpoint;\n",
             "\n",
-            "public class EchoClientClassHeaderEndpoint {\n",
+            "public class EchoClientSetEndpoint {\n",
             "\n",
             "  public static void main(String[] args) throws Exception {\n",
-            "    echoClientClassHeaderEndpoint();\n",
+            "    echoClientSetEndpoint();\n",
             "  }\n",
             "\n",
-            "  public static void echoClientClassHeaderEndpoint() throws Exception {\n",
+            "  public static void echoClientSetEndpoint() throws Exception {\n",
             "    EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();\n",
             "    EchoClient echoClient = EchoClient.create(echoSettings);\n",
             "  }\n",
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 1e94ffff8b..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
@@ -115,13 +115,13 @@
  * import com.google.cloud.asset.v1.AssetServiceSettings;
  * import com.google.cloud.asset.v1.myCredentials;
  *
- * public class AssetServiceClientCreate {
+ * public class AssetServiceClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     assetServiceClientCreate();
+ *     assetServiceClientSetCredentialsProvider();
  *   }
  *
- *   public static void assetServiceClientCreate() throws Exception {
+ *   public static void assetServiceClientSetCredentialsProvider() throws Exception {
  *     AssetServiceSettings assetServiceSettings =
  *         AssetServiceSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -140,13 +140,13 @@
  * import com.google.cloud.asset.v1.AssetServiceSettings;
  * import com.google.cloud.asset.v1.myEndpoint;
  *
- * public class AssetServiceClientClassHeaderEndpoint {
+ * public class AssetServiceClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     assetServiceClientClassHeaderEndpoint();
+ *     assetServiceClientSetEndpoint();
  *   }
  *
- *   public static void assetServiceClientClassHeaderEndpoint() throws Exception {
+ *   public static void assetServiceClientSetEndpoint() throws Exception {
  *     AssetServiceSettings assetServiceSettings =
  *         AssetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
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 10f2bc35b7..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
@@ -106,13 +106,13 @@
  * import com.google.cloud.compute.v1.AddressesSettings;
  * import com.google.cloud.compute.v1.myCredentials;
  *
- * public class AddressesClientCreate {
+ * public class AddressesClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     addressesClientCreate();
+ *     addressesClientSetCredentialsProvider();
  *   }
  *
- *   public static void addressesClientCreate() throws Exception {
+ *   public static void addressesClientSetCredentialsProvider() throws Exception {
  *     AddressesSettings addressesSettings =
  *         AddressesSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -131,13 +131,13 @@
  * import com.google.cloud.compute.v1.AddressesSettings;
  * import com.google.cloud.compute.v1.myEndpoint;
  *
- * public class AddressesClientClassHeaderEndpoint {
+ * public class AddressesClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     addressesClientClassHeaderEndpoint();
+ *     addressesClientSetEndpoint();
  *   }
  *
- *   public static void addressesClientClassHeaderEndpoint() throws Exception {
+ *   public static void addressesClientSetEndpoint() throws Exception {
  *     AddressesSettings addressesSettings =
  *         AddressesSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     AddressesClient addressesClient = AddressesClient.create(addressesSettings);
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 eb354d8a7b..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
@@ -92,13 +92,13 @@
  * import com.google.cloud.compute.v1.RegionOperationsSettings;
  * import com.google.cloud.compute.v1.myCredentials;
  *
- * public class RegionOperationsClientCreate {
+ * public class RegionOperationsClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     regionOperationsClientCreate();
+ *     regionOperationsClientSetCredentialsProvider();
  *   }
  *
- *   public static void regionOperationsClientCreate() throws Exception {
+ *   public static void regionOperationsClientSetCredentialsProvider() throws Exception {
  *     RegionOperationsSettings regionOperationsSettings =
  *         RegionOperationsSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -118,13 +118,13 @@
  * import com.google.cloud.compute.v1.RegionOperationsSettings;
  * import com.google.cloud.compute.v1.myEndpoint;
  *
- * public class RegionOperationsClientClassHeaderEndpoint {
+ * public class RegionOperationsClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     regionOperationsClientClassHeaderEndpoint();
+ *     regionOperationsClientSetEndpoint();
  *   }
  *
- *   public static void regionOperationsClientClassHeaderEndpoint() throws Exception {
+ *   public static void regionOperationsClientSetEndpoint() throws Exception {
  *     RegionOperationsSettings regionOperationsSettings =
  *         RegionOperationsSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     RegionOperationsClient regionOperationsClient =
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 057216d482..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
@@ -107,13 +107,13 @@
  * import com.google.cloud.iam.credentials.v1.IamCredentialsSettings;
  * import com.google.cloud.iam.credentials.v1.myCredentials;
  *
- * public class IamCredentialsClientCreate {
+ * public class IamCredentialsClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     iamCredentialsClientCreate();
+ *     iamCredentialsClientSetCredentialsProvider();
  *   }
  *
- *   public static void iamCredentialsClientCreate() throws Exception {
+ *   public static void iamCredentialsClientSetCredentialsProvider() throws Exception {
  *     IamCredentialsSettings iamCredentialsSettings =
  *         IamCredentialsSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -132,13 +132,13 @@
  * import com.google.cloud.iam.credentials.v1.IamCredentialsSettings;
  * import com.google.cloud.iam.credentials.v1.myEndpoint;
  *
- * public class IamCredentialsClientClassHeaderEndpoint {
+ * public class IamCredentialsClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     iamCredentialsClientClassHeaderEndpoint();
+ *     iamCredentialsClientSetEndpoint();
  *   }
  *
- *   public static void iamCredentialsClientClassHeaderEndpoint() throws Exception {
+ *   public static void iamCredentialsClientSetEndpoint() throws Exception {
  *     IamCredentialsSettings iamCredentialsSettings =
  *         IamCredentialsSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create(iamCredentialsSettings);
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 0a71f98eb6..6d50cfe172 100644
--- a/test/integration/goldens/iam/com/google/iam/v1/IAMPolicyClient.java
+++ b/test/integration/goldens/iam/com/google/iam/v1/IAMPolicyClient.java
@@ -115,13 +115,13 @@
  * import com.google.iam.v1.IAMPolicySettings;
  * import com.google.iam.v1.myCredentials;
  *
- * public class IAMPolicyClientCreate {
+ * public class IAMPolicyClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     iAMPolicyClientCreate();
+ *     iAMPolicyClientSetCredentialsProvider();
  *   }
  *
- *   public static void iAMPolicyClientCreate() throws Exception {
+ *   public static void iAMPolicyClientSetCredentialsProvider() throws Exception {
  *     IAMPolicySettings iAMPolicySettings =
  *         IAMPolicySettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -140,13 +140,13 @@
  * import com.google.iam.v1.IAMPolicySettings;
  * import com.google.iam.v1.myEndpoint;
  *
- * public class IAMPolicyClientClassHeaderEndpoint {
+ * public class IAMPolicyClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     iAMPolicyClientClassHeaderEndpoint();
+ *     iAMPolicyClientSetEndpoint();
  *   }
  *
- *   public static void iAMPolicyClientClassHeaderEndpoint() throws Exception {
+ *   public static void iAMPolicyClientSetEndpoint() throws Exception {
  *     IAMPolicySettings iAMPolicySettings =
  *         IAMPolicySettings.newBuilder().setEndpoint(myEndpoint).build();
  *     IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create(iAMPolicySettings);
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 2f974c045f..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
@@ -124,13 +124,13 @@
  * import com.google.cloud.kms.v1.KeyManagementServiceSettings;
  * import com.google.cloud.kms.v1.myCredentials;
  *
- * public class KeyManagementServiceClientCreate {
+ * public class KeyManagementServiceClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     keyManagementServiceClientCreate();
+ *     keyManagementServiceClientSetCredentialsProvider();
  *   }
  *
- *   public static void keyManagementServiceClientCreate() throws Exception {
+ *   public static void keyManagementServiceClientSetCredentialsProvider() throws Exception {
  *     KeyManagementServiceSettings keyManagementServiceSettings =
  *         KeyManagementServiceSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -150,13 +150,13 @@
  * import com.google.cloud.kms.v1.KeyManagementServiceSettings;
  * import com.google.cloud.kms.v1.myEndpoint;
  *
- * public class KeyManagementServiceClientClassHeaderEndpoint {
+ * public class KeyManagementServiceClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     keyManagementServiceClientClassHeaderEndpoint();
+ *     keyManagementServiceClientSetEndpoint();
  *   }
  *
- *   public static void keyManagementServiceClientClassHeaderEndpoint() throws Exception {
+ *   public static void keyManagementServiceClientSetEndpoint() throws Exception {
  *     KeyManagementServiceSettings keyManagementServiceSettings =
  *         KeyManagementServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     KeyManagementServiceClient keyManagementServiceClient =
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 5d149d9582..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
@@ -123,13 +123,13 @@
  * import com.google.cloud.example.library.v1.LibraryServiceSettings;
  * import com.google.cloud.example.library.v1.myCredentials;
  *
- * public class LibraryServiceClientCreate {
+ * public class LibraryServiceClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     libraryServiceClientCreate();
+ *     libraryServiceClientSetCredentialsProvider();
  *   }
  *
- *   public static void libraryServiceClientCreate() throws Exception {
+ *   public static void libraryServiceClientSetCredentialsProvider() throws Exception {
  *     LibraryServiceSettings libraryServiceSettings =
  *         LibraryServiceSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -148,13 +148,13 @@
  * import com.google.cloud.example.library.v1.LibraryServiceSettings;
  * import com.google.cloud.example.library.v1.myEndpoint;
  *
- * public class LibraryServiceClientClassHeaderEndpoint {
+ * public class LibraryServiceClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     libraryServiceClientClassHeaderEndpoint();
+ *     libraryServiceClientSetEndpoint();
  *   }
  *
- *   public static void libraryServiceClientClassHeaderEndpoint() throws Exception {
+ *   public static void libraryServiceClientSetEndpoint() throws Exception {
  *     LibraryServiceSettings libraryServiceSettings =
  *         LibraryServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     LibraryServiceClient libraryServiceClient = LibraryServiceClient.create(libraryServiceSettings);
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 4c704b7c64..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
@@ -148,13 +148,13 @@
  * import com.google.cloud.logging.v2.ConfigSettings;
  * import com.google.cloud.logging.v2.myCredentials;
  *
- * public class ConfigClientCreate {
+ * public class ConfigClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     configClientCreate();
+ *     configClientSetCredentialsProvider();
  *   }
  *
- *   public static void configClientCreate() throws Exception {
+ *   public static void configClientSetCredentialsProvider() throws Exception {
  *     ConfigSettings configSettings =
  *         ConfigSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -173,13 +173,13 @@
  * import com.google.cloud.logging.v2.ConfigSettings;
  * import com.google.cloud.logging.v2.myEndpoint;
  *
- * public class ConfigClientClassHeaderEndpoint {
+ * public class ConfigClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     configClientClassHeaderEndpoint();
+ *     configClientSetEndpoint();
  *   }
  *
- *   public static void configClientClassHeaderEndpoint() throws Exception {
+ *   public static void configClientSetEndpoint() throws Exception {
  *     ConfigSettings configSettings = ConfigSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     ConfigClient configClient = ConfigClient.create(configSettings);
  *   }
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 f0e8c9c9a2..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
@@ -120,13 +120,13 @@
  * import com.google.cloud.logging.v2.LoggingSettings;
  * import com.google.cloud.logging.v2.myCredentials;
  *
- * public class LoggingClientCreate {
+ * public class LoggingClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     loggingClientCreate();
+ *     loggingClientSetCredentialsProvider();
  *   }
  *
- *   public static void loggingClientCreate() throws Exception {
+ *   public static void loggingClientSetCredentialsProvider() throws Exception {
  *     LoggingSettings loggingSettings =
  *         LoggingSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -145,13 +145,13 @@
  * import com.google.cloud.logging.v2.LoggingSettings;
  * import com.google.cloud.logging.v2.myEndpoint;
  *
- * public class LoggingClientClassHeaderEndpoint {
+ * public class LoggingClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     loggingClientClassHeaderEndpoint();
+ *     loggingClientSetEndpoint();
  *   }
  *
- *   public static void loggingClientClassHeaderEndpoint() throws Exception {
+ *   public static void loggingClientSetEndpoint() throws Exception {
  *     LoggingSettings loggingSettings = LoggingSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     LoggingClient loggingClient = LoggingClient.create(loggingSettings);
  *   }
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 4bcec74020..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
@@ -108,13 +108,13 @@
  * import com.google.cloud.logging.v2.MetricsSettings;
  * import com.google.cloud.logging.v2.myCredentials;
  *
- * public class MetricsClientCreate {
+ * public class MetricsClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     metricsClientCreate();
+ *     metricsClientSetCredentialsProvider();
  *   }
  *
- *   public static void metricsClientCreate() throws Exception {
+ *   public static void metricsClientSetCredentialsProvider() throws Exception {
  *     MetricsSettings metricsSettings =
  *         MetricsSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -133,13 +133,13 @@
  * import com.google.cloud.logging.v2.MetricsSettings;
  * import com.google.cloud.logging.v2.myEndpoint;
  *
- * public class MetricsClientClassHeaderEndpoint {
+ * public class MetricsClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     metricsClientClassHeaderEndpoint();
+ *     metricsClientSetEndpoint();
  *   }
  *
- *   public static void metricsClientClassHeaderEndpoint() throws Exception {
+ *   public static void metricsClientSetEndpoint() throws Exception {
  *     MetricsSettings metricsSettings = MetricsSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     MetricsClient metricsClient = MetricsClient.create(metricsSettings);
  *   }
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 b85b76fe95..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
@@ -118,13 +118,13 @@
  * import com.google.cloud.pubsub.v1.SchemaServiceSettings;
  * import com.google.cloud.pubsub.v1.myCredentials;
  *
- * public class SchemaServiceClientCreate {
+ * public class SchemaServiceClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     schemaServiceClientCreate();
+ *     schemaServiceClientSetCredentialsProvider();
  *   }
  *
- *   public static void schemaServiceClientCreate() throws Exception {
+ *   public static void schemaServiceClientSetCredentialsProvider() throws Exception {
  *     SchemaServiceSettings schemaServiceSettings =
  *         SchemaServiceSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -143,13 +143,13 @@
  * import com.google.cloud.pubsub.v1.SchemaServiceSettings;
  * import com.google.cloud.pubsub.v1.myEndpoint;
  *
- * public class SchemaServiceClientClassHeaderEndpoint {
+ * public class SchemaServiceClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     schemaServiceClientClassHeaderEndpoint();
+ *     schemaServiceClientSetEndpoint();
  *   }
  *
- *   public static void schemaServiceClientClassHeaderEndpoint() throws Exception {
+ *   public static void schemaServiceClientSetEndpoint() throws Exception {
  *     SchemaServiceSettings schemaServiceSettings =
  *         SchemaServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings);
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 e46af4fc5c..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
@@ -141,13 +141,13 @@
  * import com.google.cloud.pubsub.v1.SubscriptionAdminSettings;
  * import com.google.cloud.pubsub.v1.myCredentials;
  *
- * public class SubscriptionAdminClientCreate {
+ * public class SubscriptionAdminClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     subscriptionAdminClientCreate();
+ *     subscriptionAdminClientSetCredentialsProvider();
  *   }
  *
- *   public static void subscriptionAdminClientCreate() throws Exception {
+ *   public static void subscriptionAdminClientSetCredentialsProvider() throws Exception {
  *     SubscriptionAdminSettings subscriptionAdminSettings =
  *         SubscriptionAdminSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -167,13 +167,13 @@
  * import com.google.cloud.pubsub.v1.SubscriptionAdminSettings;
  * import com.google.cloud.pubsub.v1.myEndpoint;
  *
- * public class SubscriptionAdminClientClassHeaderEndpoint {
+ * public class SubscriptionAdminClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     subscriptionAdminClientClassHeaderEndpoint();
+ *     subscriptionAdminClientSetEndpoint();
  *   }
  *
- *   public static void subscriptionAdminClientClassHeaderEndpoint() throws Exception {
+ *   public static void subscriptionAdminClientSetEndpoint() throws Exception {
  *     SubscriptionAdminSettings subscriptionAdminSettings =
  *         SubscriptionAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     SubscriptionAdminClient subscriptionAdminClient =
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 60c11bc77f..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
@@ -122,13 +122,13 @@
  * import com.google.cloud.pubsub.v1.TopicAdminSettings;
  * import com.google.cloud.pubsub.v1.myCredentials;
  *
- * public class TopicAdminClientCreate {
+ * public class TopicAdminClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     topicAdminClientCreate();
+ *     topicAdminClientSetCredentialsProvider();
  *   }
  *
- *   public static void topicAdminClientCreate() throws Exception {
+ *   public static void topicAdminClientSetCredentialsProvider() throws Exception {
  *     TopicAdminSettings topicAdminSettings =
  *         TopicAdminSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -147,13 +147,13 @@
  * import com.google.cloud.pubsub.v1.TopicAdminSettings;
  * import com.google.cloud.pubsub.v1.myEndpoint;
  *
- * public class TopicAdminClientClassHeaderEndpoint {
+ * public class TopicAdminClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     topicAdminClientClassHeaderEndpoint();
+ *     topicAdminClientSetEndpoint();
  *   }
  *
- *   public static void topicAdminClientClassHeaderEndpoint() throws Exception {
+ *   public static void topicAdminClientSetEndpoint() throws Exception {
  *     TopicAdminSettings topicAdminSettings =
  *         TopicAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
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 1c9eaa4d77..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
@@ -124,13 +124,13 @@
  * import com.google.cloud.redis.v1beta1.CloudRedisSettings;
  * import com.google.cloud.redis.v1beta1.myCredentials;
  *
- * public class CloudRedisClientCreate {
+ * public class CloudRedisClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     cloudRedisClientCreate();
+ *     cloudRedisClientSetCredentialsProvider();
  *   }
  *
- *   public static void cloudRedisClientCreate() throws Exception {
+ *   public static void cloudRedisClientSetCredentialsProvider() throws Exception {
  *     CloudRedisSettings cloudRedisSettings =
  *         CloudRedisSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -149,13 +149,13 @@
  * import com.google.cloud.redis.v1beta1.CloudRedisSettings;
  * import com.google.cloud.redis.v1beta1.myEndpoint;
  *
- * public class CloudRedisClientClassHeaderEndpoint {
+ * public class CloudRedisClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     cloudRedisClientClassHeaderEndpoint();
+ *     cloudRedisClientSetEndpoint();
  *   }
  *
- *   public static void cloudRedisClientClassHeaderEndpoint() throws Exception {
+ *   public static void cloudRedisClientSetEndpoint() throws Exception {
  *     CloudRedisSettings cloudRedisSettings =
  *         CloudRedisSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
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 97e3d34908..de8498f80b 100644
--- a/test/integration/goldens/storage/com/google/storage/v2/StorageClient.java
+++ b/test/integration/goldens/storage/com/google/storage/v2/StorageClient.java
@@ -100,13 +100,13 @@
  * import com.google.storage.v2.StorageSettings;
  * import com.google.storage.v2.myCredentials;
  *
- * public class StorageClientCreate {
+ * public class StorageClientSetCredentialsProvider {
  *
  *   public static void main(String[] args) throws Exception {
- *     storageClientCreate();
+ *     storageClientSetCredentialsProvider();
  *   }
  *
- *   public static void storageClientCreate() throws Exception {
+ *   public static void storageClientSetCredentialsProvider() throws Exception {
  *     StorageSettings storageSettings =
  *         StorageSettings.newBuilder()
  *             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -125,13 +125,13 @@
  * import com.google.storage.v2.StorageSettings;
  * import com.google.storage.v2.myEndpoint;
  *
- * public class StorageClientClassHeaderEndpoint {
+ * public class StorageClientSetEndpoint {
  *
  *   public static void main(String[] args) throws Exception {
- *     storageClientClassHeaderEndpoint();
+ *     storageClientSetEndpoint();
  *   }
  *
- *   public static void storageClientClassHeaderEndpoint() throws Exception {
+ *   public static void storageClientSetEndpoint() throws Exception {
  *     StorageSettings storageSettings = StorageSettings.newBuilder().setEndpoint(myEndpoint).build();
  *     StorageClient storageClient = StorageClient.create(storageSettings);
  *   }

From e8e73127d0e6d86f81be1b60613382e2f21f2275 Mon Sep 17 00:00:00 2001
From: Emily Ball 
Date: Wed, 1 Dec 2021 17:04:13 -0800
Subject: [PATCH 10/13] formatting

---
 .../composer/samplecode/ServiceClientSampleCodeComposer.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 19f93da5ed..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
@@ -167,7 +167,9 @@ public static ExecutableSample composeClassHeaderCredentialsSampleCode(
             ExprStatement.withExpr(initSettingsVarExpr), ExprStatement.withExpr(initClientVarExpr));
 
     return new ExecutableSample(
-        composeSampleMethodName(clientName, "setCredentialsProvider"), new ArrayList<>(), sampleBody);
+        composeSampleMethodName(clientName, "setCredentialsProvider"),
+        new ArrayList<>(),
+        sampleBody);
   }
 
   public static ExecutableSample composeClassHeaderEndpointSampleCode(

From 15782a660eb9391352dea9bff05bd974c1f4af0d Mon Sep 17 00:00:00 2001
From: Emily Ball 
Date: Thu, 2 Dec 2021 08:54:38 -0800
Subject: [PATCH 11/13] cleanup

---
 .../samplecode/ExecutableSampleComposer.java  | 26 +++++++------------
 1 file changed, 10 insertions(+), 16 deletions(-)

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
index bd2455f283..14e5571223 100644
--- 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
@@ -24,29 +24,23 @@
 import java.util.stream.Collectors;
 
 public class ExecutableSampleComposer {
-  public static String createExecutableSample(ExecutableSample executableSample) {
-    return SampleCodeWriter.write(
-        composeExecutableSample(
-            executableSample.getSampleName(),
-            executableSample.getSampleVariableAssignments(),
-            executableSample.getSampleBody()));
-  }
-
   public static Optional createExecutableSample(
       Optional executableSample) {
     if (executableSample.isPresent()) {
-      ExecutableSample sample = executableSample.get();
-      String sampleMethodName = JavaStyle.toLowerCamelCase(sample.getSampleName());
-      return Optional.of(
-          SampleCodeWriter.write(
-              composeExecutableSample(
-                  sampleMethodName,
-                  sample.getSampleVariableAssignments(),
-                  sample.getSampleBody())));
+      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()));
+  }
+
   static ClassDefinition composeExecutableSample(
       String sampleMethodName,
       List sampleVariableAssignments,

From fb15ad1aa4317ad3e914cfd5f1b45c7cd0ea18ff Mon Sep 17 00:00:00 2001
From: Emily Ball 
Date: Tue, 14 Dec 2021 14:35:28 -0800
Subject: [PATCH 12/13] small fixes

---
 .../samplecode/ExecutableSampleComposer.java  | 26 +++++++++++++------
 .../gapic/composer/samplecode/SampleUtil.java | 17 ++++++++----
 .../ExecutableSampleComposerTest.java         |  9 ++++++-
 3 files changed, 38 insertions(+), 14 deletions(-)

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
index 14e5571223..58bcd29110 100644
--- 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
@@ -14,7 +14,17 @@
 
 package com.google.api.generator.gapic.composer.samplecode;
 
-import com.google.api.generator.engine.ast.*;
+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;
@@ -41,7 +51,7 @@ public static String createExecutableSample(ExecutableSample executableSample) {
             executableSample.getSampleBody()));
   }
 
-  static ClassDefinition composeExecutableSample(
+  private static ClassDefinition composeExecutableSample(
       String sampleMethodName,
       List sampleVariableAssignments,
       List sampleBody) {
@@ -57,14 +67,14 @@ static ClassDefinition composeExecutableSample(
     return composeSampleClass(sampleClassName, mainMethod, sampleMethod);
   }
 
-  static List composeSampleMethodArgs(
+  private static List composeSampleMethodArgs(
       List sampleVariableAssignments) {
     return sampleVariableAssignments.stream()
         .map(v -> v.variableExpr().toBuilder().setIsDecl(true).build())
         .collect(Collectors.toList());
   }
 
-  static Statement composeInvokeMethodStatement(
+  private static Statement composeInvokeMethodStatement(
       String sampleMethodName, List sampleMethodArgs) {
     List invokeArgs =
         sampleMethodArgs.stream()
@@ -77,7 +87,7 @@ static Statement composeInvokeMethodStatement(
             .build());
   }
 
-  static List composeMainBody(
+  private static List composeMainBody(
       List sampleVariableAssignments, Statement invokeMethod) {
     List setVariables =
         sampleVariableAssignments.stream()
@@ -88,7 +98,7 @@ static List composeMainBody(
     return body;
   }
 
-  static ClassDefinition composeSampleClass(
+  private static ClassDefinition composeSampleClass(
       String sampleClassName, MethodDefinition mainMethod, MethodDefinition sampleMethod) {
     return ClassDefinition.builder()
         .setScope(ScopeNode.PUBLIC)
@@ -98,7 +108,7 @@ static ClassDefinition composeSampleClass(
         .build();
   }
 
-  static MethodDefinition composeMainMethod(List mainBody) {
+  private static MethodDefinition composeMainMethod(List mainBody) {
     return MethodDefinition.builder()
         .setScope(ScopeNode.PUBLIC)
         .setIsStatic(true)
@@ -115,7 +125,7 @@ static MethodDefinition composeMainMethod(List mainBody) {
         .build();
   }
 
-  static MethodDefinition composeSampleMethod(
+  private static MethodDefinition composeSampleMethod(
       String sampleMethodName,
       List sampleMethodArgs,
       List sampleMethodBody) {
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
index 41520574c5..664e886cf3 100644
--- 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
@@ -14,14 +14,21 @@
 
 package com.google.api.generator.gapic.composer.samplecode;
 
-import com.google.api.generator.engine.ast.*;
+import com.google.api.client.util.Preconditions;
+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;
 
 public class SampleUtil {
   public static String composeSampleMethodName(String clientName, String methodName) {
-    if (clientName.equals("") || methodName.equals("")) {
-      throw new IllegalArgumentException("clientName and methodName must exist");
-    }
+    Preconditions.checkArgument(
+        !clientName.isEmpty() && !methodName.isEmpty(),
+        "clientName and methodName must not be empty");
     return JavaStyle.toLowerCamelCase(clientName + JavaStyle.toUpperCamelCase(methodName));
   }
 
@@ -33,7 +40,7 @@ public static MethodInvocationExpr systemOutPrint(VariableExpr variableExpr) {
     return composeSystemOutPrint(variableExpr.toBuilder().setIsDecl(false).build());
   }
 
-  static MethodInvocationExpr composeSystemOutPrint(Expr content) {
+  private static MethodInvocationExpr composeSystemOutPrint(Expr content) {
     VaporReference out =
         VaporReference.builder()
             .setEnclosingClassNames("System")
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
index 7fcccde74b..653842b147 100644
--- 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
@@ -16,7 +16,14 @@
 
 import static org.junit.Assert.assertEquals;
 
-import com.google.api.generator.engine.ast.*;
+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;

From 8a7927ccb5a9db570ae4635fde1655318f3c9192 Mon Sep 17 00:00:00 2001
From: Emily Ball 
Date: Tue, 14 Dec 2021 14:47:41 -0800
Subject: [PATCH 13/13] fix import

---
 .../api/generator/gapic/composer/samplecode/SampleUtil.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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
index 664e886cf3..e33af9dd4b 100644
--- 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
@@ -14,7 +14,6 @@
 
 package com.google.api.generator.gapic.composer.samplecode;
 
-import com.google.api.client.util.Preconditions;
 import com.google.api.generator.engine.ast.Expr;
 import com.google.api.generator.engine.ast.MethodInvocationExpr;
 import com.google.api.generator.engine.ast.StringObjectValue;
@@ -23,6 +22,7 @@
 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) {