diff --git a/src/main/java/com/google/api/generator/engine/ast/TypeNode.java b/src/main/java/com/google/api/generator/engine/ast/TypeNode.java index 50bcc62657..31cd5141c8 100644 --- a/src/main/java/com/google/api/generator/engine/ast/TypeNode.java +++ b/src/main/java/com/google/api/generator/engine/ast/TypeNode.java @@ -203,6 +203,11 @@ public boolean isProtoPrimitiveType() { return isPrimitiveType() || equals(TypeNode.STRING) || equals(TypeNode.BYTESTRING); } + public boolean isProtoEmptyType() { + return reference().pakkage().equals("com.google.protobuf") + && reference().name().equals("Empty"); + } + public boolean isSupertypeOrEquals(TypeNode other) { boolean oneTypeIsNull = equals(TypeNode.NULL) ^ other.equals(TypeNode.NULL); return !isPrimitiveType() diff --git a/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java b/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java index d1ef68f34c..0a867b7cdb 100644 --- a/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java +++ b/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java @@ -998,7 +998,7 @@ public void visit(ClassDefinition classDefinition) { // fixing region tag after formatting // formatter splits long region tags on multiple lines and moves the end tag up - doesn't meet - // tag requirements + // tag requirements. See https://github.com/google/google-java-format/issues/137 if (classDefinition.regionTag() != null) { formattedClazz = formattedClazz.replaceAll(regionTagReplace, classDefinition.regionTag().generate()); diff --git a/src/main/java/com/google/api/generator/gapic/composer/ClientLibraryPackageInfoComposer.java b/src/main/java/com/google/api/generator/gapic/composer/ClientLibraryPackageInfoComposer.java index 302b6a8eca..d268a60299 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/ClientLibraryPackageInfoComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/ClientLibraryPackageInfoComposer.java @@ -21,10 +21,12 @@ import com.google.api.generator.engine.ast.PackageInfoDefinition; import com.google.api.generator.engine.ast.TypeNode; import com.google.api.generator.engine.ast.VaporReference; +import com.google.api.generator.gapic.composer.samplecode.SampleCodeWriter; import com.google.api.generator.gapic.composer.samplecode.ServiceClientHeaderSampleComposer; import com.google.api.generator.gapic.composer.utils.ClassNames; import com.google.api.generator.gapic.model.GapicContext; import com.google.api.generator.gapic.model.GapicPackageInfo; +import com.google.api.generator.gapic.model.Sample; import com.google.api.generator.gapic.model.Service; import com.google.common.base.Preconditions; import com.google.common.base.Strings; @@ -119,10 +121,11 @@ private static CommentStatement createPackageInfoJavadoc(GapicContext context) { .setPakkage(service.pakkage()) .setName(ClassNames.getServiceClientClassName(service)) .build()); - String packageInfoSampleCode = - ServiceClientHeaderSampleComposer.composeClassHeaderMethodSampleCode( + Sample packageInfoSampleCode = + ServiceClientHeaderSampleComposer.composeClassHeaderSample( service, clientType, context.resourceNames(), context.messages()); - javaDocCommentBuilder.addSampleCode(packageInfoSampleCode); + javaDocCommentBuilder.addSampleCode( + SampleCodeWriter.writeInlineSample(packageInfoSampleCode.body())); } return CommentStatement.withComment(javaDocCommentBuilder.build()); 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 4aaa36a7ad..8bdfa60ab4 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,7 +55,9 @@ 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.ServiceClientCallableSampleComposer; +import com.google.api.generator.gapic.composer.samplecode.SampleCodeWriter; +import com.google.api.generator.gapic.composer.samplecode.SampleComposerUtil; +import com.google.api.generator.gapic.composer.samplecode.ServiceClientCallableMethodSampleComposer; import com.google.api.generator.gapic.composer.samplecode.ServiceClientHeaderSampleComposer; import com.google.api.generator.gapic.composer.samplecode.ServiceClientMethodSampleComposer; import com.google.api.generator.gapic.composer.store.TypeStore; @@ -71,6 +73,7 @@ import com.google.api.generator.gapic.model.Method.Stream; import com.google.api.generator.gapic.model.MethodArgument; import com.google.api.generator.gapic.model.ResourceName; +import com.google.api.generator.gapic.model.Sample; import com.google.api.generator.gapic.model.Service; import com.google.api.generator.gapic.utils.JavaStyle; import com.google.api.generator.util.TriFunction; @@ -136,12 +139,13 @@ public GapicClass generate(GapicContext context, Service service) { String pakkage = service.pakkage(); boolean hasLroClient = service.hasStandardLroMethods(); + List samples = new ArrayList<>(); Map> grpcRpcsToJavaMethodNames = new HashMap<>(); ClassDefinition classDef = ClassDefinition.builder() .setHeaderCommentStatements( - createClassHeaderComments(service, typeStore, resourceNames, messageTypes)) + createClassHeaderComments(service, typeStore, resourceNames, messageTypes, samples)) .setPackageString(pakkage) .setAnnotations(createClassAnnotations(service, typeStore)) .setScope(ScopeNode.PUBLIC) @@ -155,12 +159,13 @@ public GapicClass generate(GapicContext context, Service service) { typeStore, resourceNames, hasLroClient, - grpcRpcsToJavaMethodNames)) + grpcRpcsToJavaMethodNames, + samples)) .setNestedClasses(createNestedPagingClasses(service, messageTypes, typeStore)) .build(); updateGapicMetadata(context, service, className, grpcRpcsToJavaMethodNames); - return GapicClass.create(kind, classDef); + return GapicClass.create(kind, classDef, SampleComposerUtil.handleDuplicateSamples(samples)); } private static List createClassAnnotations(Service service, TypeStore typeStore) { @@ -187,20 +192,23 @@ private static List createClassHeaderComments( Service service, TypeStore typeStore, Map resourceNames, - Map messageTypes) { + Map messageTypes, + List samples) { TypeNode clientType = typeStore.get(ClassNames.getServiceClientClassName(service)); TypeNode settingsType = typeStore.get(ClassNames.getServiceSettingsClassName(service)); - String classMethodSampleCode = - ServiceClientHeaderSampleComposer.composeClassHeaderMethodSampleCode( + Sample classMethodSampleCode = + ServiceClientHeaderSampleComposer.composeClassHeaderSample( service, clientType, resourceNames, messageTypes); - String credentialsSampleCode = - ServiceClientHeaderSampleComposer.composeClassHeaderCredentialsSampleCode( - clientType, settingsType); - String endpointSampleCode = - ServiceClientHeaderSampleComposer.composeClassHeaderEndpointSampleCode( - clientType, settingsType); + Sample credentialsSampleCode = + ServiceClientHeaderSampleComposer.composeSetCredentialsSample(clientType, settingsType); + Sample endpointSampleCode = + ServiceClientHeaderSampleComposer.composeSetEndpointSample(clientType, settingsType); + samples.addAll(Arrays.asList(classMethodSampleCode, credentialsSampleCode, endpointSampleCode)); return ServiceClientCommentComposer.createClassHeaderComments( - service, classMethodSampleCode, credentialsSampleCode, endpointSampleCode); + service, + SampleCodeWriter.writeInlineSample(classMethodSampleCode.body()), + SampleCodeWriter.writeInlineSample(credentialsSampleCode.body()), + SampleCodeWriter.writeInlineSample(endpointSampleCode.body())); } private List createClassMethods( @@ -209,14 +217,15 @@ private List createClassMethods( TypeStore typeStore, Map resourceNames, boolean hasLroClient, - Map> grpcRpcToJavaMethodMetadata) { + Map> grpcRpcToJavaMethodMetadata, + List samples) { List methods = new ArrayList<>(); methods.addAll(createStaticCreatorMethods(service, typeStore)); methods.addAll(createConstructorMethods(service, typeStore, hasLroClient)); methods.addAll(createGetterMethods(service, typeStore, hasLroClient)); methods.addAll( createServiceMethods( - service, messageTypes, typeStore, resourceNames, grpcRpcToJavaMethodMetadata)); + service, messageTypes, typeStore, resourceNames, grpcRpcToJavaMethodMetadata, samples)); methods.addAll(createBackgroundResourceMethods(service, typeStore)); return methods; } @@ -568,7 +577,8 @@ private static List createServiceMethods( Map messageTypes, TypeStore typeStore, Map resourceNames, - Map> grpcRpcToJavaMethodMetadata) { + Map> grpcRpcToJavaMethodMetadata, + List samples) { List javaMethods = new ArrayList<>(); Function javaMethodNameFn = m -> m.methodIdentifier().name(); for (Method method : service.methods()) { @@ -582,7 +592,8 @@ private static List createServiceMethods( ClassNames.getServiceClientClassName(service), messageTypes, typeStore, - resourceNames); + resourceNames, + samples); // Collect data for gapic_metadata.json. grpcRpcToJavaMethodMetadata @@ -599,7 +610,8 @@ private static List createServiceMethods( ClassNames.getServiceClientClassName(service), messageTypes, typeStore, - resourceNames); + resourceNames, + samples); // Collect data for gapic_metadata.json. grpcRpcToJavaMethodMetadata.get(method.name()).add(javaMethodNameFn.apply(generatedMethod)); @@ -607,7 +619,8 @@ private static List createServiceMethods( } if (method.hasLro()) { MethodDefinition generatedMethod = - createLroCallableMethod(service, method, typeStore, messageTypes, resourceNames); + createLroCallableMethod( + service, method, typeStore, messageTypes, resourceNames, samples); // Collect data for gapic_metadata.json. grpcRpcToJavaMethodMetadata.get(method.name()).add(javaMethodNameFn.apply(generatedMethod)); @@ -615,14 +628,15 @@ private static List createServiceMethods( } if (method.isPaged()) { MethodDefinition generatedMethod = - createPagedCallableMethod(service, method, typeStore, messageTypes, resourceNames); + createPagedCallableMethod( + service, method, typeStore, messageTypes, resourceNames, samples); // Collect data for gapic_metadata.json. grpcRpcToJavaMethodMetadata.get(method.name()).add(javaMethodNameFn.apply(generatedMethod)); javaMethods.add(generatedMethod); } MethodDefinition generatedMethod = - createCallableMethod(service, method, typeStore, messageTypes, resourceNames); + createCallableMethod(service, method, typeStore, messageTypes, resourceNames, samples); // Collect data for the gapic_metadata.json file. grpcRpcToJavaMethodMetadata.get(method.name()).add(javaMethodNameFn.apply(generatedMethod)); @@ -636,7 +650,8 @@ private static List createMethodVariants( String clientName, Map messageTypes, TypeStore typeStore, - Map resourceNames) { + Map resourceNames, + List samples) { List javaMethods = new ArrayList<>(); String methodName = JavaStyle.toLowerCamelCase(method.name()); TypeNode methodInputType = method.inputType(); @@ -697,15 +712,22 @@ private static List createMethodVariants( .setReturnType(methodOutputType) .build(); - Optional methodSampleCode = + Optional methodSample = Optional.of( - ServiceClientMethodSampleComposer.composeRpcMethodHeaderSampleCode( + ServiceClientHeaderSampleComposer.composeShowcaseMethodSample( method, typeStore.get(clientName), signature, resourceNames, messageTypes)); + Optional methodDocSample = Optional.empty(); + if (methodSample.isPresent()) { + samples.add(methodSample.get()); + methodDocSample = + Optional.of(SampleCodeWriter.writeInlineSample(methodSample.get().body())); + } + MethodDefinition.Builder methodVariantBuilder = MethodDefinition.builder() .setHeaderCommentStatements( ServiceClientCommentComposer.createRpcMethodHeaderComment( - method, signature, methodSampleCode)) + method, signature, methodDocSample)) .setScope(ScopeNode.PUBLIC) .setIsFinal(true) .setName(String.format(method.hasLro() ? "%sAsync" : "%s", methodName)) @@ -736,7 +758,8 @@ private static MethodDefinition createMethodDefaultMethod( String clientName, Map messageTypes, TypeStore typeStore, - Map resourceNames) { + Map resourceNames, + List samples) { String methodName = JavaStyle.toLowerCamelCase(method.name()); TypeNode methodInputType = method.inputType(); TypeNode methodOutputType = @@ -777,10 +800,16 @@ private static MethodDefinition createMethodDefaultMethod( callableMethodName = String.format(OPERATION_CALLABLE_NAME_PATTERN, methodName); } - Optional defaultMethodSampleCode = + Optional defaultMethodSample = Optional.of( - ServiceClientMethodSampleComposer.composeRpcDefaultMethodHeaderSampleCode( + ServiceClientMethodSampleComposer.composeCanonicalSample( method, typeStore.get(clientName), resourceNames, messageTypes)); + Optional defaultMethodDocSample = Optional.empty(); + if (defaultMethodSample.isPresent()) { + samples.add(defaultMethodSample.get()); + defaultMethodDocSample = + Optional.of(SampleCodeWriter.writeInlineSample(defaultMethodSample.get().body())); + } MethodInvocationExpr callableMethodExpr = MethodInvocationExpr.builder().setMethodName(callableMethodName).build(); @@ -795,7 +824,7 @@ private static MethodDefinition createMethodDefaultMethod( MethodDefinition.builder() .setHeaderCommentStatements( ServiceClientCommentComposer.createRpcMethodHeaderComment( - method, defaultMethodSampleCode)) + method, defaultMethodDocSample)) .setScope(ScopeNode.PUBLIC) .setIsFinal(true) .setName(String.format(method.hasLro() ? "%sAsync" : "%s", methodName)) @@ -825,9 +854,10 @@ private static MethodDefinition createLroCallableMethod( Method method, TypeStore typeStore, Map messageTypes, - Map resourceNames) { + Map resourceNames, + List samples) { return createCallableMethod( - service, method, CallableMethodKind.LRO, typeStore, messageTypes, resourceNames); + service, method, CallableMethodKind.LRO, typeStore, messageTypes, resourceNames, samples); } private static MethodDefinition createCallableMethod( @@ -835,9 +865,16 @@ private static MethodDefinition createCallableMethod( Method method, TypeStore typeStore, Map messageTypes, - Map resourceNames) { + Map resourceNames, + List samples) { return createCallableMethod( - service, method, CallableMethodKind.REGULAR, typeStore, messageTypes, resourceNames); + service, + method, + CallableMethodKind.REGULAR, + typeStore, + messageTypes, + resourceNames, + samples); } private static MethodDefinition createPagedCallableMethod( @@ -845,9 +882,10 @@ private static MethodDefinition createPagedCallableMethod( Method method, TypeStore typeStore, Map messageTypes, - Map resourceNames) { + Map resourceNames, + List samples) { return createCallableMethod( - service, method, CallableMethodKind.PAGED, typeStore, messageTypes, resourceNames); + service, method, CallableMethodKind.PAGED, typeStore, messageTypes, resourceNames, samples); } private static MethodDefinition createCallableMethod( @@ -856,7 +894,8 @@ private static MethodDefinition createCallableMethod( CallableMethodKind callableMethodKind, TypeStore typeStore, Map messageTypes, - Map resourceNames) { + Map resourceNames, + List samples) { TypeNode rawCallableReturnType = null; if (callableMethodKind.equals(CallableMethodKind.LRO)) { rawCallableReturnType = typeStore.get("OperationCallable"); @@ -898,42 +937,47 @@ private static MethodDefinition createCallableMethod( .setReturnType(returnType) .build(); - Optional sampleCodeOpt = Optional.empty(); + Optional sampleCode = Optional.empty(); if (callableMethodKind.equals(CallableMethodKind.LRO)) { - sampleCodeOpt = + sampleCode = Optional.of( - ServiceClientCallableSampleComposer.composeLroCallableMethodHeaderSampleCode( + ServiceClientCallableMethodSampleComposer.composeLroCallableMethod( method, typeStore.get(ClassNames.getServiceClientClassName(service)), resourceNames, messageTypes)); } else if (callableMethodKind.equals(CallableMethodKind.PAGED)) { - sampleCodeOpt = + sampleCode = Optional.of( - ServiceClientCallableSampleComposer.composePagedCallableMethodHeaderSampleCode( + ServiceClientCallableMethodSampleComposer.composePagedCallableMethod( method, typeStore.get(ClassNames.getServiceClientClassName(service)), resourceNames, messageTypes)); } else if (callableMethodKind.equals(CallableMethodKind.REGULAR)) { if (method.stream().equals(Stream.NONE)) { - sampleCodeOpt = + sampleCode = Optional.of( - ServiceClientCallableSampleComposer.composeRegularCallableMethodHeaderSampleCode( + ServiceClientCallableMethodSampleComposer.composeRegularCallableMethod( method, typeStore.get(ClassNames.getServiceClientClassName(service)), resourceNames, messageTypes)); } else { - sampleCodeOpt = + sampleCode = Optional.of( - ServiceClientCallableSampleComposer.composeStreamCallableMethodHeaderSampleCode( + ServiceClientCallableMethodSampleComposer.composeStreamCallableMethod( method, typeStore.get(ClassNames.getServiceClientClassName(service)), resourceNames, messageTypes)); } } + Optional sampleDocCode = Optional.empty(); + if (sampleCode.isPresent()) { + samples.add(sampleCode.get()); + sampleDocCode = Optional.of(SampleCodeWriter.writeInlineSample(sampleCode.get().body())); + } MethodDefinition.Builder methodDefBuilder = MethodDefinition.builder(); if (method.isDeprecated()) { @@ -945,7 +989,7 @@ private static MethodDefinition createCallableMethod( return methodDefBuilder .setHeaderCommentStatements( ServiceClientCommentComposer.createRpcCallableMethodHeaderComment( - method, sampleCodeOpt)) + method, sampleDocCode)) .setScope(ScopeNode.PUBLIC) .setIsFinal(true) .setName(methodName) 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..6bf3d2d57b 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,7 +50,9 @@ 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.SettingsSampleCodeComposer; +import com.google.api.generator.gapic.composer.samplecode.SampleCodeWriter; +import com.google.api.generator.gapic.composer.samplecode.SampleComposerUtil; +import com.google.api.generator.gapic.composer.samplecode.SettingsSampleComposer; import com.google.api.generator.gapic.composer.store.TypeStore; import com.google.api.generator.gapic.composer.utils.ClassNames; import com.google.api.generator.gapic.composer.utils.PackageChecker; @@ -59,6 +61,7 @@ import com.google.api.generator.gapic.model.GapicContext; import com.google.api.generator.gapic.model.Method; import com.google.api.generator.gapic.model.Method.Stream; +import com.google.api.generator.gapic.model.Sample; import com.google.api.generator.gapic.model.Service; import com.google.api.generator.gapic.utils.JavaStyle; import com.google.common.base.Preconditions; @@ -100,12 +103,13 @@ public GapicClass generate(GapicContext context, Service service) { TypeStore typeStore = createDynamicTypes(service); String className = ClassNames.getServiceSettingsClassName(service); GapicClass.Kind kind = Kind.MAIN; - + List samples = new ArrayList<>(); + List classHeaderComments = + createClassHeaderComments(service, typeStore.get(className), samples); ClassDefinition classDef = ClassDefinition.builder() .setPackageString(pakkage) - .setHeaderCommentStatements( - createClassHeaderComments(service, typeStore.get(className))) + .setHeaderCommentStatements(classHeaderComments) .setAnnotations(createClassAnnotations(service)) .setScope(ScopeNode.PUBLIC) .setName(className) @@ -122,11 +126,11 @@ public GapicClass generate(GapicContext context, Service service) { .setMethods(createClassMethods(service, typeStore)) .setNestedClasses(Arrays.asList(createNestedBuilderClass(service, typeStore))) .build(); - return GapicClass.create(kind, classDef); + return GapicClass.create(kind, classDef, SampleComposerUtil.handleDuplicateSamples(samples)); } private static List createClassHeaderComments( - Service service, TypeNode classType) { + Service service, TypeNode classType, List samples) { // Pick the first pure unary rpc method, if no such method exists, then pick the first in the // list. Optional methodOpt = @@ -139,15 +143,22 @@ private static List createClassHeaderComments( .orElse(service.methods().get(0))); Optional methodNameOpt = methodOpt.isPresent() ? Optional.of(methodOpt.get().name()) : Optional.empty(); - Optional sampleCodeOpt = - SettingsSampleCodeComposer.composeSampleCode( + Optional sampleCode = + SettingsSampleComposer.composeSettingsSample( methodNameOpt, ClassNames.getServiceSettingsClassName(service), classType); + + Optional docSampleCode = Optional.empty(); + if (sampleCode.isPresent()) { + samples.add(sampleCode.get()); + docSampleCode = Optional.of(SampleCodeWriter.writeInlineSample(sampleCode.get().body())); + } + return SettingsCommentComposer.createClassHeaderComments( ClassNames.getServiceClientClassName(service), service.defaultHost(), service.isDeprecated(), methodNameOpt, - sampleCodeOpt, + docSampleCode, classType); } 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 0ba5da2e49..a7d78287fa 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,7 +79,9 @@ 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.SettingsSampleCodeComposer; +import com.google.api.generator.gapic.composer.samplecode.SampleCodeWriter; +import com.google.api.generator.gapic.composer.samplecode.SampleComposerUtil; +import com.google.api.generator.gapic.composer.samplecode.SettingsSampleComposer; import com.google.api.generator.gapic.composer.store.TypeStore; import com.google.api.generator.gapic.composer.utils.ClassNames; import com.google.api.generator.gapic.composer.utils.PackageChecker; @@ -91,6 +93,7 @@ import com.google.api.generator.gapic.model.Message; import com.google.api.generator.gapic.model.Method; import com.google.api.generator.gapic.model.Method.Stream; +import com.google.api.generator.gapic.model.Sample; import com.google.api.generator.gapic.model.Service; import com.google.api.generator.gapic.utils.JavaStyle; import com.google.common.base.Preconditions; @@ -168,6 +171,7 @@ public GapicClass generate(GapicContext context, Service service) { String pakkage = String.format("%s.stub", service.pakkage()); TypeStore typeStore = createDynamicTypes(service, pakkage); + List samples = new ArrayList<>(); Set deprecatedSettingVarNames = new HashSet<>(); Map methodSettingsMemberVarExprs = createMethodSettingsClassMemberVarExprs( @@ -177,12 +181,12 @@ public GapicClass generate(GapicContext context, Service service) { /* isNestedClass= */ false, deprecatedSettingVarNames); String className = ClassNames.getServiceStubSettingsClassName(service); - + List classHeaderComments = + createClassHeaderComments(service, typeStore.get(className), samples); ClassDefinition classDef = ClassDefinition.builder() .setPackageString(pakkage) - .setHeaderCommentStatements( - createClassHeaderComments(service, typeStore.get(className))) + .setHeaderCommentStatements(classHeaderComments) .setAnnotations(createClassAnnotations(service)) .setScope(ScopeNode.PUBLIC) .setName(className) @@ -196,7 +200,8 @@ public GapicClass generate(GapicContext context, Service service) { .setNestedClasses( Arrays.asList(createNestedBuilderClass(service, serviceConfig, typeStore))) .build(); - return GapicClass.create(GapicClass.Kind.STUB, classDef); + return GapicClass.create( + GapicClass.Kind.STUB, classDef, SampleComposerUtil.handleDuplicateSamples(samples)); } protected MethodDefinition createDefaultCredentialsProviderBuilderMethod() { @@ -376,7 +381,7 @@ private List createClassAnnotations(Service service) { } private static List createClassHeaderComments( - Service service, TypeNode classType) { + Service service, TypeNode classType, List samples) { // Pick the first pure unary rpc method, if no such method exists, then pick the first in the // list. Optional methodOpt = @@ -389,16 +394,22 @@ private static List createClassHeaderComments( .orElse(service.methods().get(0))); Optional methodNameOpt = methodOpt.isPresent() ? Optional.of(methodOpt.get().name()) : Optional.empty(); - Optional sampleCodeOpt = - SettingsSampleCodeComposer.composeSampleCode( + Optional sampleCode = + SettingsSampleComposer.composeSettingsSample( methodNameOpt, ClassNames.getServiceSettingsClassName(service), classType); + Optional docSampleCode = Optional.empty(); + if (sampleCode.isPresent()) { + samples.add(sampleCode.get()); + docSampleCode = Optional.of(SampleCodeWriter.writeInlineSample(sampleCode.get().body())); + } + return SettingsCommentComposer.createClassHeaderComments( ClassNames.getServiceStubClassName(service), service.defaultHost(), service.isDeprecated(), methodNameOpt, - sampleCodeOpt, + docSampleCode, classType); } diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleBodyJavaFormatter.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleBodyJavaFormatter.java index a5e81bd8b4..9562e88c19 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleBodyJavaFormatter.java +++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleBodyJavaFormatter.java @@ -21,11 +21,9 @@ import java.util.regex.Pattern; public final class SampleBodyJavaFormatter { - private SampleBodyJavaFormatter() {} private static final Formatter FORMATTER = new Formatter(); - private static final String FAKE_CLASS_TITLE = "public class FakeClass { void fakeMethod() {\n"; private static final String FAKE_CLASS_CLOSE = "}}"; 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 2c00debf35..8a12e14a97 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,8 @@ package com.google.api.generator.gapic.composer.samplecode; 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.Statement; import com.google.api.generator.engine.writer.JavaWriterVisitor; import com.google.api.generator.gapic.model.Sample; @@ -32,6 +34,11 @@ public static String writeExecutableSample(Sample sample, String packkage) { return write(SampleComposer.composeExecutableSample(sample, packkage)); } + @VisibleForTesting + public static String write(Statement... statement) { + return write(Arrays.asList(statement)); + } + @VisibleForTesting public static String write(List statements) { JavaWriterVisitor visitor = new JavaWriterVisitor(); @@ -50,7 +57,8 @@ public static String write(ClassDefinition classDefinition) { return visitor.write(); } - public static String write(Statement... statement) { - return write(Arrays.asList(statement)); + @VisibleForTesting + public static String write(Expr expr) { + return write(ExprStatement.withExpr(expr)); } } diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleComposerUtil.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleComposerUtil.java new file mode 100644 index 0000000000..11c6df35a4 --- /dev/null +++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleComposerUtil.java @@ -0,0 +1,113 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.api.generator.gapic.composer.samplecode; + +import com.google.api.generator.engine.ast.AssignmentExpr; +import com.google.api.generator.engine.ast.MethodInvocationExpr; +import com.google.api.generator.engine.ast.TypeNode; +import com.google.api.generator.engine.ast.VariableExpr; +import com.google.api.generator.gapic.model.MethodArgument; +import com.google.api.generator.gapic.model.ResourceName; +import com.google.api.generator.gapic.model.Sample; +import com.google.api.generator.gapic.utils.JavaStyle; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class SampleComposerUtil { + // Assign client variable expr with create client. + // e.g EchoClient echoClient = EchoClient.create() + static AssignmentExpr assignClientVariableWithCreateMethodExpr(VariableExpr clientVarExpr) { + return AssignmentExpr.builder() + .setVariableExpr(clientVarExpr.toBuilder().setIsDecl(true).build()) + .setValueExpr( + MethodInvocationExpr.builder() + .setStaticReferenceType(clientVarExpr.variable().type()) + .setReturnType(clientVarExpr.variable().type()) + .setMethodName("create") + .build()) + .build(); + } + + static boolean isStringTypedResourceName( + MethodArgument arg, Map resourceNames) { + return arg.type().equals(TypeNode.STRING) + && arg.field().hasResourceReference() + && resourceNames.containsKey(arg.field().resourceReference().resourceTypeString()); + } + + static String createOverloadDisambiguation(List methodArgVarExprs) { + if (methodArgVarExprs.isEmpty()) { + return "Noargs"; + } + return methodArgVarExprs.stream() + .map( + arg -> + JavaStyle.toUpperCamelCase( + arg.variable().type().reference() == null + ? arg.variable().type().typeKind().name().toLowerCase() + : arg.variable().type().reference().name().toLowerCase())) + .collect(Collectors.joining()); + } + + public static List handleDuplicateSamples(List samples) { + // grab all distinct samples and group by sample name + // ie: { "echo", ["echo(request"], + // "echoString", ["echo(parent)", "echo(child)", "echo(context)"], + // "echoDelete", ["echo.delete(request)"] } + Map> distinctSamplesGroupedByName = + samples.stream().distinct().collect(Collectors.groupingBy(s -> s.name())); + + // collect samples that don't have duplicates + // ie: ["echo", "echoDelete"] + List uniqueSamples = + distinctSamplesGroupedByName.entrySet().stream() + .filter(entry -> entry.getValue().size() < 2) + .map(entry -> entry.getValue().get(0)) + .collect(Collectors.toList()); + + if (uniqueSamples.size() == distinctSamplesGroupedByName.size()) { + return uniqueSamples; + } + + // collect samples that do have duplicates + // ie: ["echoString"] + List>> duplicateDistinctSamples = + distinctSamplesGroupedByName.entrySet().stream() + .filter(entry -> entry.getValue().size() > 1) + .collect(Collectors.toList()); + + // update similar samples regionTag/name so filesname/regiontag are unique + // ie: ["echo", "echoDelete", "echoString", "echoString1"] + for (Map.Entry> entry : duplicateDistinctSamples) { + int sampleNum = 0; + for (Sample sample : entry.getValue()) { + Sample uniqueSample = sample; + // first sample will be "canonical", not updating name + if (sampleNum != 0) { + uniqueSample = + sample.withRegionTag( + sample + .regionTag() + .withOverloadDisambiguation( + sample.regionTag().overloadDisambiguation() + sampleNum)); + } + uniqueSamples.add(uniqueSample); + sampleNum++; + } + } + return uniqueSamples; + } +} diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableSampleComposer.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableMethodSampleComposer.java similarity index 85% rename from src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableSampleComposer.java rename to src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableMethodSampleComposer.java index a84fb62a56..2f41633be3 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableSampleComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableMethodSampleComposer.java @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -45,8 +45,9 @@ import com.google.api.generator.gapic.model.Field; import com.google.api.generator.gapic.model.Message; import com.google.api.generator.gapic.model.Method; -import com.google.api.generator.gapic.model.Method.Stream; +import com.google.api.generator.gapic.model.RegionTag; import com.google.api.generator.gapic.model.ResourceName; +import com.google.api.generator.gapic.model.Sample; import com.google.api.generator.gapic.utils.JavaStyle; import com.google.common.base.Preconditions; import com.google.common.base.Strings; @@ -57,9 +58,235 @@ import java.util.Map; import java.util.stream.Collectors; -public class ServiceClientCallableSampleComposer { +public class ServiceClientCallableMethodSampleComposer { + private static Sample composeUnaryOrLroCallableSample( + Method method, VariableExpr clientVarExpr, VariableExpr requestVarExpr) { + List bodyStatements = new ArrayList<>(); + // Create api future variable expression, and assign it with a value by invoking callable + // method. + // e.g. ApiFuture future = echoClient.echoCallable().futureCall(request); + TypeNode apiFutureType = + TypeNode.withReference( + ConcreteReference.builder() + .setClazz(ApiFuture.class) + .setGenerics( + method.hasLro() + ? ConcreteReference.withClazz(Operation.class) + : method.outputType().reference()) + .build()); + VariableExpr apiFutureVarExpr = + VariableExpr.withVariable( + Variable.builder().setName("future").setType(apiFutureType).build()); + MethodInvocationExpr callableMethodInvocationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(clientVarExpr) + .setMethodName(JavaStyle.toLowerCamelCase(String.format("%sCallable", method.name()))) + .build(); + callableMethodInvocationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(callableMethodInvocationExpr) + .setMethodName("futureCall") + .setArguments(requestVarExpr) + .setReturnType(apiFutureType) + .build(); + AssignmentExpr futureAssignmentExpr = + AssignmentExpr.builder() + .setVariableExpr(apiFutureVarExpr.toBuilder().setIsDecl(true).build()) + .setValueExpr(callableMethodInvocationExpr) + .build(); + bodyStatements.add(ExprStatement.withExpr(futureAssignmentExpr)); + bodyStatements.add(CommentStatement.withComment(LineComment.withComment("Do something."))); + + MethodInvocationExpr getMethodInvocationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(apiFutureVarExpr) + .setMethodName("get") + .setReturnType(method.outputType()) + .build(); + TypeNode methodOutputType = method.hasLro() ? method.lro().responseType() : method.outputType(); + boolean returnsVoid = methodOutputType.isProtoEmptyType(); + if (returnsVoid) { + bodyStatements.add(ExprStatement.withExpr(getMethodInvocationExpr)); + } else { + VariableExpr responseVarExpr = + VariableExpr.builder() + .setVariable( + Variable.builder().setType(method.outputType()).setName("response").build()) + .setIsDecl(true) + .build(); + AssignmentExpr responseAssignmentExpr = + AssignmentExpr.builder() + .setVariableExpr(responseVarExpr) + .setValueExpr(getMethodInvocationExpr) + .build(); + bodyStatements.add(ExprStatement.withExpr(responseAssignmentExpr)); + } + + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientVarExpr.variable().identifier().name()) + .setRpcName(method.name()) + .setIsAsynchronous(true) + .build(); + return Sample.builder() + .setBody(bodyStatements) + .setRegionTag(regionTag) + .setIsCanonical(true) + .build(); + } + + private static Sample composePagedCallableSample( + Method method, + VariableExpr clientVarExpr, + VariableExpr requestVarExpr, + Map messageTypes) { + // Find the repeated field. + Message methodOutputMessage = messageTypes.get(method.outputType().reference().fullName()); + Field repeatedPagedResultsField = methodOutputMessage.findAndUnwrapPaginatedRepeatedField(); + Preconditions.checkNotNull( + repeatedPagedResultsField, + String.format( + "No repeated field found on message %s for method %s", + methodOutputMessage.name(), method.name())); + TypeNode repeatedResponseType = repeatedPagedResultsField.type(); + + // Assign future variable by invoking paged callable method. + // e.g. ApiFuture future = + // echoClient.pagedExpandCallable().futureCall(request); + VariableExpr responseVarExpr = + VariableExpr.withVariable( + Variable.builder().setName("response").setType(method.outputType()).build()); + MethodInvocationExpr pagedCallableMethodInvocationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(clientVarExpr) + .setMethodName(JavaStyle.toLowerCamelCase(String.format("%sCallable", method.name()))) + .build(); + pagedCallableMethodInvocationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(pagedCallableMethodInvocationExpr) + .setMethodName("call") + .setArguments(requestVarExpr) + .setReturnType(method.outputType()) + .build(); + AssignmentExpr responseAssignmentExpr = + AssignmentExpr.builder() + .setVariableExpr(responseVarExpr.toBuilder().setIsDecl(true).build()) + .setValueExpr(pagedCallableMethodInvocationExpr) + .build(); + List whileBodyStatements = new ArrayList<>(); + whileBodyStatements.add(ExprStatement.withExpr(responseAssignmentExpr)); + + // For-loop on repeated response elements. + // e.g. for (EchoResponse element : response.getResponsesList()) { + // // doThingsWith(element); + // } + VariableExpr repeatedResponseVarExpr = + VariableExpr.withVariable( + Variable.builder().setName("element").setType(repeatedResponseType).build()); + MethodInvocationExpr getResponseListMethodInvocationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(responseVarExpr) + .setMethodName("getResponsesList") + .build(); + ForStatement responseForStatements = + ForStatement.builder() + .setLocalVariableExpr(repeatedResponseVarExpr.toBuilder().setIsDecl(true).build()) + .setCollectionExpr(getResponseListMethodInvocationExpr) + .setBody( + Arrays.asList( + CommentStatement.withComment( + LineComment.withComment("doThingsWith(element);")))) + .build(); + whileBodyStatements.add(responseForStatements); + + // Create nextPageToken variable expression and assign it with a value by invoking + // getNextPageToken method. + // e.g. String nextPageToken = response.getNextPageToken(); + VariableExpr nextPageTokenVarExpr = + VariableExpr.withVariable( + Variable.builder().setName("nextPageToken").setType(TypeNode.STRING).build()); + MethodInvocationExpr getNextPageTokenMethodInvocationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(responseVarExpr) + .setMethodName("getNextPageToken") + .setReturnType(TypeNode.STRING) + .build(); + AssignmentExpr nextPageTokenAssignmentExpr = + AssignmentExpr.builder() + .setVariableExpr(nextPageTokenVarExpr.toBuilder().setIsDecl(true).build()) + .setValueExpr(getNextPageTokenMethodInvocationExpr) + .build(); + whileBodyStatements.add(ExprStatement.withExpr(nextPageTokenAssignmentExpr)); + + // If nextPageToken variable expression is not null or empty, assign request variable with a + // value by invoking setPageToken method. + // if (!Strings.isNullOrEmpty(nextPageToken)) { + // request = request.toBuilder().setPageToken(nextPageToken).build(); + // } else { + // break; + // } + Expr conditionExpr = + UnaryOperationExpr.logicalNotWithExpr( + MethodInvocationExpr.builder() + .setStaticReferenceType( + TypeNode.withReference(ConcreteReference.withClazz(Strings.class))) + .setMethodName("isNullOrEmpty") + .setArguments(nextPageTokenVarExpr) + .setReturnType(TypeNode.BOOLEAN) + .build()); + MethodInvocationExpr setPageTokenMethodInvocationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(requestVarExpr) + .setMethodName("toBuilder") + .build(); + setPageTokenMethodInvocationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(setPageTokenMethodInvocationExpr) + .setMethodName("setPageToken") + .setArguments(nextPageTokenVarExpr) + .build(); + setPageTokenMethodInvocationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(setPageTokenMethodInvocationExpr) + .setMethodName("build") + .setReturnType(method.inputType()) + .build(); + AssignmentExpr requestReAssignmentExpr = + AssignmentExpr.builder() + .setVariableExpr(requestVarExpr) + .setValueExpr(setPageTokenMethodInvocationExpr) + .build(); + IfStatement nextPageTokenIfStatement = + IfStatement.builder() + .setConditionExpr(conditionExpr) + .setBody(Arrays.asList(ExprStatement.withExpr(requestReAssignmentExpr))) + .setElseBody(Arrays.asList(BreakStatement.create())) + .build(); + whileBodyStatements.add(nextPageTokenIfStatement); + + WhileStatement pagedWhileStatement = + WhileStatement.builder() + .setConditionExpr( + ValueExpr.withValue( + PrimitiveValue.builder().setValue("true").setType(TypeNode.BOOLEAN).build())) + .setBody(whileBodyStatements) + .build(); + + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientVarExpr.variable().identifier().name()) + .setRpcName(method.name()) + .setOverloadDisambiguation("Paged") + .setIsAsynchronous(true) + .build(); + return Sample.builder() + .setBody(Arrays.asList(pagedWhileStatement)) + .setRegionTag(regionTag) + .build(); + } + // Compose sample code for the method where it is CallableMethodKind.LRO. - public static String composeLroCallableMethodHeaderSampleCode( + public static Sample composeLroCallableMethod( Method method, TypeNode clientType, Map resourceNames, @@ -123,7 +350,6 @@ public static String composeLroCallableMethodHeaderSampleCode( .setVariableExpr(operationFutureVarExpr.toBuilder().setIsDecl(true).build()) .setValueExpr(rpcMethodInvocationExpr) .build()); - List bodyStatements = bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList()); bodyExprs.clear(); @@ -139,7 +365,7 @@ public static String composeLroCallableMethodHeaderSampleCode( .setMethodName("get") .setReturnType(method.lro().responseType()) .build(); - boolean returnsVoid = ServiceClientSampleUtil.isProtoEmptyType(method.lro().responseType()); + boolean returnsVoid = method.lro().responseType().isProtoEmptyType(); if (returnsVoid) { bodyExprs.add(futureGetMethodExpr); } else { @@ -162,17 +388,26 @@ public static String composeLroCallableMethodHeaderSampleCode( bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList())); bodyExprs.clear(); - return SampleCodeWriter.write( - TryCatchStatement.builder() - .setTryResourceExpr( - ServiceClientSampleUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) - .setTryBody(bodyStatements) - .setIsSampleCode(true) - .build()); + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientType.reference().name()) + .setRpcName(method.name()) + .setIsAsynchronous(true) + .setOverloadDisambiguation("LRO") + .build(); + List body = + Arrays.asList( + TryCatchStatement.builder() + .setTryResourceExpr( + SampleComposerUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) + .setTryBody(bodyStatements) + .setIsSampleCode(true) + .build()); + return Sample.builder().setBody(body).setRegionTag(regionTag).build(); } // Compose sample code for the method where it is CallableMethodKind.PAGED. - public static String composePagedCallableMethodHeaderSampleCode( + public static Sample composePagedCallableMethod( Method method, TypeNode clientType, Map resourceNames, @@ -281,18 +516,26 @@ public static String composePagedCallableMethodHeaderSampleCode( .setBody(Arrays.asList(lineCommentStatement)) .build(); bodyStatements.add(repeatedResponseForStatement); + List body = + Arrays.asList( + TryCatchStatement.builder() + .setTryResourceExpr( + SampleComposerUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) + .setTryBody(bodyStatements) + .setIsSampleCode(true) + .build()); - return SampleCodeWriter.write( - TryCatchStatement.builder() - .setTryResourceExpr( - ServiceClientSampleUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) - .setTryBody(bodyStatements) - .setIsSampleCode(true) - .build()); + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientType.reference().name()) + .setRpcName(method.name()) + .setIsAsynchronous(true) + .build(); + return Sample.builder().setBody(body).setRegionTag(regionTag).build(); } // Compose sample code for the method where it is CallableMethodKind.REGULAR. - public static String composeRegularCallableMethodHeaderSampleCode( + public static Sample composeRegularCallableMethod( Method method, TypeNode clientType, Map resourceNames, @@ -325,24 +568,32 @@ public static String composeRegularCallableMethodHeaderSampleCode( List bodyStatements = new ArrayList<>(); bodyStatements.add(ExprStatement.withExpr(requestAssignmentExpr)); + RegionTag regionTag; if (method.isPaged()) { - bodyStatements.addAll( - composePagedCallableBodyStatements(method, clientVarExpr, requestVarExpr, messageTypes)); + Sample pagedCallable = + composePagedCallableSample(method, clientVarExpr, requestVarExpr, messageTypes); + bodyStatements.addAll(pagedCallable.body()); + regionTag = pagedCallable.regionTag(); } else { - bodyStatements.addAll( - composeUnaryOrLroCallableBodyStatements(method, clientVarExpr, requestVarExpr)); + // e.g. echoClient.echoCallable().futureCall(request) + Sample unaryOrLroCallable = + composeUnaryOrLroCallableSample(method, clientVarExpr, requestVarExpr); + bodyStatements.addAll(unaryOrLroCallable.body()); + regionTag = unaryOrLroCallable.regionTag(); } - return SampleCodeWriter.write( - TryCatchStatement.builder() - .setTryResourceExpr( - ServiceClientSampleUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) - .setTryBody(bodyStatements) - .setIsSampleCode(true) - .build()); + List body = + Arrays.asList( + TryCatchStatement.builder() + .setTryResourceExpr( + SampleComposerUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) + .setTryBody(bodyStatements) + .setIsSampleCode(true) + .build()); + return Sample.builder().setBody(body).setRegionTag(regionTag).build(); } - public static String composeStreamCallableMethodHeaderSampleCode( + public static Sample composeStreamCallableMethod( Method method, TypeNode clientType, Map resourceNames, @@ -371,72 +622,149 @@ public static String composeStreamCallableMethodHeaderSampleCode( .setValueExpr(requestBuilderExpr) .build(); + RegionTag regionTag = null; List bodyStatements = new ArrayList<>(); - if (method.stream().equals(Stream.SERVER)) { - bodyStatements.addAll( - composeStreamServerBodyStatements(method, clientVarExpr, requestAssignmentExpr)); - } else if (method.stream().equals(Stream.BIDI)) { - bodyStatements.addAll( - composeStreamBidiBodyStatements(method, clientVarExpr, requestAssignmentExpr)); - } else if (method.stream().equals(Stream.CLIENT)) { - bodyStatements.addAll( - composeStreamClientBodyStatements(method, clientVarExpr, requestAssignmentExpr)); + if (method.stream().equals(Method.Stream.SERVER)) { + // e.g. ServerStream stream = echoClient.expandCallable().call(request); + Sample streamServer = composeStreamServerSample(method, clientVarExpr, requestAssignmentExpr); + bodyStatements.addAll(streamServer.body()); + regionTag = streamServer.regionTag(); + } else if (method.stream().equals(Method.Stream.BIDI)) { + // e.g. echoClient.collect().clientStreamingCall(responseObserver); + Sample streamBidi = composeStreamBidiSample(method, clientVarExpr, requestAssignmentExpr); + bodyStatements.addAll(streamBidi.body()); + regionTag = streamBidi.regionTag(); + } else if (method.stream().equals(Method.Stream.CLIENT)) { + Sample streamClient = composeStreamClientSample(method, clientVarExpr, requestAssignmentExpr); + bodyStatements.addAll(streamClient.body()); + regionTag = streamClient.regionTag(); } - return SampleCodeWriter.write( - TryCatchStatement.builder() - .setTryResourceExpr( - ServiceClientSampleUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) - .setTryBody(bodyStatements) - .setIsSampleCode(true) - .build()); + List body = + Arrays.asList( + TryCatchStatement.builder() + .setTryResourceExpr( + SampleComposerUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) + .setTryBody(bodyStatements) + .setIsSampleCode(true) + .build()); + return Sample.builder().setBody(body).setRegionTag(regionTag).build(); } - private static List composeStreamBidiBodyStatements( + private static Sample composeStreamServerSample( Method method, VariableExpr clientVarExpr, AssignmentExpr requestAssignmentExpr) { List bodyExprs = new ArrayList<>(); + bodyExprs.add(requestAssignmentExpr); - // Create bidi stream variable expression and assign it with invoking client's bidi stream + // Create server stream variable expression, and assign it a value by invoking server stream // method. - // e.g. BidiStream bidiStream = echoClient.chatCallable().call(); - TypeNode bidiStreamType = + // e.g. ServerStream stream = echoClient.expandCallable().call(request) + TypeNode serverStreamType = TypeNode.withReference( ConcreteReference.builder() - .setClazz(BidiStream.class) - .setGenerics(method.inputType().reference(), method.outputType().reference()) + .setClazz(ServerStream.class) + .setGenerics(method.outputType().reference()) .build()); - VariableExpr bidiStreamVarExpr = + VariableExpr serverStreamVarExpr = VariableExpr.withVariable( - Variable.builder().setName("bidiStream").setType(bidiStreamType).build()); - MethodInvocationExpr clientBidiStreamCallMethodInvoationExpr = + Variable.builder().setName("stream").setType(serverStreamType).build()); + MethodInvocationExpr clientStreamCallMethodInvocationExpr = MethodInvocationExpr.builder() .setExprReferenceExpr(clientVarExpr) .setMethodName(JavaStyle.toLowerCamelCase(String.format("%sCallable", method.name()))) .build(); - clientBidiStreamCallMethodInvoationExpr = + clientStreamCallMethodInvocationExpr = MethodInvocationExpr.builder() - .setExprReferenceExpr(clientBidiStreamCallMethodInvoationExpr) + .setExprReferenceExpr(clientStreamCallMethodInvocationExpr) .setMethodName("call") - .setReturnType(bidiStreamType) + .setArguments(requestAssignmentExpr.variableExpr().toBuilder().setIsDecl(false).build()) + .setReturnType(serverStreamType) .build(); - AssignmentExpr bidiStreamAssignmentExpr = + AssignmentExpr streamAssignmentExpr = AssignmentExpr.builder() - .setVariableExpr(bidiStreamVarExpr.toBuilder().setIsDecl(true).build()) - .setValueExpr(clientBidiStreamCallMethodInvoationExpr) + .setVariableExpr(serverStreamVarExpr.toBuilder().setIsDecl(true).build()) + .setValueExpr(clientStreamCallMethodInvocationExpr) .build(); - bodyExprs.add(bidiStreamAssignmentExpr); + bodyExprs.add(streamAssignmentExpr); - // Add request with default value expression. - bodyExprs.add(requestAssignmentExpr); + List bodyStatements = + bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList()); - // Invoke send method with argument request. - // e.g. bidiStream.send(request); - MethodInvocationExpr sendMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(bidiStreamVarExpr) - .setArguments(requestAssignmentExpr.variableExpr().toBuilder().setIsDecl(false).build()) - .setMethodName("send") - .build(); + // For-loop on server stream variable expression. + // e.g. for (EchoResponse response : stream) { + // // Do something when a response is received. + // } + VariableExpr responseVarExpr = + VariableExpr.builder() + .setVariable( + Variable.builder().setName("response").setType(method.outputType()).build()) + .setIsDecl(true) + .build(); + ForStatement forStatement = + ForStatement.builder() + .setLocalVariableExpr(responseVarExpr) + .setCollectionExpr(serverStreamVarExpr) + .setBody( + Arrays.asList( + CommentStatement.withComment( + LineComment.withComment("Do something when a response is received.")))) + .build(); + bodyStatements.add(forStatement); + + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientVarExpr.variable().identifier().name()) + .setRpcName(method.name()) + .setIsAsynchronous(true) + .build(); + return Sample.builder().setBody(bodyStatements).setRegionTag(regionTag).build(); + } + + private static Sample composeStreamBidiSample( + Method method, VariableExpr clientVarExpr, AssignmentExpr requestAssignmentExpr) { + List bodyExprs = new ArrayList<>(); + + // Create bidi stream variable expression and assign it with invoking client's bidi stream + // method. + // e.g. BidiStream bidiStream = echoClient.chatCallable().call(); + TypeNode bidiStreamType = + TypeNode.withReference( + ConcreteReference.builder() + .setClazz(BidiStream.class) + .setGenerics(method.inputType().reference(), method.outputType().reference()) + .build()); + VariableExpr bidiStreamVarExpr = + VariableExpr.withVariable( + Variable.builder().setName("bidiStream").setType(bidiStreamType).build()); + MethodInvocationExpr clientBidiStreamCallMethodInvoationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(clientVarExpr) + .setMethodName(JavaStyle.toLowerCamelCase(String.format("%sCallable", method.name()))) + .build(); + clientBidiStreamCallMethodInvoationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(clientBidiStreamCallMethodInvoationExpr) + .setMethodName("call") + .setReturnType(bidiStreamType) + .build(); + AssignmentExpr bidiStreamAssignmentExpr = + AssignmentExpr.builder() + .setVariableExpr(bidiStreamVarExpr.toBuilder().setIsDecl(true).build()) + .setValueExpr(clientBidiStreamCallMethodInvoationExpr) + .build(); + bodyExprs.add(bidiStreamAssignmentExpr); + + // Add request with default value expression. + bodyExprs.add(requestAssignmentExpr); + + // Invoke send method with argument request. + // e.g. bidiStream.send(request); + MethodInvocationExpr sendMethodInvocationExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(bidiStreamVarExpr) + .setArguments(requestAssignmentExpr.variableExpr().toBuilder().setIsDecl(false).build()) + .setMethodName("send") + .build(); bodyExprs.add(sendMethodInvocationExpr); List bodyStatements = @@ -462,10 +790,16 @@ private static List composeStreamBidiBodyStatements( .build(); bodyStatements.add(forStatement); - return bodyStatements; + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientVarExpr.variable().identifier().name()) + .setRpcName(method.name()) + .setIsAsynchronous(true) + .build(); + return Sample.builder().setBody(bodyStatements).setRegionTag(regionTag).build(); } - private static List composeStreamClientBodyStatements( + private static Sample composeStreamClientSample( Method method, VariableExpr clientVarExpr, AssignmentExpr requestAssignmentExpr) { List bodyExprs = new ArrayList<>(); @@ -588,273 +922,16 @@ private static List composeStreamClientBodyStatements( .build(); bodyExprs.add(onNextMethodExpr); - return bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList()); - } - - private static List composeStreamServerBodyStatements( - Method method, VariableExpr clientVarExpr, AssignmentExpr requestAssignmentExpr) { - List bodyExprs = new ArrayList<>(); - bodyExprs.add(requestAssignmentExpr); - - // Create server stream variable expression, and assign it a value by invoking server stream - // method. - // e.g. ServerStream stream = echoClient.expandCallable().call(request) - TypeNode serverStreamType = - TypeNode.withReference( - ConcreteReference.builder() - .setClazz(ServerStream.class) - .setGenerics(method.outputType().reference()) - .build()); - VariableExpr serverStreamVarExpr = - VariableExpr.withVariable( - Variable.builder().setName("stream").setType(serverStreamType).build()); - MethodInvocationExpr clientStreamCallMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(clientVarExpr) - .setMethodName(JavaStyle.toLowerCamelCase(String.format("%sCallable", method.name()))) - .build(); - clientStreamCallMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(clientStreamCallMethodInvocationExpr) - .setMethodName("call") - .setArguments(requestAssignmentExpr.variableExpr().toBuilder().setIsDecl(false).build()) - .setReturnType(serverStreamType) - .build(); - AssignmentExpr streamAssignmentExpr = - AssignmentExpr.builder() - .setVariableExpr(serverStreamVarExpr.toBuilder().setIsDecl(true).build()) - .setValueExpr(clientStreamCallMethodInvocationExpr) - .build(); - bodyExprs.add(streamAssignmentExpr); - - List bodyStatements = - bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList()); - - // For-loop on server stream variable expression. - // e.g. for (EchoResponse response : stream) { - // // Do something when a response is received. - // } - VariableExpr responseVarExpr = - VariableExpr.builder() - .setVariable( - Variable.builder().setName("response").setType(method.outputType()).build()) - .setIsDecl(true) - .build(); - ForStatement forStatement = - ForStatement.builder() - .setLocalVariableExpr(responseVarExpr) - .setCollectionExpr(serverStreamVarExpr) - .setBody( - Arrays.asList( - CommentStatement.withComment( - LineComment.withComment("Do something when a response is received.")))) - .build(); - bodyStatements.add(forStatement); - - return bodyStatements; - } - - private static List composeUnaryOrLroCallableBodyStatements( - Method method, VariableExpr clientVarExpr, VariableExpr requestVarExpr) { - List bodyStatements = new ArrayList<>(); - // Create api future variable expression, and assign it with a value by invoking callable - // method. - // e.g. ApiFuture future = echoClient.echoCallable().futureCall(request); - TypeNode apiFutureType = - TypeNode.withReference( - ConcreteReference.builder() - .setClazz(ApiFuture.class) - .setGenerics( - method.hasLro() - ? ConcreteReference.withClazz(Operation.class) - : method.outputType().reference()) - .build()); - VariableExpr apiFutureVarExpr = - VariableExpr.withVariable( - Variable.builder().setName("future").setType(apiFutureType).build()); - MethodInvocationExpr callableMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(clientVarExpr) - .setMethodName(JavaStyle.toLowerCamelCase(String.format("%sCallable", method.name()))) - .build(); - callableMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(callableMethodInvocationExpr) - .setMethodName("futureCall") - .setArguments(requestVarExpr) - .setReturnType(apiFutureType) - .build(); - AssignmentExpr futureAssignmentExpr = - AssignmentExpr.builder() - .setVariableExpr(apiFutureVarExpr.toBuilder().setIsDecl(true).build()) - .setValueExpr(callableMethodInvocationExpr) - .build(); - bodyStatements.add(ExprStatement.withExpr(futureAssignmentExpr)); - bodyStatements.add(CommentStatement.withComment(LineComment.withComment("Do something."))); - - MethodInvocationExpr getMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(apiFutureVarExpr) - .setMethodName("get") - .setReturnType(method.outputType()) - .build(); - TypeNode methodOutputType = method.hasLro() ? method.lro().responseType() : method.outputType(); - boolean returnsVoid = ServiceClientSampleUtil.isProtoEmptyType(methodOutputType); - if (returnsVoid) { - bodyStatements.add(ExprStatement.withExpr(getMethodInvocationExpr)); - } else { - VariableExpr responseVarExpr = - VariableExpr.builder() - .setVariable( - Variable.builder().setType(method.outputType()).setName("response").build()) - .setIsDecl(true) - .build(); - AssignmentExpr responseAssignmentExpr = - AssignmentExpr.builder() - .setVariableExpr(responseVarExpr) - .setValueExpr(getMethodInvocationExpr) - .build(); - bodyStatements.add(ExprStatement.withExpr(responseAssignmentExpr)); - } - return bodyStatements; - } - - private static List composePagedCallableBodyStatements( - Method method, - VariableExpr clientVarExpr, - VariableExpr requestVarExpr, - Map messageTypes) { - // Find the repeated field. - Message methodOutputMessage = messageTypes.get(method.outputType().reference().fullName()); - Field repeatedPagedResultsField = methodOutputMessage.findAndUnwrapPaginatedRepeatedField(); - Preconditions.checkNotNull( - repeatedPagedResultsField, - String.format( - "No repeated field found on message %s for method %s", - methodOutputMessage.name(), method.name())); - TypeNode repeatedResponseType = repeatedPagedResultsField.type(); - - // Assign future variable by invoking paged callable method. - // e.g. ApiFuture future = - // echoClient.pagedExpandCallable().futureCall(request); - VariableExpr responseVarExpr = - VariableExpr.withVariable( - Variable.builder().setName("response").setType(method.outputType()).build()); - MethodInvocationExpr pagedCallableMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(clientVarExpr) - .setMethodName(JavaStyle.toLowerCamelCase(String.format("%sCallable", method.name()))) - .build(); - pagedCallableMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(pagedCallableMethodInvocationExpr) - .setMethodName("call") - .setArguments(requestVarExpr) - .setReturnType(method.outputType()) - .build(); - AssignmentExpr responseAssignmentExpr = - AssignmentExpr.builder() - .setVariableExpr(responseVarExpr.toBuilder().setIsDecl(true).build()) - .setValueExpr(pagedCallableMethodInvocationExpr) - .build(); - List whileBodyStatements = new ArrayList<>(); - whileBodyStatements.add(ExprStatement.withExpr(responseAssignmentExpr)); - - // For-loop on repeated response elements. - // e.g. for (EchoResponse element : response.getResponsesList()) { - // // doThingsWith(element); - // } - VariableExpr repeatedResponseVarExpr = - VariableExpr.withVariable( - Variable.builder().setName("element").setType(repeatedResponseType).build()); - MethodInvocationExpr getResponseListMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(responseVarExpr) - .setMethodName("getResponsesList") - .build(); - ForStatement responseForStatements = - ForStatement.builder() - .setLocalVariableExpr(repeatedResponseVarExpr.toBuilder().setIsDecl(true).build()) - .setCollectionExpr(getResponseListMethodInvocationExpr) - .setBody( - Arrays.asList( - CommentStatement.withComment( - LineComment.withComment("doThingsWith(element);")))) - .build(); - whileBodyStatements.add(responseForStatements); - - // Create nextPageToken variable expression and assign it with a value by invoking - // getNextPageToken method. - // e.g. String nextPageToken = response.getNextPageToken(); - VariableExpr nextPageTokenVarExpr = - VariableExpr.withVariable( - Variable.builder().setName("nextPageToken").setType(TypeNode.STRING).build()); - MethodInvocationExpr getNextPageTokenMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(responseVarExpr) - .setMethodName("getNextPageToken") - .setReturnType(TypeNode.STRING) - .build(); - AssignmentExpr nextPageTokenAssignmentExpr = - AssignmentExpr.builder() - .setVariableExpr(nextPageTokenVarExpr.toBuilder().setIsDecl(true).build()) - .setValueExpr(getNextPageTokenMethodInvocationExpr) - .build(); - whileBodyStatements.add(ExprStatement.withExpr(nextPageTokenAssignmentExpr)); - - // If nextPageToken variable expression is not null or empty, assign request variable with a - // value by invoking setPageToken method. - // if (!Strings.isNullOrEmpty(nextPageToken)) { - // request = request.toBuilder().setPageToken(nextPageToken).build(); - // } else { - // break; - // } - Expr conditionExpr = - UnaryOperationExpr.logicalNotWithExpr( - MethodInvocationExpr.builder() - .setStaticReferenceType( - TypeNode.withReference(ConcreteReference.withClazz(Strings.class))) - .setMethodName("isNullOrEmpty") - .setArguments(nextPageTokenVarExpr) - .setReturnType(TypeNode.BOOLEAN) - .build()); - MethodInvocationExpr setPageTokenMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(requestVarExpr) - .setMethodName("toBuilder") - .build(); - setPageTokenMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(setPageTokenMethodInvocationExpr) - .setMethodName("setPageToken") - .setArguments(nextPageTokenVarExpr) - .build(); - setPageTokenMethodInvocationExpr = - MethodInvocationExpr.builder() - .setExprReferenceExpr(setPageTokenMethodInvocationExpr) - .setMethodName("build") - .setReturnType(method.inputType()) - .build(); - AssignmentExpr requestReAssignmentExpr = - AssignmentExpr.builder() - .setVariableExpr(requestVarExpr) - .setValueExpr(setPageTokenMethodInvocationExpr) - .build(); - IfStatement nextPageTokenIfStatement = - IfStatement.builder() - .setConditionExpr(conditionExpr) - .setBody(Arrays.asList(ExprStatement.withExpr(requestReAssignmentExpr))) - .setElseBody(Arrays.asList(BreakStatement.create())) - .build(); - whileBodyStatements.add(nextPageTokenIfStatement); - - WhileStatement pagedWhileStatement = - WhileStatement.builder() - .setConditionExpr( - ValueExpr.withValue( - PrimitiveValue.builder().setValue("true").setType(TypeNode.BOOLEAN).build())) - .setBody(whileBodyStatements) - .build(); - return Arrays.asList(pagedWhileStatement); + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientVarExpr.variable().identifier().name()) + .setRpcName(method.name()) + .setIsAsynchronous(true) + .build(); + return Sample.builder() + .setBody( + bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList())) + .setRegionTag(regionTag) + .build(); } } diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientHeaderSampleComposer.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientHeaderSampleComposer.java index 34bbb4f8d7..4ad29804f6 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientHeaderSampleComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientHeaderSampleComposer.java @@ -20,20 +20,33 @@ import com.google.api.generator.engine.ast.Expr; import com.google.api.generator.engine.ast.ExprStatement; import com.google.api.generator.engine.ast.MethodInvocationExpr; +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.VaporReference; import com.google.api.generator.engine.ast.Variable; import com.google.api.generator.engine.ast.VariableExpr; +import com.google.api.generator.gapic.composer.defaultvalue.DefaultValueComposer; import com.google.api.generator.gapic.model.Message; import com.google.api.generator.gapic.model.Method; +import com.google.api.generator.gapic.model.MethodArgument; +import com.google.api.generator.gapic.model.RegionTag; import com.google.api.generator.gapic.model.ResourceName; +import com.google.api.generator.gapic.model.Sample; import com.google.api.generator.gapic.model.Service; import com.google.api.generator.gapic.utils.JavaStyle; +import com.google.common.base.Preconditions; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; +import java.util.List; import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; public class ServiceClientHeaderSampleComposer { - public static String composeClassHeaderMethodSampleCode( + public static Sample composeClassHeaderSample( Service service, TypeNode clientType, Map resourceNames, @@ -47,18 +60,75 @@ public static String composeClassHeaderMethodSampleCode( .orElse(service.methods().get(0)); if (method.stream() == Method.Stream.NONE) { if (method.methodSignatures().isEmpty()) { - return ServiceClientMethodSampleComposer.composeRpcDefaultMethodHeaderSampleCode( + return ServiceClientMethodSampleComposer.composeCanonicalSample( method, clientType, resourceNames, messageTypes); } - return ServiceClientMethodSampleComposer.composeRpcMethodHeaderSampleCode( + return composeShowcaseMethodSample( method, clientType, method.methodSignatures().get(0), resourceNames, messageTypes); } - return ServiceClientCallableSampleComposer.composeStreamCallableMethodHeaderSampleCode( + return ServiceClientCallableMethodSampleComposer.composeStreamCallableMethod( method, clientType, resourceNames, messageTypes); } - public static String composeClassHeaderCredentialsSampleCode( - TypeNode clientType, TypeNode settingsType) { + public static Sample composeShowcaseMethodSample( + Method method, + TypeNode clientType, + List arguments, + Map resourceNames, + Map messageTypes) { + VariableExpr clientVarExpr = + VariableExpr.withVariable( + Variable.builder() + .setName(JavaStyle.toLowerCamelCase(clientType.reference().name())) + .setType(clientType) + .build()); + + // Assign method's arguments variable with the default values. + List rpcMethodArgVarExprs = createArgumentVariableExprs(arguments); + List rpcMethodArgDefaultValueExprs = + createArgumentDefaultValueExprs(arguments, resourceNames); + List rpcMethodArgAssignmentExprs = + createAssignmentsForVarExprsWithValueExprs( + rpcMethodArgVarExprs, rpcMethodArgDefaultValueExprs); + + List bodyExprs = new ArrayList<>(); + bodyExprs.addAll(rpcMethodArgAssignmentExprs); + + List bodyStatements = new ArrayList<>(); + RegionTag regionTag; + if (method.isPaged()) { + Sample unaryPagedRpc = + ServiceClientMethodSampleComposer.composePagedSample( + method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs, messageTypes); + bodyStatements.addAll(unaryPagedRpc.body()); + regionTag = unaryPagedRpc.regionTag(); + } else if (method.hasLro()) { + Sample unaryLroRpc = + ServiceClientMethodSampleComposer.composeLroSample( + method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs); + bodyStatements.addAll(unaryLroRpc.body()); + regionTag = unaryLroRpc.regionTag(); + } else { + // e.g. echoClient.echo(), echoClient.echo(...) + Sample unaryRpc = + ServiceClientMethodSampleComposer.composeSample( + method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs); + bodyStatements.addAll(unaryRpc.body()); + regionTag = unaryRpc.regionTag(); + } + + List body = + Arrays.asList( + TryCatchStatement.builder() + .setTryResourceExpr( + SampleComposerUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) + .setTryBody(bodyStatements) + .setIsSampleCode(true) + .build()); + return Sample.builder().setBody(body).setRegionTag(regionTag).build(); + } + + public static Sample composeSetCredentialsSample(TypeNode clientType, TypeNode settingsType) { // Initialize clientSettings with builder() method. // e.g. EchoSettings echoSettings = // EchoSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create("myCredentials")).build(); @@ -118,19 +188,26 @@ public static String composeClassHeaderCredentialsSampleCode( .setMethodName("create") .setReturnType(clientType) .build(); + String rpcName = createMethodExpr.methodIdentifier().name(); Expr initClientVarExpr = AssignmentExpr.builder() .setVariableExpr(clientVarExpr.toBuilder().setIsDecl(true).build()) .setValueExpr(createMethodExpr) .build(); - return SampleCodeWriter.write( + + List sampleBody = Arrays.asList( - ExprStatement.withExpr(initSettingsVarExpr), - ExprStatement.withExpr(initClientVarExpr))); + ExprStatement.withExpr(initSettingsVarExpr), ExprStatement.withExpr(initClientVarExpr)); + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientName) + .setRpcName(rpcName) + .setOverloadDisambiguation("setCredentialsProvider") + .build(); + return Sample.builder().setBody(sampleBody).setRegionTag(regionTag).build(); } - public static String composeClassHeaderEndpointSampleCode( - TypeNode clientType, TypeNode settingsType) { + public static Sample composeSetEndpointSample(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()); @@ -182,15 +259,77 @@ public static String composeClassHeaderEndpointSampleCode( .setMethodName("create") .setReturnType(clientType) .build(); + String rpcName = createMethodExpr.methodIdentifier().name(); Expr initClientVarExpr = AssignmentExpr.builder() .setVariableExpr(clientVarExpr.toBuilder().setIsDecl(true).build()) .setValueExpr(createMethodExpr) .build(); - - return SampleCodeWriter.write( + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientName) + .setRpcName(rpcName) + .setOverloadDisambiguation("setEndpoint") + .build(); + List sampleBody = Arrays.asList( - ExprStatement.withExpr(initSettingsVarExpr), - ExprStatement.withExpr(initClientVarExpr))); + ExprStatement.withExpr(initSettingsVarExpr), ExprStatement.withExpr(initClientVarExpr)); + return Sample.builder().setBody(sampleBody).setRegionTag(regionTag).build(); + } + + // Create a list of RPC method arguments' variable expressions. + private static List createArgumentVariableExprs(List arguments) { + return arguments.stream() + .map( + arg -> + VariableExpr.withVariable( + Variable.builder() + .setName(JavaStyle.toLowerCamelCase(arg.name())) + .setType(arg.type()) + .build())) + .collect(Collectors.toList()); + } + + // Create a list of RPC method arguments' default value expression. + private static List createArgumentDefaultValueExprs( + List arguments, Map resourceNames) { + List resourceNameList = + resourceNames.values().stream().collect(Collectors.toList()); + Function stringResourceNameDefaultValueExpr = + arg -> + MethodInvocationExpr.builder() + .setExprReferenceExpr( + DefaultValueComposer.createResourceHelperValue( + resourceNames.get(arg.field().resourceReference().resourceTypeString()), + arg.field().resourceReference().isChildType(), + resourceNameList, + arg.field().name())) + .setMethodName("toString") + .setReturnType(TypeNode.STRING) + .build(); + return arguments.stream() + .map( + arg -> + !SampleComposerUtil.isStringTypedResourceName(arg, resourceNames) + ? DefaultValueComposer.createMethodArgValue( + arg, resourceNames, Collections.emptyMap(), Collections.emptyMap()) + : stringResourceNameDefaultValueExpr.apply(arg)) + .collect(Collectors.toList()); + } + + // Create a list of assignment expressions for variable expr with value expr. + private static List createAssignmentsForVarExprsWithValueExprs( + List variableExprs, List valueExprs) { + Preconditions.checkState( + variableExprs.size() == valueExprs.size(), + "Expected the number of method arguments to match the number of default values."); + return IntStream.range(0, variableExprs.size()) + .mapToObj( + i -> + AssignmentExpr.builder() + .setVariableExpr(variableExprs.get(i).toBuilder().setIsDecl(true).build()) + .setValueExpr(valueExprs.get(i)) + .build()) + .collect(Collectors.toList()); } } diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientMethodSampleComposer.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientMethodSampleComposer.java index 0e167d5ec6..167c8afa4d 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientMethodSampleComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientMethodSampleComposer.java @@ -30,8 +30,9 @@ import com.google.api.generator.gapic.model.Field; import com.google.api.generator.gapic.model.Message; import com.google.api.generator.gapic.model.Method; -import com.google.api.generator.gapic.model.MethodArgument; +import com.google.api.generator.gapic.model.RegionTag; import com.google.api.generator.gapic.model.ResourceName; +import com.google.api.generator.gapic.model.Sample; import com.google.api.generator.gapic.utils.JavaStyle; import com.google.common.base.Preconditions; import java.util.ArrayList; @@ -41,56 +42,7 @@ import java.util.stream.Collectors; public class ServiceClientMethodSampleComposer { - public static String composeRpcMethodHeaderSampleCode( - Method method, - TypeNode clientType, - List arguments, - Map resourceNames, - Map messageTypes) { - VariableExpr clientVarExpr = - VariableExpr.withVariable( - Variable.builder() - .setName(JavaStyle.toLowerCamelCase(clientType.reference().name())) - .setType(clientType) - .build()); - - // Assign method's arguments variable with the default values. - List rpcMethodArgVarExprs = - ServiceClientSampleUtil.createRpcMethodArgumentVariableExprs(arguments); - List rpcMethodArgDefaultValueExprs = - ServiceClientSampleUtil.createRpcMethodArgumentDefaultValueExprs(arguments, resourceNames); - List rpcMethodArgAssignmentExprs = - ServiceClientSampleUtil.createAssignmentsForVarExprsWithValueExprs( - rpcMethodArgVarExprs, rpcMethodArgDefaultValueExprs); - - List bodyExprs = new ArrayList<>(); - bodyExprs.addAll(rpcMethodArgAssignmentExprs); - - List bodyStatements = new ArrayList<>(); - if (method.isPaged()) { - bodyStatements.addAll( - composeUnaryPagedRpcMethodBodyStatements( - method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs, messageTypes)); - } else if (method.hasLro()) { - bodyStatements.addAll( - composeUnaryLroRpcMethodBodyStatements( - method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs)); - } else { - bodyStatements.addAll( - composeUnaryRpcMethodBodyStatements( - method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs)); - } - - return SampleCodeWriter.write( - TryCatchStatement.builder() - .setTryResourceExpr( - ServiceClientSampleUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) - .setTryBody(bodyStatements) - .setIsSampleCode(true) - .build()); - } - - public static String composeRpcDefaultMethodHeaderSampleCode( + public static Sample composeCanonicalSample( Method method, TypeNode clientType, Map resourceNames, @@ -125,30 +77,36 @@ public static String composeRpcDefaultMethodHeaderSampleCode( bodyExprs.add(requestAssignmentExpr); List bodyStatements = new ArrayList<>(); + RegionTag regionTag; if (method.isPaged()) { - bodyStatements.addAll( - composeUnaryPagedRpcMethodBodyStatements( - method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs, messageTypes)); + // e.g. echoClient.pagedExpand(request).iterateAll() + Sample unaryPagedRpc = + composePagedSample(method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs, messageTypes); + bodyStatements.addAll(unaryPagedRpc.body()); + regionTag = unaryPagedRpc.regionTag(); } else if (method.hasLro()) { - bodyStatements.addAll( - composeUnaryLroRpcMethodBodyStatements( - method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs)); + Sample unaryLroRpc = composeLroSample(method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs); + bodyStatements.addAll(unaryLroRpc.body()); + regionTag = unaryLroRpc.regionTag(); } else { - bodyStatements.addAll( - composeUnaryRpcMethodBodyStatements( - method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs)); + // e.g. echoClient.echo(request) + Sample unaryRpc = composeSample(method, clientVarExpr, rpcMethodArgVarExprs, bodyExprs); + bodyStatements.addAll(unaryRpc.body()); + regionTag = unaryRpc.regionTag(); } - return SampleCodeWriter.write( - TryCatchStatement.builder() - .setTryResourceExpr( - ServiceClientSampleUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) - .setTryBody(bodyStatements) - .setIsSampleCode(true) - .build()); + List body = + Arrays.asList( + TryCatchStatement.builder() + .setTryResourceExpr( + SampleComposerUtil.assignClientVariableWithCreateMethodExpr(clientVarExpr)) + .setTryBody(bodyStatements) + .setIsSampleCode(true) + .build()); + return Sample.builder().setBody(body).setRegionTag(regionTag).setIsCanonical(true).build(); } - private static List composeUnaryRpcMethodBodyStatements( + static Sample composeSample( Method method, VariableExpr clientVarExpr, List rpcMethodArgVarExprs, @@ -157,7 +115,7 @@ private static List composeUnaryRpcMethodBodyStatements( // Invoke current method based on return type. // e.g. if return void, echoClient.echo(..); or, // e.g. if return other type, EchoResponse response = echoClient.echo(...); - boolean returnsVoid = ServiceClientSampleUtil.isProtoEmptyType(method.outputType()); + boolean returnsVoid = method.outputType().isProtoEmptyType(); MethodInvocationExpr clientRpcMethodInvocationExpr = MethodInvocationExpr.builder() .setExprReferenceExpr(clientVarExpr) @@ -179,10 +137,21 @@ private static List composeUnaryRpcMethodBodyStatements( .build()); } - return bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList()); + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientVarExpr.variable().identifier().name()) + .setRpcName(method.name()) + .setOverloadDisambiguation( + SampleComposerUtil.createOverloadDisambiguation(rpcMethodArgVarExprs)) + .build(); + return Sample.builder() + .setBody( + bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList())) + .setRegionTag(regionTag) + .build(); } - private static List composeUnaryPagedRpcMethodBodyStatements( + static Sample composePagedSample( Method method, VariableExpr clientVarExpr, List rpcMethodArgVarExprs, @@ -215,6 +184,7 @@ private static List composeUnaryPagedRpcMethodBodyStatements( .setArguments( rpcMethodArgVarExprs.stream().map(e -> (Expr) e).collect(Collectors.toList())) .build(); + clientMethodIterateAllExpr = MethodInvocationExpr.builder() .setExprReferenceExpr(clientMethodIterateAllExpr) @@ -241,10 +211,17 @@ private static List composeUnaryPagedRpcMethodBodyStatements( bodyExprs.clear(); bodyStatements.add(loopIteratorStatement); - return bodyStatements; + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientVarExpr.variable().identifier().name()) + .setRpcName(method.name()) + .setOverloadDisambiguation( + SampleComposerUtil.createOverloadDisambiguation(rpcMethodArgVarExprs)) + .build(); + return Sample.builder().setBody(bodyStatements).setRegionTag(regionTag).build(); } - private static List composeUnaryLroRpcMethodBodyStatements( + static Sample composeLroSample( Method method, VariableExpr clientVarExpr, List rpcMethodArgVarExprs, @@ -252,7 +229,7 @@ private static List composeUnaryLroRpcMethodBodyStatements( // Assign response variable with invoking client's LRO method. // e.g. if return void, echoClient.waitAsync(ttl).get(); or, // e.g. if return other type, WaitResponse response = echoClient.waitAsync(ttl).get(); - Expr invokeLroGetMethodExpr = + MethodInvocationExpr invokeLroGetMethodExpr = MethodInvocationExpr.builder() .setExprReferenceExpr(clientVarExpr) .setMethodName(String.format("%sAsync", JavaStyle.toLowerCamelCase(method.name()))) @@ -265,7 +242,7 @@ private static List composeUnaryLroRpcMethodBodyStatements( .setMethodName("get") .setReturnType(method.lro().responseType()) .build(); - boolean returnsVoid = ServiceClientSampleUtil.isProtoEmptyType(method.lro().responseType()); + boolean returnsVoid = method.lro().responseType().isProtoEmptyType(); if (returnsVoid) { bodyExprs.add(invokeLroGetMethodExpr); } else { @@ -284,7 +261,17 @@ private static List composeUnaryLroRpcMethodBodyStatements( .setValueExpr(invokeLroGetMethodExpr) .build()); } - - return bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList()); + RegionTag regionTag = + RegionTag.builder() + .setServiceName(clientVarExpr.variable().identifier().name()) + .setRpcName(method.name()) + .setOverloadDisambiguation( + SampleComposerUtil.createOverloadDisambiguation(rpcMethodArgVarExprs)) + .build(); + return Sample.builder() + .setBody( + bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList())) + .setRegionTag(regionTag) + .build(); } } diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleUtil.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleUtil.java deleted file mode 100644 index 5203dcc12d..0000000000 --- a/src/main/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleUtil.java +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.api.generator.gapic.composer.samplecode; - -import com.google.api.generator.engine.ast.AssignmentExpr; -import com.google.api.generator.engine.ast.Expr; -import com.google.api.generator.engine.ast.MethodInvocationExpr; -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.composer.defaultvalue.DefaultValueComposer; -import com.google.api.generator.gapic.model.MethodArgument; -import com.google.api.generator.gapic.model.ResourceName; -import com.google.api.generator.gapic.utils.JavaStyle; -import com.google.common.base.Preconditions; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -public class ServiceClientSampleUtil { - // Create a list of RPC method arguments' variable expressions. - static List createRpcMethodArgumentVariableExprs(List arguments) { - return arguments.stream() - .map( - arg -> - VariableExpr.withVariable( - Variable.builder() - .setName(JavaStyle.toLowerCamelCase(arg.name())) - .setType(arg.type()) - .build())) - .collect(Collectors.toList()); - } - - // Create a list of RPC method arguments' default value expression. - static List createRpcMethodArgumentDefaultValueExprs( - List arguments, Map resourceNames) { - List resourceNameList = - resourceNames.values().stream().collect(Collectors.toList()); - Function stringResourceNameDefaultValueExpr = - arg -> - MethodInvocationExpr.builder() - .setExprReferenceExpr( - DefaultValueComposer.createResourceHelperValue( - resourceNames.get(arg.field().resourceReference().resourceTypeString()), - arg.field().resourceReference().isChildType(), - resourceNameList, - arg.field().name())) - .setMethodName("toString") - .setReturnType(TypeNode.STRING) - .build(); - return arguments.stream() - .map( - arg -> - !isStringTypedResourceName(arg, resourceNames) - ? DefaultValueComposer.createMethodArgValue( - arg, resourceNames, Collections.emptyMap(), Collections.emptyMap()) - : stringResourceNameDefaultValueExpr.apply(arg)) - .collect(Collectors.toList()); - } - - // Create a list of assignment expressions for variable expr with value expr. - static List createAssignmentsForVarExprsWithValueExprs( - List variableExprs, List valueExprs) { - Preconditions.checkState( - variableExprs.size() == valueExprs.size(), - "Expected the number of method arguments to match the number of default values."); - return IntStream.range(0, variableExprs.size()) - .mapToObj( - i -> - AssignmentExpr.builder() - .setVariableExpr(variableExprs.get(i).toBuilder().setIsDecl(true).build()) - .setValueExpr(valueExprs.get(i)) - .build()) - .collect(Collectors.toList()); - } - - // Assign client variable expr with create client. - // e.g EchoClient echoClient = EchoClient.create() - static AssignmentExpr assignClientVariableWithCreateMethodExpr(VariableExpr clientVarExpr) { - return AssignmentExpr.builder() - .setVariableExpr(clientVarExpr.toBuilder().setIsDecl(true).build()) - .setValueExpr( - MethodInvocationExpr.builder() - .setStaticReferenceType(clientVarExpr.variable().type()) - .setReturnType(clientVarExpr.variable().type()) - .setMethodName("create") - .build()) - .build(); - } - - private static boolean isStringTypedResourceName( - MethodArgument arg, Map resourceNames) { - return arg.type().equals(TypeNode.STRING) - && arg.field().hasResourceReference() - && resourceNames.containsKey(arg.field().resourceReference().resourceTypeString()); - } - - static boolean isProtoEmptyType(TypeNode type) { - return type.reference().pakkage().equals("com.google.protobuf") - && type.reference().name().equals("Empty"); - } -} 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/SettingsSampleComposer.java similarity index 92% rename from src/main/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposer.java rename to src/main/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleComposer.java index 9c554b0be0..9027f50000 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/SettingsSampleComposer.java @@ -25,6 +25,8 @@ import com.google.api.generator.engine.ast.VaporReference; import com.google.api.generator.engine.ast.Variable; import com.google.api.generator.engine.ast.VariableExpr; +import com.google.api.generator.gapic.model.RegionTag; +import com.google.api.generator.gapic.model.Sample; import com.google.api.generator.gapic.utils.JavaStyle; import java.time.Duration; import java.util.Arrays; @@ -32,9 +34,9 @@ import java.util.Optional; import java.util.stream.Collectors; -public final class SettingsSampleCodeComposer { +public final class SettingsSampleComposer { - public static Optional composeSampleCode( + public static Optional composeSettingsSample( Optional methodNameOpt, String settingsClassName, TypeNode classType) { if (!methodNameOpt.isPresent()) { return Optional.empty(); @@ -76,6 +78,7 @@ public static Optional composeSampleCode( .setMethodName( JavaStyle.toLowerCamelCase(String.format("%sSettings", methodNameOpt.get()))) .build(); + String disambiguation = "Settings"; MethodInvocationExpr retrySettingsArgExpr = MethodInvocationExpr.builder() .setExprReferenceExpr(settingBuilderMethodInvocationExpr) @@ -121,6 +124,7 @@ public static Optional composeSampleCode( .setType(classType) .setName(JavaStyle.toLowerCamelCase(settingsClassName)) .build()); + AssignmentExpr settingBuildAssignmentExpr = AssignmentExpr.builder() .setVariableExpr(settingsVarExpr.toBuilder().setIsDecl(true).build()) @@ -140,6 +144,12 @@ public static Optional composeSampleCode( .stream() .map(e -> ExprStatement.withExpr(e)) .collect(Collectors.toList()); - return Optional.of(SampleCodeWriter.write(statements)); + + RegionTag regionTag = + RegionTag.builder() + .setServiceName(classType.reference().name()) + .setRpcName(methodNameOpt.get()) + .build(); + return Optional.of(Sample.builder().setBody(statements).setRegionTag(regionTag).build()); } } diff --git a/src/main/java/com/google/api/generator/gapic/model/GapicClass.java b/src/main/java/com/google/api/generator/gapic/model/GapicClass.java index 8ae0376efc..eee6349fa8 100644 --- a/src/main/java/com/google/api/generator/gapic/model/GapicClass.java +++ b/src/main/java/com/google/api/generator/gapic/model/GapicClass.java @@ -16,6 +16,8 @@ import com.google.api.generator.engine.ast.ClassDefinition; import com.google.auto.value.AutoValue; +import java.util.Collections; +import java.util.List; @AutoValue public abstract class GapicClass { @@ -31,12 +33,25 @@ public enum Kind { public abstract ClassDefinition classDefinition(); + public abstract List samples(); + public static GapicClass create(Kind kind, ClassDefinition classDefinition) { return builder().setKind(kind).setClassDefinition(classDefinition).build(); } + public static GapicClass create( + Kind kind, ClassDefinition classDefinition, List samples) { + return builder().setKind(kind).setClassDefinition(classDefinition).setSamples(samples).build(); + } + static Builder builder() { - return new AutoValue_GapicClass.Builder(); + return new AutoValue_GapicClass.Builder().setSamples(Collections.emptyList()); + } + + abstract Builder toBuilder(); + + public final GapicClass withSamples(List samples) { + return toBuilder().setSamples(samples).build(); } @AutoValue.Builder @@ -45,6 +60,8 @@ abstract static class Builder { abstract Builder setClassDefinition(ClassDefinition classDefinition); + abstract Builder setSamples(List samples); + abstract GapicClass build(); } } diff --git a/src/main/java/com/google/api/generator/gapic/model/RegionTag.java b/src/main/java/com/google/api/generator/gapic/model/RegionTag.java index cc740ec33e..a6292fe956 100644 --- a/src/main/java/com/google/api/generator/gapic/model/RegionTag.java +++ b/src/main/java/com/google/api/generator/gapic/model/RegionTag.java @@ -42,7 +42,7 @@ public static Builder builder() { .setIsAsynchronous(false); } - abstract RegionTag.Builder toBuilder(); + public abstract RegionTag.Builder toBuilder(); public final RegionTag withApiVersion(String apiVersion) { return toBuilder().setApiVersion(apiVersion).build(); diff --git a/src/main/java/com/google/api/generator/gapic/model/Sample.java b/src/main/java/com/google/api/generator/gapic/model/Sample.java index 5e5458a54d..b950294c56 100644 --- a/src/main/java/com/google/api/generator/gapic/model/Sample.java +++ b/src/main/java/com/google/api/generator/gapic/model/Sample.java @@ -33,20 +33,27 @@ public abstract class Sample { public abstract String name(); + public abstract boolean isCanonical(); + public static Builder builder() { return new AutoValue_Sample.Builder() .setBody(ImmutableList.of()) .setVariableAssignments(ImmutableList.of()) - .setFileHeader(ImmutableList.of()); + .setFileHeader(ImmutableList.of()) + .setIsCanonical(false); } - abstract Builder toBuilder(); + public abstract Builder toBuilder(); public final Sample withHeader(List header) { return toBuilder().setFileHeader(header).build(); } public final Sample withRegionTag(RegionTag regionTag) { + if (isCanonical() && !regionTag.overloadDisambiguation().isEmpty()) { + // don't set overload on canonical samples + withRegionTag(regionTag.withOverloadDisambiguation("")); + } return toBuilder() .setName(generateSampleClassName(regionTag())) .setRegionTag(regionTag) @@ -63,13 +70,21 @@ public abstract static class Builder { public abstract Builder setRegionTag(RegionTag regionTag); + public abstract Builder setIsCanonical(boolean isCanonical); + abstract Builder setName(String name); abstract Sample autoBuild(); abstract RegionTag regionTag(); + abstract boolean isCanonical(); + public final Sample build() { + if (isCanonical() && !regionTag().overloadDisambiguation().isEmpty()) { + // don't set overload on canonical samples + setRegionTag(regionTag().withOverloadDisambiguation("")); + } setName(generateSampleClassName(regionTag())); return autoBuild(); } @@ -80,4 +95,12 @@ private static String generateSampleClassName(RegionTag regionTag) { + regionTag.rpcName() + regionTag.overloadDisambiguation(); } + + public String generateSampleFileName() { + String name = (regionTag().isAsynchronous() ? "Async" : "Sync") + regionTag().rpcName(); + if (!regionTag().overloadDisambiguation().isEmpty()) { + name += "_" + regionTag().overloadDisambiguation(); + } + return name; + } } diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/GrpcServiceCallableFactoryClassComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/grpc/GrpcServiceCallableFactoryClassComposerTest.java index 3f90ae955f..7269d61140 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/GrpcServiceCallableFactoryClassComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/GrpcServiceCallableFactoryClassComposerTest.java @@ -14,14 +14,10 @@ package com.google.api.generator.gapic.composer.grpc; -import com.google.api.generator.engine.writer.JavaWriterVisitor; import com.google.api.generator.gapic.model.GapicClass; import com.google.api.generator.gapic.model.GapicContext; import com.google.api.generator.gapic.model.Service; import com.google.api.generator.test.framework.Assert; -import com.google.api.generator.test.framework.Utils; -import java.nio.file.Path; -import java.nio.file.Paths; import org.junit.Test; public class GrpcServiceCallableFactoryClassComposerTest { @@ -32,12 +28,8 @@ public void generateServiceClasses() { GapicClass clazz = GrpcServiceCallableFactoryClassComposer.instance().generate(context, echoProtoService); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "GrpcEchoCallableFactory.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "GrpcEchoCallableFactory.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, "GrpcEchoCallableFactory.golden"); + Assert.assertEmptySamples(clazz.samples()); } @Test @@ -47,13 +39,7 @@ public void generateServiceClasses_deprecated() { GapicClass clazz = GrpcServiceCallableFactoryClassComposer.instance().generate(context, protoService); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile( - this.getClass(), "GrpcDeprecatedServiceCallableFactory.golden", visitor.write()); - Path goldenFilePath = - Paths.get( - Utils.getGoldenDir(this.getClass()), "GrpcDeprecatedServiceCallableFactory.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, "GrpcDeprecatedServiceCallableFactory.golden"); + Assert.assertEmptySamples(clazz.samples()); } } diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/GrpcServiceStubClassComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/grpc/GrpcServiceStubClassComposerTest.java index e26d8696e8..f41143acbe 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/GrpcServiceStubClassComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/GrpcServiceStubClassComposerTest.java @@ -14,14 +14,10 @@ package com.google.api.generator.gapic.composer.grpc; -import com.google.api.generator.engine.writer.JavaWriterVisitor; import com.google.api.generator.gapic.model.GapicClass; import com.google.api.generator.gapic.model.GapicContext; import com.google.api.generator.gapic.model.Service; import com.google.api.generator.test.framework.Assert; -import com.google.api.generator.test.framework.Utils; -import java.nio.file.Path; -import java.nio.file.Paths; import org.junit.Test; public class GrpcServiceStubClassComposerTest { @@ -31,11 +27,8 @@ public void generateGrpcServiceStubClass_simple() { Service echoProtoService = context.services().get(0); GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, echoProtoService); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "GrpcEchoStub.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "GrpcEchoStub.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, "GrpcEchoStub.golden"); + Assert.assertEmptySamples(clazz.samples()); } @Test @@ -44,12 +37,8 @@ public void generateGrpcServiceStubClass_deprecated() { Service protoService = context.services().get(0); GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, protoService); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "GrpcDeprecatedServiceStub.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "GrpcDeprecatedServiceStub.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, "GrpcDeprecatedServiceStub.golden"); + Assert.assertEmptySamples(clazz.samples()); } @Test @@ -58,11 +47,8 @@ public void generateGrpcServiceStubClass_httpBindings() { Service service = context.services().get(0); GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, service); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "GrpcTestingStub.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "GrpcTestingStub.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, "GrpcTestingStub.golden"); + Assert.assertEmptySamples(clazz.samples()); } @Test @@ -72,12 +58,8 @@ public void generateGrpcServiceStubClass_routingHeaders() { Service service = context.services().get(0); GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, service); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "GrpcRoutingHeadersStub.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "GrpcRoutingHeadersStub.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, "GrpcRoutingHeadersStub.golden"); + Assert.assertEmptySamples(clazz.samples()); } @Test @@ -86,12 +68,8 @@ public void generateGrpcServiceStubClass_httpBindingsWithSubMessageFields() { Service service = context.services().get(0); GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, service); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "GrpcPublisherStub.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "GrpcPublisherStub.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, "GrpcPublisherStub.golden"); + Assert.assertEmptySamples(clazz.samples()); } @Test @@ -100,10 +78,7 @@ public void generateGrpcServiceStubClass_createBatchingCallable() { Service service = context.services().get(0); GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, service); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "GrpcLoggingStub.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "GrpcLoggingStub.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, "GrpcLoggingStub.golden"); + Assert.assertEmptySamples(clazz.samples()); } } diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/MockServiceClassComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/grpc/MockServiceClassComposerTest.java index b8f17b5934..7762c6a4df 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/MockServiceClassComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/MockServiceClassComposerTest.java @@ -14,41 +14,38 @@ package com.google.api.generator.gapic.composer.grpc; -import com.google.api.generator.engine.writer.JavaWriterVisitor; import com.google.api.generator.gapic.model.GapicClass; import com.google.api.generator.gapic.model.GapicContext; import com.google.api.generator.gapic.model.Service; import com.google.api.generator.test.framework.Assert; -import com.google.api.generator.test.framework.Utils; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Collection; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +@RunWith(Parameterized.class) public class MockServiceClassComposerTest { - @Test - public void generateServiceClasses() { - GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseEcho(); - Service echoProtoService = context.services().get(0); - GapicClass clazz = MockServiceClassComposer.instance().generate(context, echoProtoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "MockEcho.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "MockEcho.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList( + new Object[][] { + {"MockEcho", GrpcTestProtoLoader.instance().parseShowcaseEcho()}, + {"MockDeprecatedService", GrpcTestProtoLoader.instance().parseDeprecatedService()} + }); } + @Parameterized.Parameter public String name; + + @Parameterized.Parameter(1) + public GapicContext context; + @Test - public void generateServiceClasses_deprecated() { - GapicContext context = GrpcTestProtoLoader.instance().parseDeprecatedService(); - Service protoService = context.services().get(0); - GapicClass clazz = MockServiceClassComposer.instance().generate(context, protoService); + public void generateMockServiceClasses() { + Service service = context.services().get(0); + GapicClass clazz = MockServiceClassComposer.instance().generate(context, service); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "MockDeprecatedService.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "MockDeprecatedService.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden"); + Assert.assertEmptySamples(clazz.samples()); } } diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/MockServiceImplClassComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/grpc/MockServiceImplClassComposerTest.java index 854d0772dd..aa062279ec 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/MockServiceImplClassComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/MockServiceImplClassComposerTest.java @@ -14,41 +14,38 @@ package com.google.api.generator.gapic.composer.grpc; -import com.google.api.generator.engine.writer.JavaWriterVisitor; import com.google.api.generator.gapic.model.GapicClass; import com.google.api.generator.gapic.model.GapicContext; import com.google.api.generator.gapic.model.Service; import com.google.api.generator.test.framework.Assert; -import com.google.api.generator.test.framework.Utils; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Collection; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +@RunWith(Parameterized.class) public class MockServiceImplClassComposerTest { - @Test - public void generateServiceClasses() { - GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseEcho(); - Service echoProtoService = context.services().get(0); - GapicClass clazz = MockServiceImplClassComposer.instance().generate(context, echoProtoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "MockEchoImpl.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "MockEchoImpl.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList( + new Object[][] { + {"MockEchoImpl", GrpcTestProtoLoader.instance().parseShowcaseEcho()}, + {"MockDeprecatedServiceImpl", GrpcTestProtoLoader.instance().parseDeprecatedService()} + }); } + @Parameterized.Parameter public String name; + + @Parameterized.Parameter(1) + public GapicContext context; + @Test - public void generateServiceClasses_deprecated() { - GapicContext context = GrpcTestProtoLoader.instance().parseDeprecatedService(); - Service protoService = context.services().get(0); - GapicClass clazz = MockServiceImplClassComposer.instance().generate(context, protoService); + public void generateMockServiceImplClasses() { + Service service = context.services().get(0); + GapicClass clazz = MockServiceImplClassComposer.instance().generate(context, service); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "MockDeprecatedServiceImpl.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "MockDeprecatedServiceImpl.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden"); + Assert.assertEmptySamples(clazz.samples()); } } diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientClassComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientClassComposerTest.java index 46134ebff8..fe00c3ca04 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientClassComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientClassComposerTest.java @@ -14,81 +14,42 @@ package com.google.api.generator.gapic.composer.grpc; -import static com.google.api.generator.test.framework.Assert.assertCodeEquals; - -import com.google.api.generator.engine.writer.JavaWriterVisitor; import com.google.api.generator.gapic.model.GapicClass; import com.google.api.generator.gapic.model.GapicContext; import com.google.api.generator.gapic.model.Service; -import com.google.api.generator.test.framework.Utils; -import java.nio.file.Path; -import java.nio.file.Paths; +import com.google.api.generator.test.framework.Assert; +import java.util.Arrays; +import java.util.Collection; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +@RunWith(Parameterized.class) public class ServiceClientClassComposerTest { - @Test - public void generateServiceClasses() { - GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseEcho(); - Service echoProtoService = context.services().get(0); - GapicClass clazz = ServiceClientClassComposer.instance().generate(context, echoProtoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "EchoClient.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "EchoClient.golden"); - assertCodeEquals(goldenFilePath, visitor.write()); + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList( + new Object[][] { + {"EchoClient", GrpcTestProtoLoader.instance().parseShowcaseEcho()}, + {"DeprecatedServiceClient", GrpcTestProtoLoader.instance().parseDeprecatedService()}, + {"IdentityClient", GrpcTestProtoLoader.instance().parseShowcaseIdentity()}, + {"BookshopClient", GrpcTestProtoLoader.instance().parseBookshopService()}, + {"MessagingClient", GrpcTestProtoLoader.instance().parseShowcaseMessaging()}, + }); } - @Test - public void generateServiceClasses_deprecated() { - GapicContext context = GrpcTestProtoLoader.instance().parseDeprecatedService(); - Service protoService = context.services().get(0); - GapicClass clazz = ServiceClientClassComposer.instance().generate(context, protoService); + @Parameterized.Parameter public String name; - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "DeprecatedServiceClient.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "DeprecatedServiceClient.golden"); - assertCodeEquals(goldenFilePath, visitor.write()); - } - - @Test - public void generateServiceClasses_methodSignatureHasNestedFields() { - GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseIdentity(); - Service protoService = context.services().get(0); - GapicClass clazz = ServiceClientClassComposer.instance().generate(context, protoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "IdentityClient.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "IdentityClient.golden"); - assertCodeEquals(goldenFilePath, visitor.write()); - } - - @Test - public void generateServiceClasses_bookshopNameConflicts() { - GapicContext context = GrpcTestProtoLoader.instance().parseBookshopService(); - Service protoService = context.services().get(0); - GapicClass clazz = ServiceClientClassComposer.instance().generate(context, protoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "BookshopClient.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "BookshopClient.golden"); - assertCodeEquals(goldenFilePath, visitor.write()); - } + @Parameterized.Parameter(1) + public GapicContext context; @Test - public void generateServiceClasses_childTypeParentInJavadoc() { - GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseMessaging(); - Service protoService = context.services().get(0); - GapicClass clazz = ServiceClientClassComposer.instance().generate(context, protoService); + public void generateServiceClientClasses() { + Service service = context.services().get(0); + GapicClass clazz = ServiceClientClassComposer.instance().generate(context, service); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "MessagingClient.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "MessagingClient.golden"); - assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden"); + Assert.assertGoldenSamples( + this.getClass(), name, clazz.classDefinition().packageString(), clazz.samples()); } } diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientTestClassComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientTestClassComposerTest.java index 9874286d82..0eca4e060d 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientTestClassComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientTestClassComposerTest.java @@ -14,89 +14,49 @@ package com.google.api.generator.gapic.composer.grpc; -import static com.google.api.generator.test.framework.Assert.assertCodeEquals; -import static org.junit.Assert.assertEquals; - -import com.google.api.generator.engine.writer.JavaWriterVisitor; import com.google.api.generator.gapic.model.GapicClass; import com.google.api.generator.gapic.model.GapicContext; import com.google.api.generator.gapic.model.Service; -import com.google.api.generator.test.framework.Utils; -import java.nio.file.Path; -import java.nio.file.Paths; +import com.google.api.generator.test.framework.Assert; +import java.util.Arrays; +import java.util.Collection; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +@RunWith(Parameterized.class) public class ServiceClientTestClassComposerTest { - @Test - public void generateClientTest_echoClient() { - GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseEcho(); - Service echoProtoService = context.services().get(0); - GapicClass clazz = - ServiceClientTestClassComposer.instance().generate(context, echoProtoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "EchoClientTest.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "EchoClientTest.golden"); - assertCodeEquals(goldenFilePath, visitor.write()); + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList( + new Object[][] { + {"EchoClientTest", GrpcTestProtoLoader.instance().parseShowcaseEcho(), 0}, + { + "DeprecatedServiceClientTest", + GrpcTestProtoLoader.instance().parseDeprecatedService(), + 0 + }, + {"TestingClientTest", GrpcTestProtoLoader.instance().parseShowcaseTesting(), 0}, + {"SubscriberClientTest", GrpcTestProtoLoader.instance().parsePubSubPublisher(), 1}, + {"LoggingClientTest", GrpcTestProtoLoader.instance().parseLogging(), 0}, + }); } - @Test - public void generateClientTest_deprecatedServiceClient() { - GapicContext context = GrpcTestProtoLoader.instance().parseDeprecatedService(); - Service protoService = context.services().get(0); - GapicClass clazz = ServiceClientTestClassComposer.instance().generate(context, protoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "DeprecatedServiceClientTest.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "DeprecatedServiceClientTest.golden"); - assertCodeEquals(goldenFilePath, visitor.write()); - } + @Parameterized.Parameter public String name; - @Test - public void generateClientTest_testingClientResnameWithOnePatternWithNonSlashSepNames() { - GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseTesting(); - Service testingProtoService = context.services().get(0); - GapicClass clazz = - ServiceClientTestClassComposer.instance().generate(context, testingProtoService); + @Parameterized.Parameter(1) + public GapicContext context; - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "TestingClientTest.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "TestingClientTest.golden"); - assertCodeEquals(goldenFilePath, visitor.write()); - } + @Parameterized.Parameter(2) + public int serviceIndex; @Test - public void generateClientTest_pubSubPublisherClient() { - GapicContext context = GrpcTestProtoLoader.instance().parsePubSubPublisher(); - Service subscriptionService = context.services().get(1); - assertEquals("Subscriber", subscriptionService.name()); + public void generateServiceClientTestClasses() { + Service echoProtoService = context.services().get(serviceIndex); GapicClass clazz = - ServiceClientTestClassComposer.instance().generate(context, subscriptionService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "SubscriberClientTest.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "SubscriberClientTest.golden"); - assertCodeEquals(goldenFilePath, visitor.write()); - } - - @Test - public void generateClientTest_logging() { - GapicContext context = GrpcTestProtoLoader.instance().parseLogging(); - Service loggingService = context.services().get(0); - GapicClass clazz = ServiceClientTestClassComposer.instance().generate(context, loggingService); + ServiceClientTestClassComposer.instance().generate(context, echoProtoService); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "LoggingClientTest.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "LoggingClientTest.golden"); - assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden"); + Assert.assertEmptySamples(clazz.samples()); } } diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceSettingsClassComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceSettingsClassComposerTest.java index 622cf85f9c..5857ef3352 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceSettingsClassComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceSettingsClassComposerTest.java @@ -14,41 +14,43 @@ package com.google.api.generator.gapic.composer.grpc; -import com.google.api.generator.engine.writer.JavaWriterVisitor; +import com.google.api.generator.gapic.composer.common.TestProtoLoader; import com.google.api.generator.gapic.model.GapicClass; import com.google.api.generator.gapic.model.GapicContext; import com.google.api.generator.gapic.model.Service; import com.google.api.generator.test.framework.Assert; -import com.google.api.generator.test.framework.Utils; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Collection; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +@RunWith(Parameterized.class) public class ServiceSettingsClassComposerTest { - @Test - public void generateServiceClasses() { - GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseEcho(); - Service echoProtoService = context.services().get(0); - GapicClass clazz = ServiceSettingsClassComposer.instance().generate(context, echoProtoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "EchoSettings.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "EchoSettings.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList( + new Object[][] { + {"EchoSettings", TestProtoLoader.instance().parseShowcaseEcho()}, + {"DeprecatedServiceSettings", TestProtoLoader.instance().parseDeprecatedService()} + }); } + @Parameterized.Parameter public String name; + + @Parameterized.Parameter(1) + public GapicContext context; + @Test - public void generateServiceClasses_deprecated() { - GapicContext context = GrpcTestProtoLoader.instance().parseDeprecatedService(); - Service protoService = context.services().get(0); - GapicClass clazz = ServiceSettingsClassComposer.instance().generate(context, protoService); + public void generateServiceSettingsClasses() { + Service service = context.services().get(0); + GapicClass clazz = ServiceSettingsClassComposer.instance().generate(context, service); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "DeprecatedServiceSettings.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "DeprecatedServiceSettings.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden"); + Assert.assertGoldenSamples( + this.getClass(), + "servicesettings", + clazz.classDefinition().packageString(), + clazz.samples()); } } diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceStubClassComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceStubClassComposerTest.java index bb411b9ad3..bb0619d315 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceStubClassComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceStubClassComposerTest.java @@ -14,42 +14,39 @@ package com.google.api.generator.gapic.composer.grpc; -import com.google.api.generator.engine.writer.JavaWriterVisitor; import com.google.api.generator.gapic.composer.common.TestProtoLoader; import com.google.api.generator.gapic.model.GapicClass; import com.google.api.generator.gapic.model.GapicContext; import com.google.api.generator.gapic.model.Service; import com.google.api.generator.test.framework.Assert; -import com.google.api.generator.test.framework.Utils; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Collection; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +@RunWith(Parameterized.class) public class ServiceStubClassComposerTest { - @Test - public void generateServiceClasses() { - GapicContext context = TestProtoLoader.instance().parseShowcaseEcho(); - Service echoProtoService = context.services().get(0); - GapicClass clazz = ServiceStubClassComposer.instance().generate(context, echoProtoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "EchoStub.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "EchoStub.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList( + new Object[][] { + {"EchoStub", TestProtoLoader.instance().parseShowcaseEcho()}, + {"DeprecatedServiceStub", TestProtoLoader.instance().parseDeprecatedService()} + }); } + @Parameterized.Parameter public String name; + + @Parameterized.Parameter(1) + public GapicContext context; + @Test - public void generateServiceClasses_deprecated() { - GapicContext context = TestProtoLoader.instance().parseDeprecatedService(); - Service protoService = context.services().get(0); - GapicClass clazz = ServiceStubClassComposer.instance().generate(context, protoService); + public void generateServiceStubClasses() { + Service service = context.services().get(0); + GapicClass clazz = ServiceStubClassComposer.instance().generate(context, service); - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "DeprecatedServiceStub.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "DeprecatedServiceStub.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden"); + Assert.assertEmptySamples(clazz.samples()); } } diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceStubSettingsClassComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceStubSettingsClassComposerTest.java index 468c2d8219..9a63099d7d 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceStubSettingsClassComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceStubSettingsClassComposerTest.java @@ -14,75 +14,44 @@ package com.google.api.generator.gapic.composer.grpc; -import static org.junit.Assert.assertEquals; - -import com.google.api.generator.engine.writer.JavaWriterVisitor; import com.google.api.generator.gapic.model.GapicClass; import com.google.api.generator.gapic.model.GapicContext; import com.google.api.generator.gapic.model.Service; import com.google.api.generator.test.framework.Assert; -import com.google.api.generator.test.framework.Utils; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Collection; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +@RunWith(Parameterized.class) public class ServiceStubSettingsClassComposerTest { - @Test - public void generateServiceStubSettingsClasses_batchingWithEmptyResponses() { - GapicContext context = GrpcTestProtoLoader.instance().parseLogging(); - Service protoService = context.services().get(0); - GapicClass clazz = ServiceStubSettingsClassComposer.instance().generate(context, protoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile( - this.getClass(), "LoggingServiceV2StubSettings.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "LoggingServiceV2StubSettings.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); - } - - @Test - public void generateServiceStubSettingsClasses_batchingWithNonemptyResponses() { - GapicContext context = GrpcTestProtoLoader.instance().parsePubSubPublisher(); - Service protoService = context.services().get(0); - assertEquals("Publisher", protoService.name()); - GapicClass clazz = ServiceStubSettingsClassComposer.instance().generate(context, protoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "PublisherStubSettings.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "PublisherStubSettings.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList( + new Object[][] { + {"LoggingServiceV2StubSettings", GrpcTestProtoLoader.instance().parseLogging()}, + {"PublisherStubSettings", GrpcTestProtoLoader.instance().parsePubSubPublisher()}, + {"EchoStubSettings", GrpcTestProtoLoader.instance().parseShowcaseEcho()}, + {"DeprecatedServiceStubSettings", GrpcTestProtoLoader.instance().parseDeprecatedService()} + }); } - @Test - public void generateServiceStubSettingsClasses_basic() { - GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseEcho(); - Service echoProtoService = context.services().get(0); - GapicClass clazz = - ServiceStubSettingsClassComposer.instance().generate(context, echoProtoService); + @Parameterized.Parameter public String name; - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile(this.getClass(), "EchoStubSettings.golden", visitor.write()); - Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "EchoStubSettings.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); - } + @Parameterized.Parameter(1) + public GapicContext context; @Test - public void generateServiceStubSettingsClasses_deprecated() { - GapicContext context = GrpcTestProtoLoader.instance().parseDeprecatedService(); - Service protoService = context.services().get(0); - GapicClass clazz = ServiceStubSettingsClassComposer.instance().generate(context, protoService); - - JavaWriterVisitor visitor = new JavaWriterVisitor(); - clazz.classDefinition().accept(visitor); - Utils.saveCodegenToFile( - this.getClass(), "DeprecatedServiceStubSettings.golden", visitor.write()); - Path goldenFilePath = - Paths.get(Utils.getGoldenDir(this.getClass()), "DeprecatedServiceStubSettings.golden"); - Assert.assertCodeEquals(goldenFilePath, visitor.write()); + public void generateServiceStubSettingsClasses() { + Service service = context.services().get(0); + GapicClass clazz = ServiceStubSettingsClassComposer.instance().generate(context, service); + + Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden"); + Assert.assertGoldenSamples( + this.getClass(), + "servicesettings/stub", + clazz.classDefinition().packageString(), + clazz.samples()); } } 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..70c66dc794 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,6 +16,8 @@ import javax.annotation.Generated; * that map to API methods. Sample code to get started: * *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (BookshopClient bookshopClient = BookshopClient.create()) {
  *   int booksCount = 1618425911;
  *   List books = new ArrayList<>();
@@ -52,6 +54,8 @@ import javax.annotation.Generated;
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * BookshopSettings bookshopSettings =
  *     BookshopSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -62,6 +66,8 @@ import javax.annotation.Generated;
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * BookshopSettings bookshopSettings =
  *     BookshopSettings.newBuilder().setEndpoint(myEndpoint).build();
  * BookshopClient bookshopClient = BookshopClient.create(bookshopSettings);
@@ -126,6 +132,8 @@ public class BookshopClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BookshopClient bookshopClient = BookshopClient.create()) {
    *   int booksCount = 1618425911;
    *   List books = new ArrayList<>();
@@ -148,6 +156,8 @@ public class BookshopClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BookshopClient bookshopClient = BookshopClient.create()) {
    *   String booksList = "booksList2-1119589686";
    *   List books = new ArrayList<>();
@@ -170,6 +180,8 @@ public class BookshopClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BookshopClient bookshopClient = BookshopClient.create()) {
    *   GetBookRequest request =
    *       GetBookRequest.newBuilder()
@@ -193,6 +205,8 @@ public class BookshopClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * 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 9af83eb743..4e5cbaad3f 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,6 +16,8 @@ import javax.annotation.Generated;
  * that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
  *   FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
  *   deprecatedServiceClient.fastFibonacci(request);
@@ -52,6 +54,8 @@ import javax.annotation.Generated;
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * DeprecatedServiceSettings deprecatedServiceSettings =
  *     DeprecatedServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -63,6 +67,8 @@ import javax.annotation.Generated;
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * DeprecatedServiceSettings deprecatedServiceSettings =
  *     DeprecatedServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  * DeprecatedServiceClient deprecatedServiceClient =
@@ -132,6 +138,8 @@ public class DeprecatedServiceClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
    *   FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
    *   deprecatedServiceClient.fastFibonacci(request);
@@ -150,6 +158,8 @@ public class DeprecatedServiceClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
    *   FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
    *   ApiFuture future = deprecatedServiceClient.fastFibonacciCallable().futureCall(request);
@@ -167,6 +177,8 @@ public class DeprecatedServiceClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
    *   FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
    *   deprecatedServiceClient.slowFibonacci(request);
@@ -187,6 +199,8 @@ public class DeprecatedServiceClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * 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 5e61122577..4d71e3f312 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,6 +35,8 @@ import javax.annotation.Generated;
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * 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 899b03bbce..8ace8d9fde 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,6 +44,8 @@ import org.threeten.bp.Duration;
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * 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 3e6735f6bd..e7d55114c3 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,6 +34,8 @@ import javax.annotation.Generated;
  * that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (EchoClient echoClient = EchoClient.create()) {
  *   EchoResponse response = echoClient.echo();
  * }
@@ -68,6 +70,8 @@ import javax.annotation.Generated;
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * EchoSettings echoSettings =
  *     EchoSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -78,6 +82,8 @@ import javax.annotation.Generated;
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();
  * EchoClient echoClient = EchoClient.create(echoSettings);
  * }
@@ -152,6 +158,8 @@ public class EchoClient implements BackgroundResource { * Sample code: * *
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   EchoResponse response = echoClient.echo();
    * }
@@ -170,6 +178,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   ResourceName parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
    *   EchoResponse response = echoClient.echo(parent);
@@ -190,6 +200,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   Status error = Status.newBuilder().build();
    *   EchoResponse response = echoClient.echo(error);
@@ -209,6 +221,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   FoobarName name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
    *   EchoResponse response = echoClient.echo(name);
@@ -229,6 +243,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   String content = "content951530617";
    *   EchoResponse response = echoClient.echo(content);
@@ -248,6 +264,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   String name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
    *   EchoResponse response = echoClient.echo(name);
@@ -267,6 +285,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   String parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
    *   EchoResponse response = echoClient.echo(parent);
@@ -286,6 +306,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   String content = "content951530617";
    *   Severity severity = Severity.forNumber(0);
@@ -308,6 +330,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   EchoRequest request =
    *       EchoRequest.newBuilder()
@@ -332,6 +356,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   EchoRequest request =
    *       EchoRequest.newBuilder()
@@ -355,6 +381,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   ExpandRequest request =
    *       ExpandRequest.newBuilder().setContent("content951530617").setInfo("info3237038").build();
@@ -374,6 +402,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   ApiStreamObserver responseObserver =
    *       new ApiStreamObserver() {
@@ -414,6 +444,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   BidiStream bidiStream = echoClient.chatCallable().call();
    *   EchoRequest request =
@@ -439,6 +471,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   BidiStream bidiStream = echoClient.chatAgainCallable().call();
    *   EchoRequest request =
@@ -464,6 +498,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   PagedExpandRequest request =
    *       PagedExpandRequest.newBuilder()
@@ -489,6 +525,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   PagedExpandRequest request =
    *       PagedExpandRequest.newBuilder()
@@ -514,6 +552,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   PagedExpandRequest request =
    *       PagedExpandRequest.newBuilder()
@@ -545,6 +585,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   for (EchoResponse element : echoClient.simplePagedExpand().iterateAll()) {
    *     // doThingsWith(element);
@@ -565,6 +607,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   PagedExpandRequest request =
    *       PagedExpandRequest.newBuilder()
@@ -590,6 +634,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   PagedExpandRequest request =
    *       PagedExpandRequest.newBuilder()
@@ -616,6 +662,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   PagedExpandRequest request =
    *       PagedExpandRequest.newBuilder()
@@ -647,6 +695,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   Duration ttl = Duration.newBuilder().build();
    *   WaitResponse response = echoClient.waitAsync(ttl).get();
@@ -666,6 +716,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   Timestamp endTime = Timestamp.newBuilder().build();
    *   WaitResponse response = echoClient.waitAsync(endTime).get();
@@ -685,6 +737,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   WaitRequest request = WaitRequest.newBuilder().build();
    *   WaitResponse response = echoClient.waitAsync(request).get();
@@ -703,6 +757,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   WaitRequest request = WaitRequest.newBuilder().build();
    *   OperationFuture future =
@@ -721,6 +777,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   WaitRequest request = WaitRequest.newBuilder().build();
    *   ApiFuture future = echoClient.waitCallable().futureCall(request);
@@ -738,6 +796,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   BlockRequest request = BlockRequest.newBuilder().build();
    *   BlockResponse response = echoClient.block(request);
@@ -756,6 +816,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   BlockRequest request = BlockRequest.newBuilder().build();
    *   ApiFuture future = echoClient.blockCallable().futureCall(request);
@@ -773,6 +835,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (EchoClient echoClient = EchoClient.create()) {
    *   EchoRequest request =
    *       EchoRequest.newBuilder()
@@ -797,6 +861,8 @@ public class EchoClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * 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 e88ba04676..09fc6298a2 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,6 +42,8 @@ import javax.annotation.Generated;
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * 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 2006b2a30d..1bef1dc27e 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,6 +70,8 @@ import org.threeten.bp.Duration;
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * 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 235c0055b6..36a0848d94 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,6 +24,8 @@ import javax.annotation.Generated;
  * that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (IdentityClient identityClient = IdentityClient.create()) {
  *   String parent = UserName.of("[USER]").toString();
  *   String displayName = "displayName1714148973";
@@ -61,6 +63,8 @@ import javax.annotation.Generated;
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * IdentitySettings identitySettings =
  *     IdentitySettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -71,6 +75,8 @@ import javax.annotation.Generated;
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * IdentitySettings identitySettings =
  *     IdentitySettings.newBuilder().setEndpoint(myEndpoint).build();
  * IdentityClient identityClient = IdentityClient.create(identitySettings);
@@ -135,6 +141,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   String parent = UserName.of("[USER]").toString();
    *   String displayName = "displayName1714148973";
@@ -162,6 +170,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   String parent = UserName.of("[USER]").toString();
    *   String displayName = "displayName1714148973";
@@ -214,6 +224,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   String parent = UserName.of("[USER]").toString();
    *   String displayName = "displayName1714148973";
@@ -299,6 +311,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   CreateUserRequest request =
    *       CreateUserRequest.newBuilder()
@@ -321,6 +335,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   CreateUserRequest request =
    *       CreateUserRequest.newBuilder()
@@ -342,6 +358,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   UserName name = UserName.of("[USER]");
    *   User response = identityClient.getUser(name);
@@ -362,6 +380,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   String name = UserName.of("[USER]").toString();
    *   User response = identityClient.getUser(name);
@@ -381,6 +401,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   GetUserRequest request =
    *       GetUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
@@ -400,6 +422,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   GetUserRequest request =
    *       GetUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
@@ -418,6 +442,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   UpdateUserRequest request =
    *       UpdateUserRequest.newBuilder().setUser(User.newBuilder().build()).build();
@@ -437,6 +463,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   UpdateUserRequest request =
    *       UpdateUserRequest.newBuilder().setUser(User.newBuilder().build()).build();
@@ -455,6 +483,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   UserName name = UserName.of("[USER]");
    *   identityClient.deleteUser(name);
@@ -475,6 +505,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   String name = UserName.of("[USER]").toString();
    *   identityClient.deleteUser(name);
@@ -494,6 +526,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   DeleteUserRequest request =
    *       DeleteUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
@@ -513,6 +547,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   DeleteUserRequest request =
    *       DeleteUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
@@ -531,6 +567,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   ListUsersRequest request =
    *       ListUsersRequest.newBuilder()
@@ -555,6 +593,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IdentityClient identityClient = IdentityClient.create()) {
    *   ListUsersRequest request =
    *       ListUsersRequest.newBuilder()
@@ -578,6 +618,8 @@ public class IdentityClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * 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 cc308eb5de..c19e424304 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,6 +77,8 @@ import org.threeten.bp.Duration;
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * 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 e881597fde..d6e3b7da73 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,6 +32,8 @@ import javax.annotation.Generated;
  * that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (MessagingClient messagingClient = MessagingClient.create()) {
  *   String displayName = "displayName1714148973";
  *   String description = "description-1724546052";
@@ -68,6 +70,8 @@ import javax.annotation.Generated;
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * MessagingSettings messagingSettings =
  *     MessagingSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -78,6 +82,8 @@ import javax.annotation.Generated;
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * MessagingSettings messagingSettings =
  *     MessagingSettings.newBuilder().setEndpoint(myEndpoint).build();
  * MessagingClient messagingClient = MessagingClient.create(messagingSettings);
@@ -153,6 +159,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   String displayName = "displayName1714148973";
    *   String description = "description-1724546052";
@@ -178,6 +186,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   CreateRoomRequest request =
    *       CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
@@ -197,6 +207,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   CreateRoomRequest request =
    *       CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
@@ -215,6 +227,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   RoomName name = RoomName.of("[ROOM]");
    *   Room response = messagingClient.getRoom(name);
@@ -235,6 +249,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   String name = RoomName.of("[ROOM]").toString();
    *   Room response = messagingClient.getRoom(name);
@@ -254,6 +270,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   GetRoomRequest request =
    *       GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
@@ -273,6 +291,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   GetRoomRequest request =
    *       GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
@@ -291,6 +311,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   UpdateRoomRequest request =
    *       UpdateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
@@ -310,6 +332,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   UpdateRoomRequest request =
    *       UpdateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
@@ -328,6 +352,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   RoomName name = RoomName.of("[ROOM]");
    *   messagingClient.deleteRoom(name);
@@ -348,6 +374,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   String name = RoomName.of("[ROOM]").toString();
    *   messagingClient.deleteRoom(name);
@@ -367,6 +395,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   DeleteRoomRequest request =
    *       DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
@@ -386,6 +416,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   DeleteRoomRequest request =
    *       DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
@@ -404,6 +436,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   ListRoomsRequest request =
    *       ListRoomsRequest.newBuilder()
@@ -428,6 +462,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   ListRoomsRequest request =
    *       ListRoomsRequest.newBuilder()
@@ -451,6 +487,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   ListRoomsRequest request =
    *       ListRoomsRequest.newBuilder()
@@ -481,6 +519,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   ProfileName parent = ProfileName.of("[USER]");
    *   ByteString image = ByteString.EMPTY;
@@ -506,6 +546,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   ProfileName parent = ProfileName.of("[USER]");
    *   String text = "text3556653";
@@ -531,6 +573,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   RoomName parent = RoomName.of("[ROOM]");
    *   ByteString image = ByteString.EMPTY;
@@ -556,6 +600,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   RoomName parent = RoomName.of("[ROOM]");
    *   String text = "text3556653";
@@ -581,6 +627,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   String parent = ProfileName.of("[USER]").toString();
    *   ByteString image = ByteString.EMPTY;
@@ -606,6 +654,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   String parent = ProfileName.of("[USER]").toString();
    *   String text = "text3556653";
@@ -631,6 +681,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   CreateBlurbRequest request =
    *       CreateBlurbRequest.newBuilder()
@@ -653,6 +705,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   CreateBlurbRequest request =
    *       CreateBlurbRequest.newBuilder()
@@ -674,6 +728,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   BlurbName name = BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]");
    *   Blurb response = messagingClient.getBlurb(name);
@@ -694,6 +750,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   String name =
    *       BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
@@ -714,6 +772,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   GetBlurbRequest request =
    *       GetBlurbRequest.newBuilder()
@@ -737,6 +797,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   GetBlurbRequest request =
    *       GetBlurbRequest.newBuilder()
@@ -759,6 +821,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   UpdateBlurbRequest request =
    *       UpdateBlurbRequest.newBuilder().setBlurb(Blurb.newBuilder().build()).build();
@@ -778,6 +842,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   UpdateBlurbRequest request =
    *       UpdateBlurbRequest.newBuilder().setBlurb(Blurb.newBuilder().build()).build();
@@ -796,6 +862,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   BlurbName name = BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]");
    *   messagingClient.deleteBlurb(name);
@@ -816,6 +884,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   String name =
    *       BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
@@ -836,6 +906,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   DeleteBlurbRequest request =
    *       DeleteBlurbRequest.newBuilder()
@@ -859,6 +931,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   DeleteBlurbRequest request =
    *       DeleteBlurbRequest.newBuilder()
@@ -881,6 +955,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   ProfileName parent = ProfileName.of("[USER]");
    *   for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
@@ -903,6 +979,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   RoomName parent = RoomName.of("[ROOM]");
    *   for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
@@ -925,6 +1003,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   String parent = ProfileName.of("[USER]").toString();
    *   for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
@@ -946,6 +1026,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   ListBlurbsRequest request =
    *       ListBlurbsRequest.newBuilder()
@@ -971,6 +1053,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   ListBlurbsRequest request =
    *       ListBlurbsRequest.newBuilder()
@@ -995,6 +1079,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   ListBlurbsRequest request =
    *       ListBlurbsRequest.newBuilder()
@@ -1026,6 +1112,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   String query = "query107944136";
    *   SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(query).get();
@@ -1046,6 +1134,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   SearchBlurbsRequest request =
    *       SearchBlurbsRequest.newBuilder()
@@ -1071,6 +1161,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   SearchBlurbsRequest request =
    *       SearchBlurbsRequest.newBuilder()
@@ -1096,6 +1188,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   SearchBlurbsRequest request =
    *       SearchBlurbsRequest.newBuilder()
@@ -1119,6 +1213,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   StreamBlurbsRequest request =
    *       StreamBlurbsRequest.newBuilder().setName(ProfileName.of("[USER]").toString()).build();
@@ -1140,6 +1236,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MessagingClient messagingClient = MessagingClient.create()) {
    *   ApiStreamObserver responseObserver =
    *       new ApiStreamObserver() {
@@ -1179,6 +1277,8 @@ public class MessagingClient implements BackgroundResource {
    * Sample code:
    *
    * 
{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * 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 d050f8a921..2c13fc0f02 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,6 +78,8 @@ import org.threeten.bp.Duration;
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * PublisherStubSettings.Builder publisherSettingsBuilder = PublisherStubSettings.newBuilder();
  * publisherSettingsBuilder
  *     .createTopicSettings()
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/AsyncGetBook.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/AsyncGetBook.golden
new file mode 100644
index 0000000000..5797b9ea1b
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/AsyncGetBook.golden
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.bookshop.v1beta1.samples;
+
+// [START goldensample_generated_bookshopclient_getbook_async]
+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 AsyncGetBook {
+
+  public static void main(String[] args) throws Exception {
+    asyncGetBook();
+  }
+
+  public static void asyncGetBook() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_bookshopclient_getbook_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncCreate_SetCredentialsProvider.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncCreate_SetCredentialsProvider.golden
new file mode 100644
index 0000000000..6561d22d89
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncCreate_SetCredentialsProvider.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.bookshop.v1beta1.samples;
+
+// [START goldensample_generated_bookshopclient_create_setcredentialsprovider_sync]
+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 SyncCreateSetCredentialsProvider {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateSetCredentialsProvider();
+  }
+
+  public static void syncCreateSetCredentialsProvider() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    BookshopSettings bookshopSettings =
+        BookshopSettings.newBuilder()
+            .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+            .build();
+    BookshopClient bookshopClient = BookshopClient.create(bookshopSettings);
+  }
+}
+// [END goldensample_generated_bookshopclient_create_setcredentialsprovider_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncCreate_SetEndpoint.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncCreate_SetEndpoint.golden
new file mode 100644
index 0000000000..f1f5dffa33
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncCreate_SetEndpoint.golden
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.bookshop.v1beta1.samples;
+
+// [START goldensample_generated_bookshopclient_create_setendpoint_sync]
+import com.google.bookshop.v1beta1.BookshopClient;
+import com.google.bookshop.v1beta1.BookshopSettings;
+import com.google.bookshop.v1beta1.myEndpoint;
+
+public class SyncCreateSetEndpoint {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateSetEndpoint();
+  }
+
+  public static void syncCreateSetEndpoint() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    BookshopSettings bookshopSettings =
+        BookshopSettings.newBuilder().setEndpoint(myEndpoint).build();
+    BookshopClient bookshopClient = BookshopClient.create(bookshopSettings);
+  }
+}
+// [END goldensample_generated_bookshopclient_create_setendpoint_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncGetBook.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncGetBook.golden
new file mode 100644
index 0000000000..8b9a49a334
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncGetBook.golden
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.bookshop.v1beta1.samples;
+
+// [START goldensample_generated_bookshopclient_getbook_sync]
+import com.google.bookshop.v1beta1.Book;
+import com.google.bookshop.v1beta1.BookshopClient;
+import com.google.bookshop.v1beta1.GetBookRequest;
+import java.util.ArrayList;
+
+public class SyncGetBook {
+
+  public static void main(String[] args) throws Exception {
+    syncGetBook();
+  }
+
+  public static void syncGetBook() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (BookshopClient bookshopClient = BookshopClient.create()) {
+      GetBookRequest request =
+          GetBookRequest.newBuilder()
+              .setBooksCount1(1618425911)
+              .setBooksList2("booksList2-1119589686")
+              .addAllBooks3(new ArrayList())
+              .build();
+      Book response = bookshopClient.getBook(request);
+    }
+  }
+}
+// [END goldensample_generated_bookshopclient_getbook_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncGetBook_IntListbook.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncGetBook_IntListbook.golden
new file mode 100644
index 0000000000..3fcba7a522
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncGetBook_IntListbook.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.bookshop.v1beta1.samples;
+
+// [START goldensample_generated_bookshopclient_getbook_intlistbook_sync]
+import com.google.bookshop.v1beta1.Book;
+import com.google.bookshop.v1beta1.BookshopClient;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SyncGetBookIntListbook {
+
+  public static void main(String[] args) throws Exception {
+    syncGetBookIntListbook();
+  }
+
+  public static void syncGetBookIntListbook() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (BookshopClient bookshopClient = BookshopClient.create()) {
+      int booksCount = 1618425911;
+      List books = new ArrayList<>();
+      Book response = bookshopClient.getBook(booksCount, books);
+    }
+  }
+}
+// [END goldensample_generated_bookshopclient_getbook_intlistbook_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncGetBook_StringListbook.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncGetBook_StringListbook.golden
new file mode 100644
index 0000000000..1cdc59bdfe
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/bookshopclient/SyncGetBook_StringListbook.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.bookshop.v1beta1.samples;
+
+// [START goldensample_generated_bookshopclient_getbook_stringlistbook_sync]
+import com.google.bookshop.v1beta1.Book;
+import com.google.bookshop.v1beta1.BookshopClient;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SyncGetBookStringListbook {
+
+  public static void main(String[] args) throws Exception {
+    syncGetBookStringListbook();
+  }
+
+  public static void syncGetBookStringListbook() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (BookshopClient bookshopClient = BookshopClient.create()) {
+      String booksList = "booksList2-1119589686";
+      List books = new ArrayList<>();
+      Book response = bookshopClient.getBook(booksList, books);
+    }
+  }
+}
+// [END goldensample_generated_bookshopclient_getbook_stringlistbook_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/AsyncFastFibonacci.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/AsyncFastFibonacci.golden
new file mode 100644
index 0000000000..4f22840779
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/AsyncFastFibonacci.golden
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.testdata.v1.samples;
+
+// [START goldensample_generated_deprecatedserviceclient_fastfibonacci_async]
+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 AsyncFastFibonacci {
+
+  public static void main(String[] args) throws Exception {
+    asyncFastFibonacci();
+  }
+
+  public static void asyncFastFibonacci() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+      FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+      ApiFuture future = deprecatedServiceClient.fastFibonacciCallable().futureCall(request);
+      // Do something.
+      future.get();
+    }
+  }
+}
+// [END goldensample_generated_deprecatedserviceclient_fastfibonacci_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/AsyncSlowFibonacci.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/AsyncSlowFibonacci.golden
new file mode 100644
index 0000000000..f0f6130bf5
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/AsyncSlowFibonacci.golden
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.testdata.v1.samples;
+
+// [START goldensample_generated_deprecatedserviceclient_slowfibonacci_async]
+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 AsyncSlowFibonacci {
+
+  public static void main(String[] args) throws Exception {
+    asyncSlowFibonacci();
+  }
+
+  public static void asyncSlowFibonacci() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+      FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+      ApiFuture future = deprecatedServiceClient.slowFibonacciCallable().futureCall(request);
+      // Do something.
+      future.get();
+    }
+  }
+}
+// [END goldensample_generated_deprecatedserviceclient_slowfibonacci_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncCreate_SetCredentialsProvider.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncCreate_SetCredentialsProvider.golden
new file mode 100644
index 0000000000..c138703b0b
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncCreate_SetCredentialsProvider.golden
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.testdata.v1.samples;
+
+// [START goldensample_generated_deprecatedserviceclient_create_setcredentialsprovider_sync]
+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 SyncCreateSetCredentialsProvider {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateSetCredentialsProvider();
+  }
+
+  public static void syncCreateSetCredentialsProvider() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    DeprecatedServiceSettings deprecatedServiceSettings =
+        DeprecatedServiceSettings.newBuilder()
+            .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+            .build();
+    DeprecatedServiceClient deprecatedServiceClient =
+        DeprecatedServiceClient.create(deprecatedServiceSettings);
+  }
+}
+// [END goldensample_generated_deprecatedserviceclient_create_setcredentialsprovider_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncCreate_SetEndpoint.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncCreate_SetEndpoint.golden
new file mode 100644
index 0000000000..a719126c25
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncCreate_SetEndpoint.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.testdata.v1.samples;
+
+// [START goldensample_generated_deprecatedserviceclient_create_setendpoint_sync]
+import com.google.testdata.v1.DeprecatedServiceClient;
+import com.google.testdata.v1.DeprecatedServiceSettings;
+import com.google.testdata.v1.myEndpoint;
+
+public class SyncCreateSetEndpoint {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateSetEndpoint();
+  }
+
+  public static void syncCreateSetEndpoint() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    DeprecatedServiceSettings deprecatedServiceSettings =
+        DeprecatedServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+    DeprecatedServiceClient deprecatedServiceClient =
+        DeprecatedServiceClient.create(deprecatedServiceSettings);
+  }
+}
+// [END goldensample_generated_deprecatedserviceclient_create_setendpoint_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncFastFibonacci.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncFastFibonacci.golden
new file mode 100644
index 0000000000..b2c02d3e7c
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncFastFibonacci.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.testdata.v1.samples;
+
+// [START goldensample_generated_deprecatedserviceclient_fastfibonacci_sync]
+import com.google.protobuf.Empty;
+import com.google.testdata.v1.DeprecatedServiceClient;
+import com.google.testdata.v1.FibonacciRequest;
+
+public class SyncFastFibonacci {
+
+  public static void main(String[] args) throws Exception {
+    syncFastFibonacci();
+  }
+
+  public static void syncFastFibonacci() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+      FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+      deprecatedServiceClient.fastFibonacci(request);
+    }
+  }
+}
+// [END goldensample_generated_deprecatedserviceclient_fastfibonacci_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncSlowFibonacci.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncSlowFibonacci.golden
new file mode 100644
index 0000000000..8a4e5ac674
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/deprecatedserviceclient/SyncSlowFibonacci.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.testdata.v1.samples;
+
+// [START goldensample_generated_deprecatedserviceclient_slowfibonacci_sync]
+import com.google.protobuf.Empty;
+import com.google.testdata.v1.DeprecatedServiceClient;
+import com.google.testdata.v1.FibonacciRequest;
+
+public class SyncSlowFibonacci {
+
+  public static void main(String[] args) throws Exception {
+    syncSlowFibonacci();
+  }
+
+  public static void syncSlowFibonacci() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (DeprecatedServiceClient deprecatedServiceClient = DeprecatedServiceClient.create()) {
+      FibonacciRequest request = FibonacciRequest.newBuilder().setValue(111972721).build();
+      deprecatedServiceClient.slowFibonacci(request);
+    }
+  }
+}
+// [END goldensample_generated_deprecatedserviceclient_slowfibonacci_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncBlock.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncBlock.golden
new file mode 100644
index 0000000000..b186e09e24
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncBlock.golden
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_block_async]
+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 AsyncBlock {
+
+  public static void main(String[] args) throws Exception {
+    asyncBlock();
+  }
+
+  public static void asyncBlock() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      BlockRequest request = BlockRequest.newBuilder().build();
+      ApiFuture future = echoClient.blockCallable().futureCall(request);
+      // Do something.
+      BlockResponse response = future.get();
+    }
+  }
+}
+// [END goldensample_generated_echoclient_block_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncChat.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncChat.golden
new file mode 100644
index 0000000000..9e5ae4d943
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncChat.golden
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_chat_async]
+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 AsyncChat {
+
+  public static void main(String[] args) throws Exception {
+    asyncChat();
+  }
+
+  public static void asyncChat() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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.
+      }
+    }
+  }
+}
+// [END goldensample_generated_echoclient_chat_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncChatAgain.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncChatAgain.golden
new file mode 100644
index 0000000000..e0378fbf9f
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncChatAgain.golden
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_chatagain_async]
+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 AsyncChatAgain {
+
+  public static void main(String[] args) throws Exception {
+    asyncChatAgain();
+  }
+
+  public static void asyncChatAgain() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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.
+      }
+    }
+  }
+}
+// [END goldensample_generated_echoclient_chatagain_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncCollect.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncCollect.golden
new file mode 100644
index 0000000000..ee607a7efb
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncCollect.golden
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_collect_async]
+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 AsyncCollect {
+
+  public static void main(String[] args) throws Exception {
+    asyncCollect();
+  }
+
+  public static void asyncCollect() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      ApiStreamObserver responseObserver =
+          new ApiStreamObserver() {
+            @Override
+            public void onNext(EchoResponse response) {
+              // Do something when a response is received.
+            }
+
+            @Override
+            public void onError(Throwable t) {
+              // Add error-handling
+            }
+
+            @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);
+    }
+  }
+}
+// [END goldensample_generated_echoclient_collect_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncCollideName.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncCollideName.golden
new file mode 100644
index 0000000000..7e85f18fbf
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncCollideName.golden
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_collidename_async]
+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 AsyncCollideName {
+
+  public static void main(String[] args) throws Exception {
+    asyncCollideName();
+  }
+
+  public static void asyncCollideName() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_echoclient_collidename_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncEcho.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncEcho.golden
new file mode 100644
index 0000000000..859347ff50
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncEcho.golden
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_echo_async]
+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 AsyncEcho {
+
+  public static void main(String[] args) throws Exception {
+    asyncEcho();
+  }
+
+  public static void asyncEcho() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_echoclient_echo_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncExpand.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncExpand.golden
new file mode 100644
index 0000000000..d396bc513b
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncExpand.golden
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_expand_async]
+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 AsyncExpand {
+
+  public static void main(String[] args) throws Exception {
+    asyncExpand();
+  }
+
+  public static void asyncExpand() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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.
+      }
+    }
+  }
+}
+// [END goldensample_generated_echoclient_expand_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncPagedExpand.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncPagedExpand.golden
new file mode 100644
index 0000000000..d2b5bb96cb
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncPagedExpand.golden
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_pagedexpand_async]
+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 AsyncPagedExpand {
+
+  public static void main(String[] args) throws Exception {
+    asyncPagedExpand();
+  }
+
+  public static void asyncPagedExpand() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+      }
+    }
+  }
+}
+// [END goldensample_generated_echoclient_pagedexpand_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncPagedExpand_Paged.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncPagedExpand_Paged.golden
new file mode 100644
index 0000000000..84015b1301
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncPagedExpand_Paged.golden
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_pagedexpand_paged_async]
+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 AsyncPagedExpandPaged {
+
+  public static void main(String[] args) throws Exception {
+    asyncPagedExpandPaged();
+  }
+
+  public static void asyncPagedExpandPaged() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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;
+        }
+      }
+    }
+  }
+}
+// [END goldensample_generated_echoclient_pagedexpand_paged_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncSimplePagedExpand.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncSimplePagedExpand.golden
new file mode 100644
index 0000000000..092552fbcf
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncSimplePagedExpand.golden
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_simplepagedexpand_async]
+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 AsyncSimplePagedExpand {
+
+  public static void main(String[] args) throws Exception {
+    asyncSimplePagedExpand();
+  }
+
+  public static void asyncSimplePagedExpand() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+      }
+    }
+  }
+}
+// [END goldensample_generated_echoclient_simplepagedexpand_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncSimplePagedExpand_Paged.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncSimplePagedExpand_Paged.golden
new file mode 100644
index 0000000000..e8b415ee93
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncSimplePagedExpand_Paged.golden
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_simplepagedexpand_paged_async]
+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 AsyncSimplePagedExpandPaged {
+
+  public static void main(String[] args) throws Exception {
+    asyncSimplePagedExpandPaged();
+  }
+
+  public static void asyncSimplePagedExpandPaged() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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;
+        }
+      }
+    }
+  }
+}
+// [END goldensample_generated_echoclient_simplepagedexpand_paged_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncWait.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncWait.golden
new file mode 100644
index 0000000000..6fe7262fcd
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncWait.golden
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_wait_async]
+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 AsyncWait {
+
+  public static void main(String[] args) throws Exception {
+    asyncWait();
+  }
+
+  public static void asyncWait() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      WaitRequest request = WaitRequest.newBuilder().build();
+      ApiFuture future = echoClient.waitCallable().futureCall(request);
+      // Do something.
+      Operation response = future.get();
+    }
+  }
+}
+// [END goldensample_generated_echoclient_wait_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncWait_LRO.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncWait_LRO.golden
new file mode 100644
index 0000000000..5cf6e62b91
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/AsyncWait_LRO.golden
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_wait_lro_async]
+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 AsyncWaitLRO {
+
+  public static void main(String[] args) throws Exception {
+    asyncWaitLRO();
+  }
+
+  public static void asyncWaitLRO() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      WaitRequest request = WaitRequest.newBuilder().build();
+      OperationFuture future =
+          echoClient.waitOperationCallable().futureCall(request);
+      // Do something.
+      WaitResponse response = future.get();
+    }
+  }
+}
+// [END goldensample_generated_echoclient_wait_lro_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncBlock.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncBlock.golden
new file mode 100644
index 0000000000..a4f343bf79
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncBlock.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_block_sync]
+import com.google.showcase.v1beta1.BlockRequest;
+import com.google.showcase.v1beta1.BlockResponse;
+import com.google.showcase.v1beta1.EchoClient;
+
+public class SyncBlock {
+
+  public static void main(String[] args) throws Exception {
+    syncBlock();
+  }
+
+  public static void syncBlock() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      BlockRequest request = BlockRequest.newBuilder().build();
+      BlockResponse response = echoClient.block(request);
+    }
+  }
+}
+// [END goldensample_generated_echoclient_block_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncCollideName.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncCollideName.golden
new file mode 100644
index 0000000000..77bd8ff45a
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncCollideName.golden
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_collidename_sync]
+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 SyncCollideName {
+
+  public static void main(String[] args) throws Exception {
+    syncCollideName();
+  }
+
+  public static void syncCollideName() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+    }
+  }
+}
+// [END goldensample_generated_echoclient_collidename_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncCreate_SetCredentialsProvider.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncCreate_SetCredentialsProvider.golden
new file mode 100644
index 0000000000..b867d8de33
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncCreate_SetCredentialsProvider.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_create_setcredentialsprovider_sync]
+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 SyncCreateSetCredentialsProvider {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateSetCredentialsProvider();
+  }
+
+  public static void syncCreateSetCredentialsProvider() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    EchoSettings echoSettings =
+        EchoSettings.newBuilder()
+            .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+            .build();
+    EchoClient echoClient = EchoClient.create(echoSettings);
+  }
+}
+// [END goldensample_generated_echoclient_create_setcredentialsprovider_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncCreate_SetEndpoint.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncCreate_SetEndpoint.golden
new file mode 100644
index 0000000000..046c0083e1
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncCreate_SetEndpoint.golden
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_create_setendpoint_sync]
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.EchoSettings;
+import com.google.showcase.v1beta1.myEndpoint;
+
+public class SyncCreateSetEndpoint {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateSetEndpoint();
+  }
+
+  public static void syncCreateSetEndpoint() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    EchoSettings echoSettings = EchoSettings.newBuilder().setEndpoint(myEndpoint).build();
+    EchoClient echoClient = EchoClient.create(echoSettings);
+  }
+}
+// [END goldensample_generated_echoclient_create_setendpoint_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho.golden
new file mode 100644
index 0000000000..4335448ae0
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho.golden
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_echo_sync]
+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 SyncEcho {
+
+  public static void main(String[] args) throws Exception {
+    syncEcho();
+  }
+
+  public static void syncEcho() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+    }
+  }
+}
+// [END goldensample_generated_echoclient_echo_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Foobarname.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Foobarname.golden
new file mode 100644
index 0000000000..a998ecaa0d
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Foobarname.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_echo_foobarname_sync]
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.EchoResponse;
+import com.google.showcase.v1beta1.FoobarName;
+
+public class SyncEchoFoobarname {
+
+  public static void main(String[] args) throws Exception {
+    syncEchoFoobarname();
+  }
+
+  public static void syncEchoFoobarname() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      FoobarName name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
+      EchoResponse response = echoClient.echo(name);
+    }
+  }
+}
+// [END goldensample_generated_echoclient_echo_foobarname_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Noargs.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Noargs.golden
new file mode 100644
index 0000000000..b1ea342923
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Noargs.golden
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_echo_noargs_sync]
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.EchoResponse;
+
+public class SyncEchoNoargs {
+
+  public static void main(String[] args) throws Exception {
+    syncEchoNoargs();
+  }
+
+  public static void syncEchoNoargs() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      EchoResponse response = echoClient.echo();
+    }
+  }
+}
+// [END goldensample_generated_echoclient_echo_noargs_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Resourcename.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Resourcename.golden
new file mode 100644
index 0000000000..b352a6f215
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Resourcename.golden
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_echo_resourcename_sync]
+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 SyncEchoResourcename {
+
+  public static void main(String[] args) throws Exception {
+    syncEchoResourcename();
+  }
+
+  public static void syncEchoResourcename() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      ResourceName parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]");
+      EchoResponse response = echoClient.echo(parent);
+    }
+  }
+}
+// [END goldensample_generated_echoclient_echo_resourcename_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Status.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Status.golden
new file mode 100644
index 0000000000..2d1e7fd96e
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_Status.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_echo_status_sync]
+import com.google.rpc.Status;
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.EchoResponse;
+
+public class SyncEchoStatus {
+
+  public static void main(String[] args) throws Exception {
+    syncEchoStatus();
+  }
+
+  public static void syncEchoStatus() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      Status error = Status.newBuilder().build();
+      EchoResponse response = echoClient.echo(error);
+    }
+  }
+}
+// [END goldensample_generated_echoclient_echo_status_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_String.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_String.golden
new file mode 100644
index 0000000000..8f8737d11a
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_String.golden
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_echo_string_sync]
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.EchoResponse;
+
+public class SyncEchoString {
+
+  public static void main(String[] args) throws Exception {
+    syncEchoString();
+  }
+
+  public static void syncEchoString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      String content = "content951530617";
+      EchoResponse response = echoClient.echo(content);
+    }
+  }
+}
+// [END goldensample_generated_echoclient_echo_string_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_String1.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_String1.golden
new file mode 100644
index 0000000000..e15958515c
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_String1.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_echo_string1_sync]
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.EchoResponse;
+import com.google.showcase.v1beta1.FoobarName;
+
+public class SyncEchoString1 {
+
+  public static void main(String[] args) throws Exception {
+    syncEchoString1();
+  }
+
+  public static void syncEchoString1() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      String name = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
+      EchoResponse response = echoClient.echo(name);
+    }
+  }
+}
+// [END goldensample_generated_echoclient_echo_string1_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_String2.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_String2.golden
new file mode 100644
index 0000000000..44d9413448
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_String2.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_echo_string2_sync]
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.EchoResponse;
+import com.google.showcase.v1beta1.FoobarName;
+
+public class SyncEchoString2 {
+
+  public static void main(String[] args) throws Exception {
+    syncEchoString2();
+  }
+
+  public static void syncEchoString2() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      String parent = FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString();
+      EchoResponse response = echoClient.echo(parent);
+    }
+  }
+}
+// [END goldensample_generated_echoclient_echo_string2_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_StringSeverity.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_StringSeverity.golden
new file mode 100644
index 0000000000..30b06aaba0
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncEcho_StringSeverity.golden
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_echo_stringseverity_sync]
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.EchoResponse;
+import com.google.showcase.v1beta1.Severity;
+
+public class SyncEchoStringSeverity {
+
+  public static void main(String[] args) throws Exception {
+    syncEchoStringSeverity();
+  }
+
+  public static void syncEchoStringSeverity() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      String content = "content951530617";
+      Severity severity = Severity.forNumber(0);
+      EchoResponse response = echoClient.echo(content, severity);
+    }
+  }
+}
+// [END goldensample_generated_echoclient_echo_stringseverity_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncPagedExpand.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncPagedExpand.golden
new file mode 100644
index 0000000000..7f0b48f0f7
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncPagedExpand.golden
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_pagedexpand_sync]
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.EchoResponse;
+import com.google.showcase.v1beta1.PagedExpandRequest;
+
+public class SyncPagedExpand {
+
+  public static void main(String[] args) throws Exception {
+    syncPagedExpand();
+  }
+
+  public static void syncPagedExpand() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+      }
+    }
+  }
+}
+// [END goldensample_generated_echoclient_pagedexpand_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncSimplePagedExpand.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncSimplePagedExpand.golden
new file mode 100644
index 0000000000..c6056f3781
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncSimplePagedExpand.golden
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_simplepagedexpand_sync]
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.EchoResponse;
+import com.google.showcase.v1beta1.PagedExpandRequest;
+
+public class SyncSimplePagedExpand {
+
+  public static void main(String[] args) throws Exception {
+    syncSimplePagedExpand();
+  }
+
+  public static void syncSimplePagedExpand() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+      }
+    }
+  }
+}
+// [END goldensample_generated_echoclient_simplepagedexpand_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncSimplePagedExpand_Noargs.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncSimplePagedExpand_Noargs.golden
new file mode 100644
index 0000000000..d6ddc523dc
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncSimplePagedExpand_Noargs.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_simplepagedexpand_noargs_sync]
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.EchoResponse;
+
+public class SyncSimplePagedExpandNoargs {
+
+  public static void main(String[] args) throws Exception {
+    syncSimplePagedExpandNoargs();
+  }
+
+  public static void syncSimplePagedExpandNoargs() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      for (EchoResponse element : echoClient.simplePagedExpand().iterateAll()) {
+        // doThingsWith(element);
+      }
+    }
+  }
+}
+// [END goldensample_generated_echoclient_simplepagedexpand_noargs_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncWait.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncWait.golden
new file mode 100644
index 0000000000..3f463f0e69
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncWait.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_wait_sync]
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.WaitRequest;
+import com.google.showcase.v1beta1.WaitResponse;
+
+public class SyncWait {
+
+  public static void main(String[] args) throws Exception {
+    syncWait();
+  }
+
+  public static void syncWait() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      WaitRequest request = WaitRequest.newBuilder().build();
+      WaitResponse response = echoClient.waitAsync(request).get();
+    }
+  }
+}
+// [END goldensample_generated_echoclient_wait_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncWait_Duration.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncWait_Duration.golden
new file mode 100644
index 0000000000..e9e3c49dce
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncWait_Duration.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_wait_duration_sync]
+import com.google.protobuf.Duration;
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.WaitResponse;
+
+public class SyncWaitDuration {
+
+  public static void main(String[] args) throws Exception {
+    syncWaitDuration();
+  }
+
+  public static void syncWaitDuration() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      Duration ttl = Duration.newBuilder().build();
+      WaitResponse response = echoClient.waitAsync(ttl).get();
+    }
+  }
+}
+// [END goldensample_generated_echoclient_wait_duration_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncWait_Timestamp.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncWait_Timestamp.golden
new file mode 100644
index 0000000000..f7e5e9dfe5
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/echoclient/SyncWait_Timestamp.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echoclient_wait_timestamp_sync]
+import com.google.protobuf.Timestamp;
+import com.google.showcase.v1beta1.EchoClient;
+import com.google.showcase.v1beta1.WaitResponse;
+
+public class SyncWaitTimestamp {
+
+  public static void main(String[] args) throws Exception {
+    syncWaitTimestamp();
+  }
+
+  public static void syncWaitTimestamp() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (EchoClient echoClient = EchoClient.create()) {
+      Timestamp endTime = Timestamp.newBuilder().build();
+      WaitResponse response = echoClient.waitAsync(endTime).get();
+    }
+  }
+}
+// [END goldensample_generated_echoclient_wait_timestamp_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncCreateUser.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncCreateUser.golden
new file mode 100644
index 0000000000..f5c58710a7
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncCreateUser.golden
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_createuser_async]
+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 AsyncCreateUser {
+
+  public static void main(String[] args) throws Exception {
+    asyncCreateUser();
+  }
+
+  public static void asyncCreateUser() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_identityclient_createuser_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncDeleteUser.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncDeleteUser.golden
new file mode 100644
index 0000000000..6ca7457c4d
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncDeleteUser.golden
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_deleteuser_async]
+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 AsyncDeleteUser {
+
+  public static void main(String[] args) throws Exception {
+    asyncDeleteUser();
+  }
+
+  public static void asyncDeleteUser() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_identityclient_deleteuser_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncGetUser.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncGetUser.golden
new file mode 100644
index 0000000000..f3d3e87c1c
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncGetUser.golden
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_getuser_async]
+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 AsyncGetUser {
+
+  public static void main(String[] args) throws Exception {
+    asyncGetUser();
+  }
+
+  public static void asyncGetUser() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_identityclient_getuser_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncListUsers.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncListUsers.golden
new file mode 100644
index 0000000000..6fed1e6611
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncListUsers.golden
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_listusers_async]
+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 AsyncListUsers {
+
+  public static void main(String[] args) throws Exception {
+    asyncListUsers();
+  }
+
+  public static void asyncListUsers() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+      }
+    }
+  }
+}
+// [END goldensample_generated_identityclient_listusers_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncListUsers_Paged.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncListUsers_Paged.golden
new file mode 100644
index 0000000000..d8df8db606
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncListUsers_Paged.golden
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_listusers_paged_async]
+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 AsyncListUsersPaged {
+
+  public static void main(String[] args) throws Exception {
+    asyncListUsersPaged();
+  }
+
+  public static void asyncListUsersPaged() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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;
+        }
+      }
+    }
+  }
+}
+// [END goldensample_generated_identityclient_listusers_paged_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncUpdateUser.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncUpdateUser.golden
new file mode 100644
index 0000000000..511e7188ed
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/AsyncUpdateUser.golden
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_updateuser_async]
+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 AsyncUpdateUser {
+
+  public static void main(String[] args) throws Exception {
+    asyncUpdateUser();
+  }
+
+  public static void asyncUpdateUser() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_identityclient_updateuser_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser.golden
new file mode 100644
index 0000000000..dbd8badb47
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser.golden
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_createuser_sync]
+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 SyncCreateUser {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateUser();
+  }
+
+  public static void syncCreateUser() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (IdentityClient identityClient = IdentityClient.create()) {
+      CreateUserRequest request =
+          CreateUserRequest.newBuilder()
+              .setParent(UserName.of("[USER]").toString())
+              .setUser(User.newBuilder().build())
+              .build();
+      User response = identityClient.createUser(request);
+    }
+  }
+}
+// [END goldensample_generated_identityclient_createuser_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser_StringStringString.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser_StringStringString.golden
new file mode 100644
index 0000000000..953dc0706b
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser_StringStringString.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_createuser_stringstringstring_sync]
+import com.google.showcase.v1beta1.IdentityClient;
+import com.google.showcase.v1beta1.User;
+import com.google.showcase.v1beta1.UserName;
+
+public class SyncCreateUserStringStringString {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateUserStringStringString();
+  }
+
+  public static void syncCreateUserStringStringString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (IdentityClient identityClient = IdentityClient.create()) {
+      String parent = UserName.of("[USER]").toString();
+      String displayName = "displayName1714148973";
+      String email = "email96619420";
+      User response = identityClient.createUser(parent, displayName, email);
+    }
+  }
+}
+// [END goldensample_generated_identityclient_createuser_stringstringstring_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser_StringStringStringIntStringBooleanDouble.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser_StringStringStringIntStringBooleanDouble.golden
new file mode 100644
index 0000000000..85d9ab1960
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser_StringStringStringIntStringBooleanDouble.golden
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_createuser_stringstringstringintstringbooleandouble_sync]
+import com.google.showcase.v1beta1.IdentityClient;
+import com.google.showcase.v1beta1.User;
+import com.google.showcase.v1beta1.UserName;
+
+public class SyncCreateUserStringStringStringIntStringBooleanDouble {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateUserStringStringStringIntStringBooleanDouble();
+  }
+
+  public static void syncCreateUserStringStringStringIntStringBooleanDouble() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+    }
+  }
+}
+// [END goldensample_generated_identityclient_createuser_stringstringstringintstringbooleandouble_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser_StringStringStringStringStringIntStringStringStringString.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser_StringStringStringStringStringIntStringStringStringString.golden
new file mode 100644
index 0000000000..d222f048a8
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreateUser_StringStringStringStringStringIntStringStringStringString.golden
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_createuser_stringstringstringstringstringintstringstringstringstring_sync]
+import com.google.showcase.v1beta1.IdentityClient;
+import com.google.showcase.v1beta1.User;
+import com.google.showcase.v1beta1.UserName;
+
+public class SyncCreateUserStringStringStringStringStringIntStringStringStringString {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateUserStringStringStringStringStringIntStringStringStringString();
+  }
+
+  public static void syncCreateUserStringStringStringStringStringIntStringStringStringString()
+      throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+    }
+  }
+}
+// [END goldensample_generated_identityclient_createuser_stringstringstringstringstringintstringstringstringstring_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreate_SetCredentialsProvider.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreate_SetCredentialsProvider.golden
new file mode 100644
index 0000000000..7950320dbb
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreate_SetCredentialsProvider.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_create_setcredentialsprovider_sync]
+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 SyncCreateSetCredentialsProvider {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateSetCredentialsProvider();
+  }
+
+  public static void syncCreateSetCredentialsProvider() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    IdentitySettings identitySettings =
+        IdentitySettings.newBuilder()
+            .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+            .build();
+    IdentityClient identityClient = IdentityClient.create(identitySettings);
+  }
+}
+// [END goldensample_generated_identityclient_create_setcredentialsprovider_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreate_SetEndpoint.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreate_SetEndpoint.golden
new file mode 100644
index 0000000000..b1b7add9db
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncCreate_SetEndpoint.golden
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_create_setendpoint_sync]
+import com.google.showcase.v1beta1.IdentityClient;
+import com.google.showcase.v1beta1.IdentitySettings;
+import com.google.showcase.v1beta1.myEndpoint;
+
+public class SyncCreateSetEndpoint {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateSetEndpoint();
+  }
+
+  public static void syncCreateSetEndpoint() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    IdentitySettings identitySettings =
+        IdentitySettings.newBuilder().setEndpoint(myEndpoint).build();
+    IdentityClient identityClient = IdentityClient.create(identitySettings);
+  }
+}
+// [END goldensample_generated_identityclient_create_setendpoint_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncDeleteUser.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncDeleteUser.golden
new file mode 100644
index 0000000000..1c836c26f8
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncDeleteUser.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_deleteuser_sync]
+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 SyncDeleteUser {
+
+  public static void main(String[] args) throws Exception {
+    syncDeleteUser();
+  }
+
+  public static void syncDeleteUser() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (IdentityClient identityClient = IdentityClient.create()) {
+      DeleteUserRequest request =
+          DeleteUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
+      identityClient.deleteUser(request);
+    }
+  }
+}
+// [END goldensample_generated_identityclient_deleteuser_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncDeleteUser_String.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncDeleteUser_String.golden
new file mode 100644
index 0000000000..22e00a180f
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncDeleteUser_String.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_deleteuser_string_sync]
+import com.google.protobuf.Empty;
+import com.google.showcase.v1beta1.IdentityClient;
+import com.google.showcase.v1beta1.UserName;
+
+public class SyncDeleteUserString {
+
+  public static void main(String[] args) throws Exception {
+    syncDeleteUserString();
+  }
+
+  public static void syncDeleteUserString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (IdentityClient identityClient = IdentityClient.create()) {
+      String name = UserName.of("[USER]").toString();
+      identityClient.deleteUser(name);
+    }
+  }
+}
+// [END goldensample_generated_identityclient_deleteuser_string_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncDeleteUser_Username.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncDeleteUser_Username.golden
new file mode 100644
index 0000000000..55d2b6fb29
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncDeleteUser_Username.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_deleteuser_username_sync]
+import com.google.protobuf.Empty;
+import com.google.showcase.v1beta1.IdentityClient;
+import com.google.showcase.v1beta1.UserName;
+
+public class SyncDeleteUserUsername {
+
+  public static void main(String[] args) throws Exception {
+    syncDeleteUserUsername();
+  }
+
+  public static void syncDeleteUserUsername() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (IdentityClient identityClient = IdentityClient.create()) {
+      UserName name = UserName.of("[USER]");
+      identityClient.deleteUser(name);
+    }
+  }
+}
+// [END goldensample_generated_identityclient_deleteuser_username_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncGetUser.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncGetUser.golden
new file mode 100644
index 0000000000..972382be7f
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncGetUser.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_getuser_sync]
+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 SyncGetUser {
+
+  public static void main(String[] args) throws Exception {
+    syncGetUser();
+  }
+
+  public static void syncGetUser() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (IdentityClient identityClient = IdentityClient.create()) {
+      GetUserRequest request =
+          GetUserRequest.newBuilder().setName(UserName.of("[USER]").toString()).build();
+      User response = identityClient.getUser(request);
+    }
+  }
+}
+// [END goldensample_generated_identityclient_getuser_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncGetUser_String.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncGetUser_String.golden
new file mode 100644
index 0000000000..8ccf1245c0
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncGetUser_String.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_getuser_string_sync]
+import com.google.showcase.v1beta1.IdentityClient;
+import com.google.showcase.v1beta1.User;
+import com.google.showcase.v1beta1.UserName;
+
+public class SyncGetUserString {
+
+  public static void main(String[] args) throws Exception {
+    syncGetUserString();
+  }
+
+  public static void syncGetUserString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (IdentityClient identityClient = IdentityClient.create()) {
+      String name = UserName.of("[USER]").toString();
+      User response = identityClient.getUser(name);
+    }
+  }
+}
+// [END goldensample_generated_identityclient_getuser_string_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncGetUser_Username.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncGetUser_Username.golden
new file mode 100644
index 0000000000..5d7441c7bc
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncGetUser_Username.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_getuser_username_sync]
+import com.google.showcase.v1beta1.IdentityClient;
+import com.google.showcase.v1beta1.User;
+import com.google.showcase.v1beta1.UserName;
+
+public class SyncGetUserUsername {
+
+  public static void main(String[] args) throws Exception {
+    syncGetUserUsername();
+  }
+
+  public static void syncGetUserUsername() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (IdentityClient identityClient = IdentityClient.create()) {
+      UserName name = UserName.of("[USER]");
+      User response = identityClient.getUser(name);
+    }
+  }
+}
+// [END goldensample_generated_identityclient_getuser_username_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncListUsers.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncListUsers.golden
new file mode 100644
index 0000000000..e70025e5a2
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncListUsers.golden
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_listusers_sync]
+import com.google.showcase.v1beta1.IdentityClient;
+import com.google.showcase.v1beta1.ListUsersRequest;
+import com.google.showcase.v1beta1.User;
+
+public class SyncListUsers {
+
+  public static void main(String[] args) throws Exception {
+    syncListUsers();
+  }
+
+  public static void syncListUsers() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (IdentityClient identityClient = IdentityClient.create()) {
+      ListUsersRequest request =
+          ListUsersRequest.newBuilder()
+              .setPageSize(883849137)
+              .setPageToken("pageToken873572522")
+              .build();
+      for (User element : identityClient.listUsers(request).iterateAll()) {
+        // doThingsWith(element);
+      }
+    }
+  }
+}
+// [END goldensample_generated_identityclient_listusers_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncUpdateUser.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncUpdateUser.golden
new file mode 100644
index 0000000000..32b476711d
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/identityclient/SyncUpdateUser.golden
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_identityclient_updateuser_sync]
+import com.google.showcase.v1beta1.IdentityClient;
+import com.google.showcase.v1beta1.UpdateUserRequest;
+import com.google.showcase.v1beta1.User;
+
+public class SyncUpdateUser {
+
+  public static void main(String[] args) throws Exception {
+    syncUpdateUser();
+  }
+
+  public static void syncUpdateUser() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (IdentityClient identityClient = IdentityClient.create()) {
+      UpdateUserRequest request =
+          UpdateUserRequest.newBuilder().setUser(User.newBuilder().build()).build();
+      User response = identityClient.updateUser(request);
+    }
+  }
+}
+// [END goldensample_generated_identityclient_updateuser_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncConnect.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncConnect.golden
new file mode 100644
index 0000000000..c87c91e312
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncConnect.golden
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_connect_async]
+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 AsyncConnect {
+
+  public static void main(String[] args) throws Exception {
+    asyncConnect();
+  }
+
+  public static void asyncConnect() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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.
+      }
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_connect_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncCreateBlurb.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncCreateBlurb.golden
new file mode 100644
index 0000000000..f3029462c4
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncCreateBlurb.golden
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_createblurb_async]
+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 AsyncCreateBlurb {
+
+  public static void main(String[] args) throws Exception {
+    asyncCreateBlurb();
+  }
+
+  public static void asyncCreateBlurb() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_createblurb_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncCreateRoom.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncCreateRoom.golden
new file mode 100644
index 0000000000..8d924fe7f8
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncCreateRoom.golden
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_createroom_async]
+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 AsyncCreateRoom {
+
+  public static void main(String[] args) throws Exception {
+    asyncCreateRoom();
+  }
+
+  public static void asyncCreateRoom() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_createroom_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncDeleteBlurb.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncDeleteBlurb.golden
new file mode 100644
index 0000000000..21cd62ee46
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncDeleteBlurb.golden
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_deleteblurb_async]
+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 AsyncDeleteBlurb {
+
+  public static void main(String[] args) throws Exception {
+    asyncDeleteBlurb();
+  }
+
+  public static void asyncDeleteBlurb() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_deleteblurb_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncDeleteRoom.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncDeleteRoom.golden
new file mode 100644
index 0000000000..1e23c521e8
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncDeleteRoom.golden
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_deleteroom_async]
+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 AsyncDeleteRoom {
+
+  public static void main(String[] args) throws Exception {
+    asyncDeleteRoom();
+  }
+
+  public static void asyncDeleteRoom() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_deleteroom_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncGetBlurb.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncGetBlurb.golden
new file mode 100644
index 0000000000..1a2a94c0fe
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncGetBlurb.golden
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_getblurb_async]
+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 AsyncGetBlurb {
+
+  public static void main(String[] args) throws Exception {
+    asyncGetBlurb();
+  }
+
+  public static void asyncGetBlurb() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_getblurb_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncGetRoom.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncGetRoom.golden
new file mode 100644
index 0000000000..a1a9b7fb06
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncGetRoom.golden
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_getroom_async]
+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 AsyncGetRoom {
+
+  public static void main(String[] args) throws Exception {
+    asyncGetRoom();
+  }
+
+  public static void asyncGetRoom() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_getroom_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListBlurbs.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListBlurbs.golden
new file mode 100644
index 0000000000..d038d95045
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListBlurbs.golden
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_listblurbs_async]
+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 AsyncListBlurbs {
+
+  public static void main(String[] args) throws Exception {
+    asyncListBlurbs();
+  }
+
+  public static void asyncListBlurbs() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+      }
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_listblurbs_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListBlurbs_Paged.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListBlurbs_Paged.golden
new file mode 100644
index 0000000000..38fe2e545c
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListBlurbs_Paged.golden
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_listblurbs_paged_async]
+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 AsyncListBlurbsPaged {
+
+  public static void main(String[] args) throws Exception {
+    asyncListBlurbsPaged();
+  }
+
+  public static void asyncListBlurbsPaged() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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;
+        }
+      }
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_listblurbs_paged_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListRooms.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListRooms.golden
new file mode 100644
index 0000000000..5a89fb6825
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListRooms.golden
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_listrooms_async]
+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 AsyncListRooms {
+
+  public static void main(String[] args) throws Exception {
+    asyncListRooms();
+  }
+
+  public static void asyncListRooms() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+      }
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_listrooms_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListRooms_Paged.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListRooms_Paged.golden
new file mode 100644
index 0000000000..2efb16fd45
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncListRooms_Paged.golden
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_listrooms_paged_async]
+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 AsyncListRoomsPaged {
+
+  public static void main(String[] args) throws Exception {
+    asyncListRoomsPaged();
+  }
+
+  public static void asyncListRoomsPaged() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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;
+        }
+      }
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_listrooms_paged_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncSearchBlurbs.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncSearchBlurbs.golden
new file mode 100644
index 0000000000..55b6198dab
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncSearchBlurbs.golden
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_searchblurbs_async]
+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 AsyncSearchBlurbs {
+
+  public static void main(String[] args) throws Exception {
+    asyncSearchBlurbs();
+  }
+
+  public static void asyncSearchBlurbs() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_searchblurbs_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncSearchBlurbs_LRO.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncSearchBlurbs_LRO.golden
new file mode 100644
index 0000000000..37ac388c95
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncSearchBlurbs_LRO.golden
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_searchblurbs_lro_async]
+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 AsyncSearchBlurbsLRO {
+
+  public static void main(String[] args) throws Exception {
+    asyncSearchBlurbsLRO();
+  }
+
+  public static void asyncSearchBlurbsLRO() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_searchblurbs_lro_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncSendBlurbs.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncSendBlurbs.golden
new file mode 100644
index 0000000000..b8bfc3afc7
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncSendBlurbs.golden
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_sendblurbs_async]
+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 AsyncSendBlurbs {
+
+  public static void main(String[] args) throws Exception {
+    asyncSendBlurbs();
+  }
+
+  public static void asyncSendBlurbs() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      ApiStreamObserver responseObserver =
+          new ApiStreamObserver() {
+            @Override
+            public void onNext(SendBlurbsResponse response) {
+              // Do something when a response is received.
+            }
+
+            @Override
+            public void onError(Throwable t) {
+              // Add error-handling
+            }
+
+            @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);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_sendblurbs_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncStreamBlurbs.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncStreamBlurbs.golden
new file mode 100644
index 0000000000..4405ce965a
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncStreamBlurbs.golden
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_streamblurbs_async]
+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 AsyncStreamBlurbs {
+
+  public static void main(String[] args) throws Exception {
+    asyncStreamBlurbs();
+  }
+
+  public static void asyncStreamBlurbs() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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.
+      }
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_streamblurbs_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncUpdateBlurb.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncUpdateBlurb.golden
new file mode 100644
index 0000000000..a3ce5f6f77
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncUpdateBlurb.golden
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_updateblurb_async]
+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 AsyncUpdateBlurb {
+
+  public static void main(String[] args) throws Exception {
+    asyncUpdateBlurb();
+  }
+
+  public static void asyncUpdateBlurb() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_updateblurb_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncUpdateRoom.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncUpdateRoom.golden
new file mode 100644
index 0000000000..779495250c
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/AsyncUpdateRoom.golden
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_updateroom_async]
+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 AsyncUpdateRoom {
+
+  public static void main(String[] args) throws Exception {
+    asyncUpdateRoom();
+  }
+
+  public static void asyncUpdateRoom() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_updateroom_async]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb.golden
new file mode 100644
index 0000000000..bddecdeb46
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb.golden
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_createblurb_sync]
+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 SyncCreateBlurb {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateBlurb();
+  }
+
+  public static void syncCreateBlurb() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      CreateBlurbRequest request =
+          CreateBlurbRequest.newBuilder()
+              .setParent(ProfileName.of("[USER]").toString())
+              .setBlurb(Blurb.newBuilder().build())
+              .build();
+      Blurb response = messagingClient.createBlurb(request);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_createblurb_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_ProfilenameBytestring.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_ProfilenameBytestring.golden
new file mode 100644
index 0000000000..7e202c5c41
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_ProfilenameBytestring.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_createblurb_profilenamebytestring_sync]
+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 SyncCreateBlurbProfilenameBytestring {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateBlurbProfilenameBytestring();
+  }
+
+  public static void syncCreateBlurbProfilenameBytestring() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      ProfileName parent = ProfileName.of("[USER]");
+      ByteString image = ByteString.EMPTY;
+      Blurb response = messagingClient.createBlurb(parent, image);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_createblurb_profilenamebytestring_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_ProfilenameString.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_ProfilenameString.golden
new file mode 100644
index 0000000000..0dfe1f3abc
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_ProfilenameString.golden
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_createblurb_profilenamestring_sync]
+import com.google.showcase.v1beta1.Blurb;
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.ProfileName;
+
+public class SyncCreateBlurbProfilenameString {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateBlurbProfilenameString();
+  }
+
+  public static void syncCreateBlurbProfilenameString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      ProfileName parent = ProfileName.of("[USER]");
+      String text = "text3556653";
+      Blurb response = messagingClient.createBlurb(parent, text);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_createblurb_profilenamestring_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_RoomnameBytestring.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_RoomnameBytestring.golden
new file mode 100644
index 0000000000..194ee34998
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_RoomnameBytestring.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_createblurb_roomnamebytestring_sync]
+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 SyncCreateBlurbRoomnameBytestring {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateBlurbRoomnameBytestring();
+  }
+
+  public static void syncCreateBlurbRoomnameBytestring() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      RoomName parent = RoomName.of("[ROOM]");
+      ByteString image = ByteString.EMPTY;
+      Blurb response = messagingClient.createBlurb(parent, image);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_createblurb_roomnamebytestring_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_RoomnameString.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_RoomnameString.golden
new file mode 100644
index 0000000000..994d16b1a3
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_RoomnameString.golden
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_createblurb_roomnamestring_sync]
+import com.google.showcase.v1beta1.Blurb;
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.RoomName;
+
+public class SyncCreateBlurbRoomnameString {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateBlurbRoomnameString();
+  }
+
+  public static void syncCreateBlurbRoomnameString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      RoomName parent = RoomName.of("[ROOM]");
+      String text = "text3556653";
+      Blurb response = messagingClient.createBlurb(parent, text);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_createblurb_roomnamestring_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_StringBytestring.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_StringBytestring.golden
new file mode 100644
index 0000000000..0c8f22dca3
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_StringBytestring.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_createblurb_stringbytestring_sync]
+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 SyncCreateBlurbStringBytestring {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateBlurbStringBytestring();
+  }
+
+  public static void syncCreateBlurbStringBytestring() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      String parent = ProfileName.of("[USER]").toString();
+      ByteString image = ByteString.EMPTY;
+      Blurb response = messagingClient.createBlurb(parent, image);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_createblurb_stringbytestring_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_StringString.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_StringString.golden
new file mode 100644
index 0000000000..19e8b3e33f
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateBlurb_StringString.golden
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_createblurb_stringstring_sync]
+import com.google.showcase.v1beta1.Blurb;
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.ProfileName;
+
+public class SyncCreateBlurbStringString {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateBlurbStringString();
+  }
+
+  public static void syncCreateBlurbStringString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      String parent = ProfileName.of("[USER]").toString();
+      String text = "text3556653";
+      Blurb response = messagingClient.createBlurb(parent, text);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_createblurb_stringstring_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateRoom.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateRoom.golden
new file mode 100644
index 0000000000..6dd645ee49
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateRoom.golden
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_createroom_sync]
+import com.google.showcase.v1beta1.CreateRoomRequest;
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.Room;
+
+public class SyncCreateRoom {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateRoom();
+  }
+
+  public static void syncCreateRoom() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      CreateRoomRequest request =
+          CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
+      Room response = messagingClient.createRoom(request);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_createroom_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateRoom_StringString.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateRoom_StringString.golden
new file mode 100644
index 0000000000..5d47cfb6e3
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreateRoom_StringString.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_createroom_stringstring_sync]
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.Room;
+
+public class SyncCreateRoomStringString {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateRoomStringString();
+  }
+
+  public static void syncCreateRoomStringString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      String displayName = "displayName1714148973";
+      String description = "description-1724546052";
+      Room response = messagingClient.createRoom(displayName, description);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_createroom_stringstring_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreate_SetCredentialsProvider.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreate_SetCredentialsProvider.golden
new file mode 100644
index 0000000000..4ac54cdfb9
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreate_SetCredentialsProvider.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_create_setcredentialsprovider_sync]
+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 SyncCreateSetCredentialsProvider {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateSetCredentialsProvider();
+  }
+
+  public static void syncCreateSetCredentialsProvider() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    MessagingSettings messagingSettings =
+        MessagingSettings.newBuilder()
+            .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+            .build();
+    MessagingClient messagingClient = MessagingClient.create(messagingSettings);
+  }
+}
+// [END goldensample_generated_messagingclient_create_setcredentialsprovider_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreate_SetEndpoint.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreate_SetEndpoint.golden
new file mode 100644
index 0000000000..45f567766d
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncCreate_SetEndpoint.golden
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_create_setendpoint_sync]
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.MessagingSettings;
+import com.google.showcase.v1beta1.myEndpoint;
+
+public class SyncCreateSetEndpoint {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateSetEndpoint();
+  }
+
+  public static void syncCreateSetEndpoint() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    MessagingSettings messagingSettings =
+        MessagingSettings.newBuilder().setEndpoint(myEndpoint).build();
+    MessagingClient messagingClient = MessagingClient.create(messagingSettings);
+  }
+}
+// [END goldensample_generated_messagingclient_create_setendpoint_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteBlurb.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteBlurb.golden
new file mode 100644
index 0000000000..abedec6cc9
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteBlurb.golden
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_deleteblurb_sync]
+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 SyncDeleteBlurb {
+
+  public static void main(String[] args) throws Exception {
+    syncDeleteBlurb();
+  }
+
+  public static void syncDeleteBlurb() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      DeleteBlurbRequest request =
+          DeleteBlurbRequest.newBuilder()
+              .setName(
+                  BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
+                      .toString())
+              .build();
+      messagingClient.deleteBlurb(request);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_deleteblurb_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteBlurb_Blurbname.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteBlurb_Blurbname.golden
new file mode 100644
index 0000000000..fbab080ec4
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteBlurb_Blurbname.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_deleteblurb_blurbname_sync]
+import com.google.protobuf.Empty;
+import com.google.showcase.v1beta1.BlurbName;
+import com.google.showcase.v1beta1.MessagingClient;
+
+public class SyncDeleteBlurbBlurbname {
+
+  public static void main(String[] args) throws Exception {
+    syncDeleteBlurbBlurbname();
+  }
+
+  public static void syncDeleteBlurbBlurbname() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      BlurbName name = BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]");
+      messagingClient.deleteBlurb(name);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_deleteblurb_blurbname_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteBlurb_String.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteBlurb_String.golden
new file mode 100644
index 0000000000..4d64e0889e
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteBlurb_String.golden
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_deleteblurb_string_sync]
+import com.google.protobuf.Empty;
+import com.google.showcase.v1beta1.BlurbName;
+import com.google.showcase.v1beta1.MessagingClient;
+
+public class SyncDeleteBlurbString {
+
+  public static void main(String[] args) throws Exception {
+    syncDeleteBlurbString();
+  }
+
+  public static void syncDeleteBlurbString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      String name =
+          BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
+      messagingClient.deleteBlurb(name);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_deleteblurb_string_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteRoom.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteRoom.golden
new file mode 100644
index 0000000000..76dcad4782
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteRoom.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_deleteroom_sync]
+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 SyncDeleteRoom {
+
+  public static void main(String[] args) throws Exception {
+    syncDeleteRoom();
+  }
+
+  public static void syncDeleteRoom() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      DeleteRoomRequest request =
+          DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
+      messagingClient.deleteRoom(request);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_deleteroom_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteRoom_Roomname.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteRoom_Roomname.golden
new file mode 100644
index 0000000000..37658c32c6
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteRoom_Roomname.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_deleteroom_roomname_sync]
+import com.google.protobuf.Empty;
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.RoomName;
+
+public class SyncDeleteRoomRoomname {
+
+  public static void main(String[] args) throws Exception {
+    syncDeleteRoomRoomname();
+  }
+
+  public static void syncDeleteRoomRoomname() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      RoomName name = RoomName.of("[ROOM]");
+      messagingClient.deleteRoom(name);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_deleteroom_roomname_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteRoom_String.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteRoom_String.golden
new file mode 100644
index 0000000000..1e6ede1865
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncDeleteRoom_String.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_deleteroom_string_sync]
+import com.google.protobuf.Empty;
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.RoomName;
+
+public class SyncDeleteRoomString {
+
+  public static void main(String[] args) throws Exception {
+    syncDeleteRoomString();
+  }
+
+  public static void syncDeleteRoomString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      String name = RoomName.of("[ROOM]").toString();
+      messagingClient.deleteRoom(name);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_deleteroom_string_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetBlurb.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetBlurb.golden
new file mode 100644
index 0000000000..cc1ae967ba
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetBlurb.golden
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_getblurb_sync]
+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 SyncGetBlurb {
+
+  public static void main(String[] args) throws Exception {
+    syncGetBlurb();
+  }
+
+  public static void syncGetBlurb() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      GetBlurbRequest request =
+          GetBlurbRequest.newBuilder()
+              .setName(
+                  BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
+                      .toString())
+              .build();
+      Blurb response = messagingClient.getBlurb(request);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_getblurb_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetBlurb_Blurbname.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetBlurb_Blurbname.golden
new file mode 100644
index 0000000000..4696adc0ca
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetBlurb_Blurbname.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_getblurb_blurbname_sync]
+import com.google.showcase.v1beta1.Blurb;
+import com.google.showcase.v1beta1.BlurbName;
+import com.google.showcase.v1beta1.MessagingClient;
+
+public class SyncGetBlurbBlurbname {
+
+  public static void main(String[] args) throws Exception {
+    syncGetBlurbBlurbname();
+  }
+
+  public static void syncGetBlurbBlurbname() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      BlurbName name = BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]");
+      Blurb response = messagingClient.getBlurb(name);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_getblurb_blurbname_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetBlurb_String.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetBlurb_String.golden
new file mode 100644
index 0000000000..e7d8f4cfc3
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetBlurb_String.golden
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_getblurb_string_sync]
+import com.google.showcase.v1beta1.Blurb;
+import com.google.showcase.v1beta1.BlurbName;
+import com.google.showcase.v1beta1.MessagingClient;
+
+public class SyncGetBlurbString {
+
+  public static void main(String[] args) throws Exception {
+    syncGetBlurbString();
+  }
+
+  public static void syncGetBlurbString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      String name =
+          BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
+      Blurb response = messagingClient.getBlurb(name);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_getblurb_string_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetRoom.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetRoom.golden
new file mode 100644
index 0000000000..41c0ca166f
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetRoom.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_getroom_sync]
+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 SyncGetRoom {
+
+  public static void main(String[] args) throws Exception {
+    syncGetRoom();
+  }
+
+  public static void syncGetRoom() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      GetRoomRequest request =
+          GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
+      Room response = messagingClient.getRoom(request);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_getroom_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetRoom_Roomname.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetRoom_Roomname.golden
new file mode 100644
index 0000000000..f4485469ee
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetRoom_Roomname.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_getroom_roomname_sync]
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.Room;
+import com.google.showcase.v1beta1.RoomName;
+
+public class SyncGetRoomRoomname {
+
+  public static void main(String[] args) throws Exception {
+    syncGetRoomRoomname();
+  }
+
+  public static void syncGetRoomRoomname() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      RoomName name = RoomName.of("[ROOM]");
+      Room response = messagingClient.getRoom(name);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_getroom_roomname_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetRoom_String.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetRoom_String.golden
new file mode 100644
index 0000000000..469e674fcf
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncGetRoom_String.golden
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_getroom_string_sync]
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.Room;
+import com.google.showcase.v1beta1.RoomName;
+
+public class SyncGetRoomString {
+
+  public static void main(String[] args) throws Exception {
+    syncGetRoomString();
+  }
+
+  public static void syncGetRoomString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      String name = RoomName.of("[ROOM]").toString();
+      Room response = messagingClient.getRoom(name);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_getroom_string_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs.golden
new file mode 100644
index 0000000000..be32bec612
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs.golden
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_listblurbs_sync]
+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 SyncListBlurbs {
+
+  public static void main(String[] args) throws Exception {
+    syncListBlurbs();
+  }
+
+  public static void syncListBlurbs() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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);
+      }
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_listblurbs_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs_Profilename.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs_Profilename.golden
new file mode 100644
index 0000000000..9156c3e956
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs_Profilename.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_listblurbs_profilename_sync]
+import com.google.showcase.v1beta1.Blurb;
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.ProfileName;
+
+public class SyncListBlurbsProfilename {
+
+  public static void main(String[] args) throws Exception {
+    syncListBlurbsProfilename();
+  }
+
+  public static void syncListBlurbsProfilename() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      ProfileName parent = ProfileName.of("[USER]");
+      for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
+        // doThingsWith(element);
+      }
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_listblurbs_profilename_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs_Roomname.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs_Roomname.golden
new file mode 100644
index 0000000000..1fed75fdfc
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs_Roomname.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_listblurbs_roomname_sync]
+import com.google.showcase.v1beta1.Blurb;
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.RoomName;
+
+public class SyncListBlurbsRoomname {
+
+  public static void main(String[] args) throws Exception {
+    syncListBlurbsRoomname();
+  }
+
+  public static void syncListBlurbsRoomname() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      RoomName parent = RoomName.of("[ROOM]");
+      for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
+        // doThingsWith(element);
+      }
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_listblurbs_roomname_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs_String.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs_String.golden
new file mode 100644
index 0000000000..8fe9080264
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListBlurbs_String.golden
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_listblurbs_string_sync]
+import com.google.showcase.v1beta1.Blurb;
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.ProfileName;
+
+public class SyncListBlurbsString {
+
+  public static void main(String[] args) throws Exception {
+    syncListBlurbsString();
+  }
+
+  public static void syncListBlurbsString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      String parent = ProfileName.of("[USER]").toString();
+      for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
+        // doThingsWith(element);
+      }
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_listblurbs_string_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListRooms.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListRooms.golden
new file mode 100644
index 0000000000..f3a8abc711
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncListRooms.golden
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_listrooms_sync]
+import com.google.showcase.v1beta1.ListRoomsRequest;
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.Room;
+
+public class SyncListRooms {
+
+  public static void main(String[] args) throws Exception {
+    syncListRooms();
+  }
+
+  public static void syncListRooms() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      ListRoomsRequest request =
+          ListRoomsRequest.newBuilder()
+              .setPageSize(883849137)
+              .setPageToken("pageToken873572522")
+              .build();
+      for (Room element : messagingClient.listRooms(request).iterateAll()) {
+        // doThingsWith(element);
+      }
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_listrooms_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncSearchBlurbs.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncSearchBlurbs.golden
new file mode 100644
index 0000000000..a52299a511
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncSearchBlurbs.golden
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_searchblurbs_sync]
+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 SyncSearchBlurbs {
+
+  public static void main(String[] args) throws Exception {
+    syncSearchBlurbs();
+  }
+
+  public static void syncSearchBlurbs() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    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();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_searchblurbs_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncSearchBlurbs_String.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncSearchBlurbs_String.golden
new file mode 100644
index 0000000000..53366c2f0a
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncSearchBlurbs_String.golden
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_searchblurbs_string_sync]
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.SearchBlurbsResponse;
+
+public class SyncSearchBlurbsString {
+
+  public static void main(String[] args) throws Exception {
+    syncSearchBlurbsString();
+  }
+
+  public static void syncSearchBlurbsString() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      String query = "query107944136";
+      SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(query).get();
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_searchblurbs_string_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncUpdateBlurb.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncUpdateBlurb.golden
new file mode 100644
index 0000000000..c13e6d97a8
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncUpdateBlurb.golden
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_updateblurb_sync]
+import com.google.showcase.v1beta1.Blurb;
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.UpdateBlurbRequest;
+
+public class SyncUpdateBlurb {
+
+  public static void main(String[] args) throws Exception {
+    syncUpdateBlurb();
+  }
+
+  public static void syncUpdateBlurb() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      UpdateBlurbRequest request =
+          UpdateBlurbRequest.newBuilder().setBlurb(Blurb.newBuilder().build()).build();
+      Blurb response = messagingClient.updateBlurb(request);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_updateblurb_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncUpdateRoom.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncUpdateRoom.golden
new file mode 100644
index 0000000000..66fb9b7c41
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/messagingclient/SyncUpdateRoom.golden
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_messagingclient_updateroom_sync]
+import com.google.showcase.v1beta1.MessagingClient;
+import com.google.showcase.v1beta1.Room;
+import com.google.showcase.v1beta1.UpdateRoomRequest;
+
+public class SyncUpdateRoom {
+
+  public static void main(String[] args) throws Exception {
+    syncUpdateRoom();
+  }
+
+  public static void syncUpdateRoom() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    try (MessagingClient messagingClient = MessagingClient.create()) {
+      UpdateRoomRequest request =
+          UpdateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
+      Room response = messagingClient.updateRoom(request);
+    }
+  }
+}
+// [END goldensample_generated_messagingclient_updateroom_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/SyncEcho.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/SyncEcho.golden
new file mode 100644
index 0000000000..4b4458d46c
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/SyncEcho.golden
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.samples;
+
+// [START goldensample_generated_echosettings_echo_sync]
+import com.google.showcase.v1beta1.EchoSettings;
+import java.time.Duration;
+
+public class SyncEcho {
+
+  public static void main(String[] args) throws Exception {
+    syncEcho();
+  }
+
+  public static void syncEcho() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    EchoSettings.Builder echoSettingsBuilder = EchoSettings.newBuilder();
+    echoSettingsBuilder
+        .echoSettings()
+        .setRetrySettings(
+            echoSettingsBuilder
+                .echoSettings()
+                .getRetrySettings()
+                .toBuilder()
+                .setTotalTimeout(Duration.ofSeconds(30))
+                .build());
+    EchoSettings echoSettings = echoSettingsBuilder.build();
+  }
+}
+// [END goldensample_generated_echosettings_echo_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/SyncFastFibonacci.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/SyncFastFibonacci.golden
new file mode 100644
index 0000000000..60745906df
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/SyncFastFibonacci.golden
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.testdata.v1.samples;
+
+// [START goldensample_generated_deprecatedservicesettings_fastfibonacci_sync]
+import com.google.testdata.v1.DeprecatedServiceSettings;
+import java.time.Duration;
+
+public class SyncFastFibonacci {
+
+  public static void main(String[] args) throws Exception {
+    syncFastFibonacci();
+  }
+
+  public static void syncFastFibonacci() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    DeprecatedServiceSettings.Builder deprecatedServiceSettingsBuilder =
+        DeprecatedServiceSettings.newBuilder();
+    deprecatedServiceSettingsBuilder
+        .fastFibonacciSettings()
+        .setRetrySettings(
+            deprecatedServiceSettingsBuilder
+                .fastFibonacciSettings()
+                .getRetrySettings()
+                .toBuilder()
+                .setTotalTimeout(Duration.ofSeconds(30))
+                .build());
+    DeprecatedServiceSettings deprecatedServiceSettings = deprecatedServiceSettingsBuilder.build();
+  }
+}
+// [END goldensample_generated_deprecatedservicesettings_fastfibonacci_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncCreateTopic.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncCreateTopic.golden
new file mode 100644
index 0000000000..750f0115f6
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncCreateTopic.golden
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.pubsub.v1.stub.samples;
+
+// [START goldensample_generated_publisherstubsettings_createtopic_sync]
+import com.google.pubsub.v1.stub.PublisherStubSettings;
+import java.time.Duration;
+
+public class SyncCreateTopic {
+
+  public static void main(String[] args) throws Exception {
+    syncCreateTopic();
+  }
+
+  public static void syncCreateTopic() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    PublisherStubSettings.Builder publisherSettingsBuilder = PublisherStubSettings.newBuilder();
+    publisherSettingsBuilder
+        .createTopicSettings()
+        .setRetrySettings(
+            publisherSettingsBuilder
+                .createTopicSettings()
+                .getRetrySettings()
+                .toBuilder()
+                .setTotalTimeout(Duration.ofSeconds(30))
+                .build());
+    PublisherStubSettings publisherSettings = publisherSettingsBuilder.build();
+  }
+}
+// [END goldensample_generated_publisherstubsettings_createtopic_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncDeleteLog.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncDeleteLog.golden
new file mode 100644
index 0000000000..b2bdd9b49d
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncDeleteLog.golden
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.logging.v2.stub.samples;
+
+// [START goldensample_generated_loggingservicev2stubsettings_deletelog_sync]
+import com.google.logging.v2.stub.LoggingServiceV2StubSettings;
+import java.time.Duration;
+
+public class SyncDeleteLog {
+
+  public static void main(String[] args) throws Exception {
+    syncDeleteLog();
+  }
+
+  public static void syncDeleteLog() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    LoggingServiceV2StubSettings.Builder loggingServiceV2SettingsBuilder =
+        LoggingServiceV2StubSettings.newBuilder();
+    loggingServiceV2SettingsBuilder
+        .deleteLogSettings()
+        .setRetrySettings(
+            loggingServiceV2SettingsBuilder
+                .deleteLogSettings()
+                .getRetrySettings()
+                .toBuilder()
+                .setTotalTimeout(Duration.ofSeconds(30))
+                .build());
+    LoggingServiceV2StubSettings loggingServiceV2Settings = loggingServiceV2SettingsBuilder.build();
+  }
+}
+// [END goldensample_generated_loggingservicev2stubsettings_deletelog_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncEcho.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncEcho.golden
new file mode 100644
index 0000000000..fb15d47b6c
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncEcho.golden
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.showcase.v1beta1.stub.samples;
+
+// [START goldensample_generated_echostubsettings_echo_sync]
+import com.google.showcase.v1beta1.stub.EchoStubSettings;
+import java.time.Duration;
+
+public class SyncEcho {
+
+  public static void main(String[] args) throws Exception {
+    syncEcho();
+  }
+
+  public static void syncEcho() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    EchoStubSettings.Builder echoSettingsBuilder = EchoStubSettings.newBuilder();
+    echoSettingsBuilder
+        .echoSettings()
+        .setRetrySettings(
+            echoSettingsBuilder
+                .echoSettings()
+                .getRetrySettings()
+                .toBuilder()
+                .setTotalTimeout(Duration.ofSeconds(30))
+                .build());
+    EchoStubSettings echoSettings = echoSettingsBuilder.build();
+  }
+}
+// [END goldensample_generated_echostubsettings_echo_sync]
diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncFastFibonacci.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncFastFibonacci.golden
new file mode 100644
index 0000000000..8a00e1431b
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/samples/servicesettings/stub/SyncFastFibonacci.golden
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.testdata.v1.stub.samples;
+
+// [START goldensample_generated_deprecatedservicestubsettings_fastfibonacci_sync]
+import com.google.testdata.v1.stub.DeprecatedServiceStubSettings;
+import java.time.Duration;
+
+public class SyncFastFibonacci {
+
+  public static void main(String[] args) throws Exception {
+    syncFastFibonacci();
+  }
+
+  public static void syncFastFibonacci() throws Exception {
+    // This snippet has been automatically generated for illustrative purposes only.
+    // It may require modifications to work in your environment.
+    DeprecatedServiceStubSettings.Builder deprecatedServiceSettingsBuilder =
+        DeprecatedServiceStubSettings.newBuilder();
+    deprecatedServiceSettingsBuilder
+        .fastFibonacciSettings()
+        .setRetrySettings(
+            deprecatedServiceSettingsBuilder
+                .fastFibonacciSettings()
+                .getRetrySettings()
+                .toBuilder()
+                .setTotalTimeout(Duration.ofSeconds(30))
+                .build());
+    DeprecatedServiceStubSettings deprecatedServiceSettings =
+        deprecatedServiceSettingsBuilder.build();
+  }
+}
+// [END goldensample_generated_deprecatedservicestubsettings_fastfibonacci_sync]
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..6660e07be5 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,6 +34,8 @@ import javax.annotation.Generated;
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * 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 fe74c48c98..7fd6d0bc34 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,6 +43,8 @@ import javax.annotation.Generated;
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * ComplianceStubSettings.Builder complianceSettingsBuilder = ComplianceStubSettings.newBuilder();
  * complianceSettingsBuilder
  *     .repeatDataBodySettings()
diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeJavaFormatterTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleBodyJavaFormatterTest.java
similarity index 98%
rename from src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeJavaFormatterTest.java
rename to src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleBodyJavaFormatterTest.java
index 66dce3de40..3947bb5894 100644
--- a/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeJavaFormatterTest.java
+++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleBodyJavaFormatterTest.java
@@ -20,7 +20,7 @@
 import com.google.api.generator.testutils.LineFormatter;
 import org.junit.Test;
 
-public class SampleCodeJavaFormatterTest {
+public class SampleBodyJavaFormatterTest {
 
   @Test
   public void validFormatSampleCode_tryCatchStatement() {
diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleComposerUtilTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleComposerUtilTest.java
new file mode 100644
index 0000000000..05b86ddf1b
--- /dev/null
+++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SampleComposerUtilTest.java
@@ -0,0 +1,148 @@
+// Copyright 2022 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.api.generator.gapic.composer.samplecode;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import com.google.api.generator.engine.ast.ExprStatement;
+import com.google.api.generator.engine.ast.TypeNode;
+import com.google.api.generator.engine.ast.VaporReference;
+import com.google.api.generator.engine.ast.Variable;
+import com.google.api.generator.engine.ast.VariableExpr;
+import com.google.api.generator.gapic.model.RegionTag;
+import com.google.api.generator.gapic.model.Sample;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.junit.Test;
+
+public class SampleComposerUtilTest {
+  private static final String SHOWCASE_PACKAGE_NAME = "com.google.showcase.v1beta1";
+  TypeNode clientType =
+      TypeNode.withReference(
+          VaporReference.builder().setName("EchoClient").setPakkage(SHOWCASE_PACKAGE_NAME).build());
+  VariableExpr echoClientVariableExpr =
+      VariableExpr.withVariable(
+          Variable.builder().setName("echoClient").setType(clientType).build());
+  VariableExpr stringVariableExpr =
+      VariableExpr.withVariable(
+          Variable.builder().setName("String").setType(TypeNode.STRING).build());
+  VariableExpr intVariableExpr =
+      VariableExpr.withVariable(Variable.builder().setName("INT").setType(TypeNode.INT).build());
+  Sample echoClientSample =
+      Sample.builder()
+          .setRegionTag(
+              RegionTag.builder().setServiceName("echoClient").setRpcName("create").build())
+          .setBody(
+              Arrays.asList(
+                  ExprStatement.withExpr(
+                      SampleComposerUtil.assignClientVariableWithCreateMethodExpr(
+                          echoClientVariableExpr))))
+          .build();
+
+  @Test
+  public void assignClientVariableWithCreateMethodExpr() {
+    String result =
+        SampleCodeWriter.write(
+            SampleComposerUtil.assignClientVariableWithCreateMethodExpr(echoClientVariableExpr));
+
+    String expected = "EchoClient echoClient = EchoClient.create();";
+    assertEquals(expected, result);
+  }
+
+  @Test
+  public void createOverloadDisambiguation_noargs() {
+    String result = SampleComposerUtil.createOverloadDisambiguation(new ArrayList<>());
+    String expected = "Noargs";
+    assertEquals(expected, result);
+  }
+
+  @Test
+  public void createOverloadDisambiguation_sameargs() {
+    List methodArgVarExprs = Collections.nCopies(5, stringVariableExpr);
+
+    String result = SampleComposerUtil.createOverloadDisambiguation(methodArgVarExprs);
+    String expected = "StringStringStringStringString";
+    assertEquals(expected, result);
+  }
+
+  @Test
+  public void createOverloadDisambiguation_containsInt() {
+    List methodArgVarExprs =
+        Arrays.asList(echoClientVariableExpr, stringVariableExpr, intVariableExpr);
+
+    String result = SampleComposerUtil.createOverloadDisambiguation(methodArgVarExprs);
+    String expected = "EchoclientStringInt";
+    assertEquals(expected, result);
+  }
+
+  @Test
+  public void handleDuplicateSamples_actualDuplicates() {
+    List samples = Collections.nCopies(5, echoClientSample);
+    assertEquals(samples.size(), 5);
+
+    List result = SampleComposerUtil.handleDuplicateSamples(samples);
+    assertEquals(result.size(), 1);
+    assertEquals(result.get(0), echoClientSample);
+  }
+
+  @Test
+  public void handleDuplicateSamples_distinctDuplicates() {
+    VariableExpr echoClientVariableExprDiffVarName =
+        VariableExpr.withVariable(
+            Variable.builder().setName("echoClient2").setType(clientType).build());
+    Sample echoClientSampleDiffVarName =
+        echoClientSample
+            .toBuilder()
+            .setBody(
+                Arrays.asList(
+                    ExprStatement.withExpr(
+                        SampleComposerUtil.assignClientVariableWithCreateMethodExpr(
+                            echoClientVariableExprDiffVarName))))
+            .build();
+    List samples =
+        Arrays.asList(echoClientSample, echoClientSample, echoClientSampleDiffVarName);
+    assertEquals(samples.size(), 3);
+    assertEquals(samples.get(0).name(), "SyncCreate");
+    assertEquals(samples.get(1).name(), "SyncCreate");
+    assertEquals(samples.get(2).name(), "SyncCreate");
+
+    List result = SampleComposerUtil.handleDuplicateSamples(samples);
+    assertEquals(result.size(), 2);
+    assertTrue(result.contains(echoClientSample));
+    assertTrue(result.stream().filter(s -> s.name().equals("SyncCreate1")).findFirst().isPresent());
+  }
+
+  @Test
+  public void handleDuplicateSamples_notDuplicateName() {
+    Sample echoClientSampleDiffRpcName =
+        echoClientSample.withRegionTag(
+            echoClientSample.regionTag().toBuilder().setRpcName("createB").build());
+
+    List samples =
+        Arrays.asList(echoClientSample, echoClientSample, echoClientSampleDiffRpcName);
+    assertEquals(samples.size(), 3);
+    assertEquals(samples.get(0).name(), "SyncCreate");
+    assertEquals(samples.get(1).name(), "SyncCreate");
+    assertEquals(samples.get(2).name(), "SyncCreateB");
+
+    List result = SampleComposerUtil.handleDuplicateSamples(samples);
+    assertEquals(result.size(), 2);
+    assertTrue(result.contains(echoClientSample));
+    assertTrue(result.contains(echoClientSampleDiffRpcName));
+  }
+}
diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableMethodSampleCodeComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableMethodSampleComposerTest.java
similarity index 82%
rename from src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableMethodSampleCodeComposerTest.java
rename to src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableMethodSampleComposerTest.java
index 92ad4ab22b..2199c2f49d 100644
--- a/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableMethodSampleCodeComposerTest.java
+++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientCallableMethodSampleComposerTest.java
@@ -1,4 +1,4 @@
-// Copyright 2020 Google LLC
+// Copyright 2022 Google LLC
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,36 +14,34 @@
 
 package com.google.api.generator.gapic.composer.samplecode;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-
 import com.google.api.generator.engine.ast.TypeNode;
 import com.google.api.generator.engine.ast.VaporReference;
 import com.google.api.generator.gapic.model.Field;
 import com.google.api.generator.gapic.model.LongrunningOperation;
 import com.google.api.generator.gapic.model.Message;
 import com.google.api.generator.gapic.model.Method;
-import com.google.api.generator.gapic.model.Method.Stream;
 import com.google.api.generator.gapic.model.ResourceName;
+import com.google.api.generator.gapic.model.Sample;
 import com.google.api.generator.gapic.protoparser.Parser;
 import com.google.api.generator.testutils.LineFormatter;
-import com.google.protobuf.Descriptors.FileDescriptor;
+import com.google.protobuf.Descriptors;
 import com.google.showcase.v1beta1.EchoOuterClass;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Map;
+import org.junit.Assert;
 import org.junit.Test;
 
-public class ServiceClientCallableMethodSampleCodeComposerTest {
+public class ServiceClientCallableMethodSampleComposerTest {
   private static final String SHOWCASE_PACKAGE_NAME = "com.google.showcase.v1beta1";
   private static final String LRO_PACKAGE_NAME = "com.google.longrunning";
   private static final String PROTO_PACKAGE_NAME = "com.google.protobuf";
   private static final String PAGINATED_FIELD_NAME = "page_size";
 
-  // ================================LRO Callable Method Sample Code ====================//
+  /*Testing composeLroCallableMethod*/
   @Test
-  public void validComposeLroCallableMethodHeaderSampleCode_withReturnResponse() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeLroCallableMethod_withReturnResponse() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -86,8 +84,9 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnResponse() {
             .setLro(lro)
             .build();
     String results =
-        ServiceClientCallableSampleComposer.composeLroCallableMethodHeaderSampleCode(
-            method, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientCallableMethodSampleComposer.composeLroCallableMethod(
+                method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
@@ -97,12 +96,12 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnResponse() {
             "  // Do something.\n",
             "  WaitResponse response = future.get();\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void validComposeLroCallableMethodHeaderSampleCode_withReturnVoid() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeLroCallableMethod_withReturnVoid() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -142,8 +141,9 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnVoid() {
             .setLro(lro)
             .build();
     String results =
-        ServiceClientCallableSampleComposer.composeLroCallableMethodHeaderSampleCode(
-            method, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientCallableMethodSampleComposer.composeLroCallableMethod(
+                method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
@@ -153,13 +153,13 @@ public void validComposeLroCallableMethodHeaderSampleCode_withReturnVoid() {
             "  // Do something.\n",
             "  future.get();\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
-  // ================================Paged Callable Method Sample Code ====================//
+  /*Testing composePagedCallableMethod*/
   @Test
-  public void validComposePagedCallableMethodHeaderSampleCode() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composePagedCallableMethod() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -188,8 +188,9 @@ public void validComposePagedCallableMethodHeaderSampleCode() {
             .setPageSizeFieldName(PAGINATED_FIELD_NAME)
             .build();
     String results =
-        ServiceClientCallableSampleComposer.composePagedCallableMethodHeaderSampleCode(
-            method, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientCallableMethodSampleComposer.composePagedCallableMethod(
+                method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
@@ -206,12 +207,12 @@ public void validComposePagedCallableMethodHeaderSampleCode() {
             "    // doThingsWith(element);\n",
             "  }\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void invalidComposePagedCallableMethodHeaderSampleCode_inputTypeNotExistInMessage() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void invalid_composePagedCallableMethod_inputTypeNotExistInMessage() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -239,16 +240,16 @@ public void invalidComposePagedCallableMethodHeaderSampleCode_inputTypeNotExistI
             .setOutputType(outputType)
             .setPageSizeFieldName(PAGINATED_FIELD_NAME)
             .build();
-    assertThrows(
+    Assert.assertThrows(
         NullPointerException.class,
         () ->
-            ServiceClientCallableSampleComposer.composePagedCallableMethodHeaderSampleCode(
+            ServiceClientCallableMethodSampleComposer.composePagedCallableMethod(
                 method, clientType, resourceNames, messageTypes));
   }
 
   @Test
-  public void invalidComposePagedCallableMethodHeaderSampleCode_noExistMethodResponse() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void invalid_composePagedCallableMethod_noExistMethodResponse() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -276,16 +277,16 @@ public void invalidComposePagedCallableMethodHeaderSampleCode_noExistMethodRespo
             .setOutputType(outputType)
             .setPageSizeFieldName(PAGINATED_FIELD_NAME)
             .build();
-    assertThrows(
+    Assert.assertThrows(
         NullPointerException.class,
         () ->
-            ServiceClientCallableSampleComposer.composePagedCallableMethodHeaderSampleCode(
+            ServiceClientCallableMethodSampleComposer.composePagedCallableMethod(
                 method, clientType, resourceNames, messageTypes));
   }
 
   @Test
-  public void invalidComposePagedCallableMethodHeaderSampleCode_noRepeatedResponse() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void invalid_composePagedCallableMethod_noRepeatedResponse() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -327,17 +328,17 @@ public void invalidComposePagedCallableMethodHeaderSampleCode_noRepeatedResponse
             .setFields(Arrays.asList(responseField))
             .build();
     messageTypes.put("NoRepeatedResponse", noRepeatedResponseMessage);
-    assertThrows(
+    Assert.assertThrows(
         NullPointerException.class,
         () ->
-            ServiceClientCallableSampleComposer.composePagedCallableMethodHeaderSampleCode(
+            ServiceClientCallableMethodSampleComposer.composePagedCallableMethod(
                 method, clientType, resourceNames, messageTypes));
   }
 
-  // ==============================Stream Callable Method Sample Code ====================//
+  /*Testing composeStreamCallableMethod*/
   @Test
-  public void validComposeStreamCallableMethodHeaderSampleCode_serverStream() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeStreamCallableMethod_serverStream() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -363,28 +364,28 @@ public void validComposeStreamCallableMethodHeaderSampleCode_serverStream() {
             .setName("Expand")
             .setInputType(inputType)
             .setOutputType(outputType)
-            .setStream(Stream.SERVER)
+            .setStream(Method.Stream.SERVER)
             .build();
     String results =
-        ServiceClientCallableSampleComposer.composeStreamCallableMethodHeaderSampleCode(
-            method, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientCallableMethodSampleComposer.composeStreamCallableMethod(
+                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",
+            "      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);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void invalidComposeStreamCallableMethodHeaderSampleCode_serverStreamNotExistRequest() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void invalid_composeStreamCallableMethod_serverStreamNotExistRequest() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -410,18 +411,18 @@ public void invalidComposeStreamCallableMethodHeaderSampleCode_serverStreamNotEx
             .setName("Expand")
             .setInputType(inputType)
             .setOutputType(outputType)
-            .setStream(Stream.SERVER)
+            .setStream(Method.Stream.SERVER)
             .build();
-    assertThrows(
+    Assert.assertThrows(
         NullPointerException.class,
         () ->
-            ServiceClientCallableSampleComposer.composeStreamCallableMethodHeaderSampleCode(
+            ServiceClientCallableMethodSampleComposer.composeStreamCallableMethod(
                 method, clientType, resourceNames, messageTypes));
   }
 
   @Test
-  public void validComposeStreamCallableMethodHeaderSampleCode_bidiStream() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeStreamCallableMethod_bidiStream() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -447,11 +448,12 @@ public void validComposeStreamCallableMethodHeaderSampleCode_bidiStream() {
             .setName("chat")
             .setInputType(inputType)
             .setOutputType(outputType)
-            .setStream(Stream.BIDI)
+            .setStream(Method.Stream.BIDI)
             .build();
     String results =
-        ServiceClientCallableSampleComposer.composeStreamCallableMethodHeaderSampleCode(
-            method, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientCallableMethodSampleComposer.composeStreamCallableMethod(
+                method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
@@ -471,12 +473,12 @@ public void validComposeStreamCallableMethodHeaderSampleCode_bidiStream() {
             "    // Do something when a response is received.\n",
             "  }\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void invalidComposeStreamCallableMethodHeaderSampleCode_bidiStreamNotExistRequest() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void invalid_composeStreamCallableMethod_bidiStreamNotExistRequest() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -502,18 +504,18 @@ public void invalidComposeStreamCallableMethodHeaderSampleCode_bidiStreamNotExis
             .setName("chat")
             .setInputType(inputType)
             .setOutputType(outputType)
-            .setStream(Stream.BIDI)
+            .setStream(Method.Stream.BIDI)
             .build();
-    assertThrows(
+    Assert.assertThrows(
         NullPointerException.class,
         () ->
-            ServiceClientCallableSampleComposer.composeStreamCallableMethodHeaderSampleCode(
+            ServiceClientCallableMethodSampleComposer.composeStreamCallableMethod(
                 method, clientType, resourceNames, messageTypes));
   }
 
   @Test
-  public void validComposeStreamCallableMethodHeaderSampleCode_clientStream() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeStreamCallableMethod_clientStream() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -539,11 +541,12 @@ public void validComposeStreamCallableMethodHeaderSampleCode_clientStream() {
             .setName("Collect")
             .setInputType(inputType)
             .setOutputType(outputType)
-            .setStream(Stream.CLIENT)
+            .setStream(Method.Stream.CLIENT)
             .build();
     String results =
-        ServiceClientCallableSampleComposer.composeStreamCallableMethodHeaderSampleCode(
-            method, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientCallableMethodSampleComposer.composeStreamCallableMethod(
+                method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
@@ -577,12 +580,12 @@ public void validComposeStreamCallableMethodHeaderSampleCode_clientStream() {
             "          .build();\n",
             "  requestObserver.onNext(request);\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void invalidComposeStreamCallableMethodHeaderSampleCode_clientStreamNotExistRequest() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void invalid_composeStreamCallableMethod_clientStreamNotExistRequest() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -608,19 +611,19 @@ public void invalidComposeStreamCallableMethodHeaderSampleCode_clientStreamNotEx
             .setName("Collect")
             .setInputType(inputType)
             .setOutputType(outputType)
-            .setStream(Stream.CLIENT)
+            .setStream(Method.Stream.CLIENT)
             .build();
-    assertThrows(
+    Assert.assertThrows(
         NullPointerException.class,
         () ->
-            ServiceClientCallableSampleComposer.composeStreamCallableMethodHeaderSampleCode(
+            ServiceClientCallableMethodSampleComposer.composeStreamCallableMethod(
                 method, clientType, resourceNames, messageTypes));
   }
 
-  // ================================Regular Callable Method Sample Code ====================//
+  /*Testing composeRegularCallableMethod*/
   @Test
-  public void validComposeRegularCallableMethodHeaderSampleCode_unaryRpc() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeRegularCallableMethod_unaryRpc() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -644,8 +647,9 @@ public void validComposeRegularCallableMethodHeaderSampleCode_unaryRpc() {
     Method method =
         Method.builder().setName("Echo").setInputType(inputType).setOutputType(outputType).build();
     String results =
-        ServiceClientCallableSampleComposer.composeRegularCallableMethodHeaderSampleCode(
-            method, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientCallableMethodSampleComposer.composeRegularCallableMethod(
+                method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
@@ -662,12 +666,12 @@ public void validComposeRegularCallableMethodHeaderSampleCode_unaryRpc() {
             "  // Do something.\n",
             "  EchoResponse response = future.get();\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void validComposeRegularCallableMethodHeaderSampleCode_lroRpc() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeRegularCallableMethod_lroRpc() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -710,8 +714,9 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpc() {
             .setLro(lro)
             .build();
     String results =
-        ServiceClientCallableSampleComposer.composeRegularCallableMethodHeaderSampleCode(
-            method, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientCallableMethodSampleComposer.composeRegularCallableMethod(
+                method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
@@ -720,12 +725,12 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpc() {
             "  // Do something.\n",
             "  Operation response = future.get();\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void validComposeRegularCallableMethodHeaderSampleCode_lroRpcWithReturnVoid() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeRegularCallableMethod_lroRpcWithReturnVoid() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -765,8 +770,9 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpcWithReturnVo
             .setLro(lro)
             .build();
     String results =
-        ServiceClientCallableSampleComposer.composeRegularCallableMethodHeaderSampleCode(
-            method, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientCallableMethodSampleComposer.composeRegularCallableMethod(
+                method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
@@ -775,12 +781,12 @@ public void validComposeRegularCallableMethodHeaderSampleCode_lroRpcWithReturnVo
             "  // Do something.\n",
             "  future.get();\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void validComposeRegularCallableMethodHeaderSampleCode_pageRpc() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeRegularCallableMethod_pageRpc() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -810,8 +816,9 @@ public void validComposeRegularCallableMethodHeaderSampleCode_pageRpc() {
             .setPageSizeFieldName(PAGINATED_FIELD_NAME)
             .build();
     String results =
-        ServiceClientCallableSampleComposer.composeRegularCallableMethodHeaderSampleCode(
-            method, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientCallableMethodSampleComposer.composeRegularCallableMethod(
+                method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
@@ -834,12 +841,12 @@ public void validComposeRegularCallableMethodHeaderSampleCode_pageRpc() {
             "    }\n",
             "  }\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void invalidComposeRegularCallableMethodHeaderSampleCode_noExistMethodRequest() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void invalid_composeRegularCallableMethod_noExistMethodRequest() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -862,16 +869,16 @@ public void invalidComposeRegularCallableMethodHeaderSampleCode_noExistMethodReq
                 .build());
     Method method =
         Method.builder().setName("Echo").setInputType(inputType).setOutputType(outputType).build();
-    assertThrows(
+    Assert.assertThrows(
         NullPointerException.class,
         () ->
-            ServiceClientCallableSampleComposer.composeRegularCallableMethodHeaderSampleCode(
+            ServiceClientCallableMethodSampleComposer.composeRegularCallableMethod(
                 method, clientType, resourceNames, messageTypes));
   }
 
   @Test
-  public void invalidComposeRegularCallableMethodHeaderSampleCode_noExistMethodResponsePagedRpc() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void invalid_composeRegularCallableMethod_noExistMethodResponsePagedRpc() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -899,16 +906,16 @@ public void invalidComposeRegularCallableMethodHeaderSampleCode_noExistMethodRes
             .setOutputType(outputType)
             .setPageSizeFieldName(PAGINATED_FIELD_NAME)
             .build();
-    assertThrows(
+    Assert.assertThrows(
         NullPointerException.class,
         () ->
-            ServiceClientCallableSampleComposer.composeRegularCallableMethodHeaderSampleCode(
+            ServiceClientCallableMethodSampleComposer.composeRegularCallableMethod(
                 method, clientType, resourceNames, messageTypes));
   }
 
   @Test
-  public void invalidComposeRegularCallableMethodHeaderSampleCode_noRepeatedResponsePagedRpc() {
-    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void invalid_composeRegularCallableMethod_noRepeatedResponsePagedRpc() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
@@ -950,10 +957,14 @@ public void invalidComposeRegularCallableMethodHeaderSampleCode_noRepeatedRespon
             .setFields(Arrays.asList(responseField))
             .build();
     messageTypes.put("NoRepeatedResponse", noRepeatedResponseMessage);
-    assertThrows(
+    Assert.assertThrows(
         NullPointerException.class,
         () ->
-            ServiceClientCallableSampleComposer.composeRegularCallableMethodHeaderSampleCode(
+            ServiceClientCallableMethodSampleComposer.composeRegularCallableMethod(
                 method, clientType, resourceNames, messageTypes));
   }
+
+  private String writeStatements(Sample sample) {
+    return SampleCodeWriter.write(sample.body());
+  }
 }
diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientMethodSampleCodeComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientHeaderSampleComposerTest.java
similarity index 76%
rename from src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientMethodSampleCodeComposerTest.java
rename to src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientHeaderSampleComposerTest.java
index b82f706ef2..32ab486356 100644
--- a/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientMethodSampleCodeComposerTest.java
+++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientHeaderSampleComposerTest.java
@@ -14,9 +14,6 @@
 
 package com.google.api.generator.gapic.composer.samplecode;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-
 import com.google.api.generator.engine.ast.ConcreteReference;
 import com.google.api.generator.engine.ast.Reference;
 import com.google.api.generator.engine.ast.TypeNode;
@@ -27,24 +24,319 @@
 import com.google.api.generator.gapic.model.Method;
 import com.google.api.generator.gapic.model.MethodArgument;
 import com.google.api.generator.gapic.model.ResourceName;
+import com.google.api.generator.gapic.model.Sample;
+import com.google.api.generator.gapic.model.Service;
 import com.google.api.generator.gapic.protoparser.Parser;
 import com.google.api.generator.testutils.LineFormatter;
 import com.google.protobuf.Descriptors;
 import com.google.showcase.v1beta1.EchoOuterClass;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import org.junit.Assert;
 import org.junit.Test;
 
-public class ServiceClientMethodSampleCodeComposerTest {
+public class ServiceClientHeaderSampleComposerTest {
   private static final String SHOWCASE_PACKAGE_NAME = "com.google.showcase.v1beta1";
   private static final String LRO_PACKAGE_NAME = "com.google.longrunning";
   private static final String PROTO_PACKAGE_NAME = "com.google.protobuf";
   private static final String PAGINATED_FIELD_NAME = "page_size";
 
+  /*Testing composeClassHeaderSample*/
+  @Test
+  public void composeClassHeaderSample_unaryRpc() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
+    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
+    Set outputResourceNames = new HashSet<>();
+    List services =
+        Parser.parseService(
+            echoFileDescriptor, messageTypes, resourceNames, Optional.empty(), outputResourceNames);
+    Service echoProtoService = services.get(0);
+    TypeNode clientType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoClient")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    Sample sample =
+        ServiceClientHeaderSampleComposer.composeClassHeaderSample(
+            echoProtoService, clientType, resourceNames, messageTypes);
+    String results = writeStatements(sample);
+    String expected =
+        LineFormatter.lines(
+            "try (EchoClient echoClient = EchoClient.create()) {\n",
+            "  EchoResponse response = echoClient.echo();\n",
+            "}");
+    Assert.assertEquals(expected, results);
+  }
+
+  @Test
+  public void composeClassHeaderSample_firstMethodIsNotUnaryRpc() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
+    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
+    TypeNode inputType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("WaitRequest")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    TypeNode outputType =
+        TypeNode.withReference(
+            VaporReference.builder().setName("Operation").setPakkage(LRO_PACKAGE_NAME).build());
+    TypeNode responseType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("WaitResponse")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    TypeNode metadataType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("WaitMetadata")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    LongrunningOperation lro =
+        LongrunningOperation.builder()
+            .setResponseType(responseType)
+            .setMetadataType(metadataType)
+            .build();
+    TypeNode ttlTypeNode =
+        TypeNode.withReference(
+            VaporReference.builder().setName("Duration").setPakkage(PROTO_PACKAGE_NAME).build());
+    MethodArgument ttl =
+        MethodArgument.builder()
+            .setName("ttl")
+            .setType(ttlTypeNode)
+            .setField(
+                Field.builder()
+                    .setName("ttl")
+                    .setType(ttlTypeNode)
+                    .setIsMessage(true)
+                    .setIsContainedInOneof(true)
+                    .build())
+            .build();
+    Method method =
+        Method.builder()
+            .setName("Wait")
+            .setInputType(inputType)
+            .setOutputType(outputType)
+            .setLro(lro)
+            .setMethodSignatures(Arrays.asList(Arrays.asList(ttl)))
+            .build();
+    Service service =
+        Service.builder()
+            .setName("Echo")
+            .setDefaultHost("localhost:7469")
+            .setOauthScopes(Arrays.asList("https://www.googleapis.com/auth/cloud-platform"))
+            .setPakkage(SHOWCASE_PACKAGE_NAME)
+            .setProtoPakkage(SHOWCASE_PACKAGE_NAME)
+            .setOriginalJavaPackage(SHOWCASE_PACKAGE_NAME)
+            .setOverriddenName("Echo")
+            .setMethods(Arrays.asList(method))
+            .build();
+    TypeNode clientType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoClient")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    String results =
+        writeStatements(
+            ServiceClientHeaderSampleComposer.composeClassHeaderSample(
+                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",
+            "}");
+    Assert.assertEquals(results, expected);
+  }
+
+  @Test
+  public void composeClassHeaderSample_firstMethodHasNoSignatures() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
+    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
+    TypeNode inputType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoRequest")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    TypeNode outputType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoResponse")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    Method method =
+        Method.builder()
+            .setName("Echo")
+            .setInputType(inputType)
+            .setOutputType(outputType)
+            .setMethodSignatures(Collections.emptyList())
+            .build();
+    Service service =
+        Service.builder()
+            .setName("Echo")
+            .setDefaultHost("localhost:7469")
+            .setOauthScopes(Arrays.asList("https://www.googleapis.com/auth/cloud-platform"))
+            .setPakkage(SHOWCASE_PACKAGE_NAME)
+            .setProtoPakkage(SHOWCASE_PACKAGE_NAME)
+            .setOriginalJavaPackage(SHOWCASE_PACKAGE_NAME)
+            .setOverriddenName("Echo")
+            .setMethods(Arrays.asList(method))
+            .build();
+    TypeNode clientType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoClient")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    String results =
+        writeStatements(
+            ServiceClientHeaderSampleComposer.composeClassHeaderSample(
+                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",
+            "}");
+    Assert.assertEquals(results, expected);
+  }
+
   @Test
-  public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithMultipleMethodArguments() {
+  public void composeClassHeaderSample_firstMethodIsStream() {
+    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
+    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
+    TypeNode inputType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("ExpandRequest")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    TypeNode outputType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoResponse")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    Method method =
+        Method.builder()
+            .setName("Expand")
+            .setInputType(inputType)
+            .setOutputType(outputType)
+            .setStream(Method.Stream.SERVER)
+            .build();
+    Service service =
+        Service.builder()
+            .setName("Echo")
+            .setDefaultHost("localhost:7469")
+            .setOauthScopes(Arrays.asList("https://www.googleapis.com/auth/cloud-platform"))
+            .setPakkage(SHOWCASE_PACKAGE_NAME)
+            .setProtoPakkage(SHOWCASE_PACKAGE_NAME)
+            .setOriginalJavaPackage(SHOWCASE_PACKAGE_NAME)
+            .setOverriddenName("Echo")
+            .setMethods(Arrays.asList(method))
+            .build();
+    TypeNode clientType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoClient")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    String results =
+        writeStatements(
+            ServiceClientHeaderSampleComposer.composeClassHeaderSample(
+                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",
+            "}");
+    Assert.assertEquals(results, expected);
+  }
+
+  /*Testing composeSetCredentialsSample*/
+  @Test
+  public void composeSetCredentialsSample() {
+    TypeNode clientType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoClient")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    TypeNode settingsType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoSettings")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    String results =
+        writeStatements(
+            ServiceClientHeaderSampleComposer.composeSetCredentialsSample(
+                clientType, settingsType));
+    String expected =
+        LineFormatter.lines(
+            "EchoSettings echoSettings =\n",
+            "    EchoSettings.newBuilder()\n",
+            "        .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))\n",
+            "        .build();\n",
+            "EchoClient echoClient = EchoClient.create(echoSettings);");
+    Assert.assertEquals(expected, results);
+  }
+
+  /*Testing composeSetEndpointSample*/
+  @Test
+  public void composeSetEndpointSample() {
+    TypeNode clientType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoClient")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    TypeNode settingsType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoSettings")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    String results =
+        writeStatements(
+            ServiceClientHeaderSampleComposer.composeSetEndpointSample(clientType, settingsType));
+    String expected =
+        LineFormatter.lines(
+            "EchoSettings echoSettings ="
+                + " EchoSettings.newBuilder().setEndpoint(myEndpoint).build();\n",
+            "EchoClient echoClient = EchoClient.create(echoSettings);");
+    Assert.assertEquals(expected, results);
+  }
+
+  /*Testing composeShowcaseMethodSample*/
+  @Test
+  public void valid_composeShowcaseMethodSample_pagedRpcWithMultipleMethodArguments() {
     Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
@@ -123,8 +415,9 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithMultipleMethodArgu
     messageTypes.put("com.google.showcase.v1beta1.ListContentResponse", listContentResponseMessage);
 
     String results =
-        ServiceClientMethodSampleComposer.composeRpcMethodHeaderSampleCode(
-            method, clientType, arguments, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientHeaderSampleComposer.composeShowcaseMethodSample(
+                method, clientType, arguments, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
@@ -135,11 +428,11 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithMultipleMethodArgu
             "    // doThingsWith(element);\n",
             "  }\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithNoMethodArguments() {
+  public void valid_composeShowcaseMethodSample_pagedRpcWithNoMethodArguments() {
     Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
@@ -196,8 +489,9 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithNoMethodArguments(
     messageTypes.put("com.google.showcase.v1beta1.ListContentResponse", listContentResponseMessage);
 
     String results =
-        ServiceClientMethodSampleComposer.composeRpcMethodHeaderSampleCode(
-            method, clientType, arguments, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientHeaderSampleComposer.composeShowcaseMethodSample(
+                method, clientType, arguments, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
@@ -205,11 +499,11 @@ public void validComposeRpcMethodHeaderSampleCode_pagedRpcWithNoMethodArguments(
             "    // doThingsWith(element);\n",
             "  }\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void invalidComposeRpcMethodHeaderSampleCode_noMatchedRepeatedResponseTypeInPagedMethod() {
+  public void invalid_composeShowcaseMethodSample_noMatchedRepeatedResponseTypeInPagedMethod() {
     Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
@@ -240,15 +534,15 @@ public void invalidComposeRpcMethodHeaderSampleCode_noMatchedRepeatedResponseTyp
             .setOutputType(outputType)
             .setPageSizeFieldName(PAGINATED_FIELD_NAME)
             .build();
-    assertThrows(
+    Assert.assertThrows(
         NullPointerException.class,
         () ->
-            ServiceClientMethodSampleComposer.composeRpcMethodHeaderSampleCode(
+            ServiceClientHeaderSampleComposer.composeShowcaseMethodSample(
                 method, clientType, methodArguments, resourceNames, messageTypes));
   }
 
   @Test
-  public void invalidComposeRpcMethodHeaderSampleCode_noRepeatedResponseTypeInPagedMethod() {
+  public void invalid_composeShowcaseMethodSample_noRepeatedResponseTypeInPagedMethod() {
     Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
@@ -301,313 +595,15 @@ public void invalidComposeRpcMethodHeaderSampleCode_noRepeatedResponseTypeInPage
             .setFields(Arrays.asList(responseField, nextPageToken))
             .build();
     messageTypes.put("PagedResponse", noRepeatedFieldMessage);
-    assertThrows(
+    Assert.assertThrows(
         NullPointerException.class,
         () ->
-            ServiceClientMethodSampleComposer.composeRpcMethodHeaderSampleCode(
+            ServiceClientHeaderSampleComposer.composeShowcaseMethodSample(
                 method, clientType, methodArguments, resourceNames, messageTypes));
   }
 
-  // ================================Unary RPC Default Method Sample Code ====================//
   @Test
-  public void validComposeRpcDefaultMethodHeaderSampleCode_isPagedMethod() {
-    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
-    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
-    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
-    TypeNode clientType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoClient")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode inputType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("PagedExpandRequest")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode outputType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("PagedExpandResponse")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    Method method =
-        Method.builder()
-            .setName("PagedExpand")
-            .setInputType(inputType)
-            .setOutputType(outputType)
-            .setMethodSignatures(Collections.emptyList())
-            .setPageSizeFieldName(PAGINATED_FIELD_NAME)
-            .build();
-    String results =
-        ServiceClientMethodSampleComposer.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);
-  }
-
-  @Test
-  public void invalidComposeRpcDefaultMethodHeaderSampleCode_isPagedMethod() {
-    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
-    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
-    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
-    TypeNode clientType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoClient")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode inputType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("NotExistRequest")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode outputType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("PagedExpandResponse")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    Method method =
-        Method.builder()
-            .setName("PagedExpand")
-            .setInputType(inputType)
-            .setOutputType(outputType)
-            .setMethodSignatures(Collections.emptyList())
-            .setPageSizeFieldName(PAGINATED_FIELD_NAME)
-            .build();
-    assertThrows(
-        NullPointerException.class,
-        () ->
-            ServiceClientMethodSampleComposer.composeRpcDefaultMethodHeaderSampleCode(
-                method, clientType, resourceNames, messageTypes));
-  }
-
-  @Test
-  public void validComposeRpcDefaultMethodHeaderSampleCode_hasLroMethodWithReturnResponse() {
-    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
-    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
-    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
-    TypeNode clientType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoClient")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode inputType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("WaitRequest")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode outputType =
-        TypeNode.withReference(
-            VaporReference.builder().setName("Operation").setPakkage(LRO_PACKAGE_NAME).build());
-    TypeNode responseType =
-        TypeNode.withReference(
-            VaporReference.builder().setName("Empty").setPakkage(PROTO_PACKAGE_NAME).build());
-    TypeNode metadataType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("WaitMetadata")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    LongrunningOperation lro =
-        LongrunningOperation.builder()
-            .setResponseType(responseType)
-            .setMetadataType(metadataType)
-            .build();
-    Method method =
-        Method.builder()
-            .setName("Wait")
-            .setInputType(inputType)
-            .setOutputType(outputType)
-            .setMethodSignatures(Collections.emptyList())
-            .setLro(lro)
-            .build();
-    String results =
-        ServiceClientMethodSampleComposer.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);
-  }
-
-  @Test
-  public void validComposeRpcDefaultMethodHeaderSampleCode_hasLroMethodWithReturnVoid() {
-    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
-    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
-    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
-    TypeNode clientType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoClient")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode inputType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("WaitRequest")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode outputType =
-        TypeNode.withReference(
-            VaporReference.builder().setName("Operation").setPakkage(LRO_PACKAGE_NAME).build());
-    TypeNode responseType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("WaitResponse")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode metadataType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("WaitMetadata")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    LongrunningOperation lro =
-        LongrunningOperation.builder()
-            .setResponseType(responseType)
-            .setMetadataType(metadataType)
-            .build();
-    Method method =
-        Method.builder()
-            .setName("Wait")
-            .setInputType(inputType)
-            .setOutputType(outputType)
-            .setMethodSignatures(Collections.emptyList())
-            .setLro(lro)
-            .build();
-    String results =
-        ServiceClientMethodSampleComposer.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);
-  }
-
-  @Test
-  public void validComposeRpcDefaultMethodHeaderSampleCode_pureUnaryReturnVoid() {
-    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
-    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
-    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
-    TypeNode clientType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoClient")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode inputType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoRequest")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode outputType =
-        TypeNode.withReference(
-            VaporReference.builder().setName("Empty").setPakkage(PROTO_PACKAGE_NAME).build());
-    Method method =
-        Method.builder()
-            .setName("Echo")
-            .setInputType(inputType)
-            .setOutputType(outputType)
-            .setMethodSignatures(Collections.emptyList())
-            .build();
-    String results =
-        ServiceClientMethodSampleComposer.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);
-  }
-
-  @Test
-  public void validComposeRpcDefaultMethodHeaderSampleCode_pureUnaryReturnResponse() {
-    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
-    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
-    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
-    TypeNode clientType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoClient")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode inputType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoRequest")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    TypeNode outputType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoResponse")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    Method method =
-        Method.builder()
-            .setName("Echo")
-            .setInputType(inputType)
-            .setOutputType(outputType)
-            .setMethodSignatures(Collections.emptyList())
-            .build();
-    String results =
-        ServiceClientMethodSampleComposer.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);
-  }
-
-  // ===================================Unary LRO RPC Method Sample Code ======================//
-  @Test
-  public void validComposeRpcMethodHeaderSampleCode_lroUnaryRpcWithNoMethodArgument() {
+  public void valid_composeShowcaseMethodSample_lroUnaryRpcWithNoMethodArgument() {
     Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
@@ -653,18 +649,19 @@ public void validComposeRpcMethodHeaderSampleCode_lroUnaryRpcWithNoMethodArgumen
             .build();
 
     String results =
-        ServiceClientMethodSampleComposer.composeRpcMethodHeaderSampleCode(
-            method, clientType, Collections.emptyList(), resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientHeaderSampleComposer.composeShowcaseMethodSample(
+                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);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnResponseType() {
+  public void valid_composeShowcaseMethodSample_lroRpcWithReturnResponseType() {
     Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
@@ -726,19 +723,20 @@ public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnResponseType()
             .build();
 
     String results =
-        ServiceClientMethodSampleComposer.composeRpcMethodHeaderSampleCode(
-            method, clientType, arguments, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientHeaderSampleComposer.composeShowcaseMethodSample(
+                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);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnVoid() {
+  public void valid_composeShowcaseMethodSample_lroRpcWithReturnVoid() {
     Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
@@ -797,14 +795,19 @@ public void validComposeRpcMethodHeaderSampleCode_lroRpcWithReturnVoid() {
             .build();
 
     String results =
-        ServiceClientMethodSampleComposer.composeRpcMethodHeaderSampleCode(
-            method, clientType, arguments, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientHeaderSampleComposer.composeShowcaseMethodSample(
+                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);
+    Assert.assertEquals(results, expected);
+  }
+
+  private String writeStatements(Sample sample) {
+    return SampleCodeWriter.write(sample.body());
   }
 }
diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientHeaderSampleCodeComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientMethodSampleComposerTest.java
similarity index 54%
rename from src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientHeaderSampleCodeComposerTest.java
rename to src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientMethodSampleComposerTest.java
index 61a67a1da7..bd6366b11f 100644
--- a/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientHeaderSampleCodeComposerTest.java
+++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/ServiceClientMethodSampleComposerTest.java
@@ -1,4 +1,4 @@
-// Copyright 2022 Google LLC
+// Copyright 2020 Google LLC
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,84 +14,140 @@
 
 package com.google.api.generator.gapic.composer.samplecode;
 
-import static org.junit.Assert.assertEquals;
-
 import com.google.api.generator.engine.ast.TypeNode;
 import com.google.api.generator.engine.ast.VaporReference;
-import com.google.api.generator.gapic.model.Field;
 import com.google.api.generator.gapic.model.LongrunningOperation;
 import com.google.api.generator.gapic.model.Message;
 import com.google.api.generator.gapic.model.Method;
-import com.google.api.generator.gapic.model.MethodArgument;
 import com.google.api.generator.gapic.model.ResourceName;
-import com.google.api.generator.gapic.model.Service;
+import com.google.api.generator.gapic.model.Sample;
 import com.google.api.generator.gapic.protoparser.Parser;
 import com.google.api.generator.testutils.LineFormatter;
-import com.google.protobuf.Descriptors;
+import com.google.protobuf.Descriptors.FileDescriptor;
 import com.google.showcase.v1beta1.EchoOuterClass;
-import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
 import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
+import org.junit.Assert;
 import org.junit.Test;
 
-public class ServiceClientHeaderSampleCodeComposerTest {
+public class ServiceClientMethodSampleComposerTest {
   private static final String SHOWCASE_PACKAGE_NAME = "com.google.showcase.v1beta1";
   private static final String LRO_PACKAGE_NAME = "com.google.longrunning";
   private static final String PROTO_PACKAGE_NAME = "com.google.protobuf";
   private static final String PAGINATED_FIELD_NAME = "page_size";
 
-  // =============================== Class Header Sample Code ===============================//
   @Test
-  public void composeClassHeaderMethodSampleCode_unaryRpc() {
-    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeDefaultSample_isPagedMethod() {
+    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
-    Set outputResourceNames = new HashSet<>();
-    List services =
-        Parser.parseService(
-            echoFileDescriptor, messageTypes, resourceNames, Optional.empty(), outputResourceNames);
-    Service echoProtoService = services.get(0);
     TypeNode clientType =
         TypeNode.withReference(
             VaporReference.builder()
                 .setName("EchoClient")
                 .setPakkage(SHOWCASE_PACKAGE_NAME)
                 .build());
+    TypeNode inputType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("PagedExpandRequest")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    TypeNode outputType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("PagedExpandResponse")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    Method method =
+        Method.builder()
+            .setName("PagedExpand")
+            .setInputType(inputType)
+            .setOutputType(outputType)
+            .setMethodSignatures(Collections.emptyList())
+            .setPageSizeFieldName(PAGINATED_FIELD_NAME)
+            .build();
     String results =
-        ServiceClientHeaderSampleComposer.composeClassHeaderMethodSampleCode(
-            echoProtoService, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientMethodSampleComposer.composeCanonicalSample(
+                method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
             "try (EchoClient echoClient = EchoClient.create()) {\n",
-            "  EchoResponse response = echoClient.echo();\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(expected, results);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void composeClassHeaderMethodSampleCode_firstMethodIsNotUnaryRpc() {
-    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void invalid_composeDefaultSample_isPagedMethod() {
+    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
+    TypeNode clientType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoClient")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
     TypeNode inputType =
         TypeNode.withReference(
             VaporReference.builder()
-                .setName("WaitRequest")
+                .setName("NotExistRequest")
                 .setPakkage(SHOWCASE_PACKAGE_NAME)
                 .build());
     TypeNode outputType =
         TypeNode.withReference(
-            VaporReference.builder().setName("Operation").setPakkage(LRO_PACKAGE_NAME).build());
-    TypeNode responseType =
+            VaporReference.builder()
+                .setName("PagedExpandResponse")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    Method method =
+        Method.builder()
+            .setName("PagedExpand")
+            .setInputType(inputType)
+            .setOutputType(outputType)
+            .setMethodSignatures(Collections.emptyList())
+            .setPageSizeFieldName(PAGINATED_FIELD_NAME)
+            .build();
+    Assert.assertThrows(
+        NullPointerException.class,
+        () ->
+            ServiceClientMethodSampleComposer.composeCanonicalSample(
+                method, clientType, resourceNames, messageTypes));
+  }
+
+  @Test
+  public void valid_composeDefaultSample_hasLroMethodWithReturnResponse() {
+    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
+    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
+    TypeNode clientType =
         TypeNode.withReference(
             VaporReference.builder()
-                .setName("WaitResponse")
+                .setName("EchoClient")
                 .setPakkage(SHOWCASE_PACKAGE_NAME)
                 .build());
+    TypeNode inputType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("WaitRequest")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    TypeNode outputType =
+        TypeNode.withReference(
+            VaporReference.builder().setName("Operation").setPakkage(LRO_PACKAGE_NAME).build());
+    TypeNode responseType =
+        TypeNode.withReference(
+            VaporReference.builder().setName("Empty").setPakkage(PROTO_PACKAGE_NAME).build());
     TypeNode metadataType =
         TypeNode.withReference(
             VaporReference.builder()
@@ -103,226 +159,185 @@ public void composeClassHeaderMethodSampleCode_firstMethodIsNotUnaryRpc() {
             .setResponseType(responseType)
             .setMetadataType(metadataType)
             .build();
-    TypeNode ttlTypeNode =
-        TypeNode.withReference(
-            VaporReference.builder().setName("Duration").setPakkage(PROTO_PACKAGE_NAME).build());
-    MethodArgument ttl =
-        MethodArgument.builder()
-            .setName("ttl")
-            .setType(ttlTypeNode)
-            .setField(
-                Field.builder()
-                    .setName("ttl")
-                    .setType(ttlTypeNode)
-                    .setIsMessage(true)
-                    .setIsContainedInOneof(true)
-                    .build())
-            .build();
     Method method =
         Method.builder()
             .setName("Wait")
             .setInputType(inputType)
             .setOutputType(outputType)
+            .setMethodSignatures(Collections.emptyList())
             .setLro(lro)
-            .setMethodSignatures(Arrays.asList(Arrays.asList(ttl)))
-            .build();
-    Service service =
-        Service.builder()
-            .setName("Echo")
-            .setDefaultHost("localhost:7469")
-            .setOauthScopes(Arrays.asList("https://www.googleapis.com/auth/cloud-platform"))
-            .setPakkage(SHOWCASE_PACKAGE_NAME)
-            .setProtoPakkage(SHOWCASE_PACKAGE_NAME)
-            .setOriginalJavaPackage(SHOWCASE_PACKAGE_NAME)
-            .setOverriddenName("Echo")
-            .setMethods(Arrays.asList(method))
             .build();
-    TypeNode clientType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoClient")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
     String results =
-        ServiceClientHeaderSampleComposer.composeClassHeaderMethodSampleCode(
-            service, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientMethodSampleComposer.composeCanonicalSample(
+                method, 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",
+            "  WaitRequest request = WaitRequest.newBuilder().build();\n",
+            "  echoClient.waitAsync(request).get();\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void composeClassHeaderMethodSampleCode_firstMethodHasNoSignatures() {
-    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeDefaultSample_hasLroMethodWithReturnVoid() {
+    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
+    TypeNode clientType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("EchoClient")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
     TypeNode inputType =
         TypeNode.withReference(
             VaporReference.builder()
-                .setName("EchoRequest")
+                .setName("WaitRequest")
                 .setPakkage(SHOWCASE_PACKAGE_NAME)
                 .build());
     TypeNode outputType =
+        TypeNode.withReference(
+            VaporReference.builder().setName("Operation").setPakkage(LRO_PACKAGE_NAME).build());
+    TypeNode responseType =
         TypeNode.withReference(
             VaporReference.builder()
-                .setName("EchoResponse")
+                .setName("WaitResponse")
                 .setPakkage(SHOWCASE_PACKAGE_NAME)
                 .build());
+    TypeNode metadataType =
+        TypeNode.withReference(
+            VaporReference.builder()
+                .setName("WaitMetadata")
+                .setPakkage(SHOWCASE_PACKAGE_NAME)
+                .build());
+    LongrunningOperation lro =
+        LongrunningOperation.builder()
+            .setResponseType(responseType)
+            .setMetadataType(metadataType)
+            .build();
     Method method =
         Method.builder()
-            .setName("Echo")
+            .setName("Wait")
             .setInputType(inputType)
             .setOutputType(outputType)
             .setMethodSignatures(Collections.emptyList())
+            .setLro(lro)
             .build();
-    Service service =
-        Service.builder()
-            .setName("Echo")
-            .setDefaultHost("localhost:7469")
-            .setOauthScopes(Arrays.asList("https://www.googleapis.com/auth/cloud-platform"))
-            .setPakkage(SHOWCASE_PACKAGE_NAME)
-            .setProtoPakkage(SHOWCASE_PACKAGE_NAME)
-            .setOriginalJavaPackage(SHOWCASE_PACKAGE_NAME)
-            .setOverriddenName("Echo")
-            .setMethods(Arrays.asList(method))
-            .build();
-    TypeNode clientType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoClient")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
     String results =
-        ServiceClientHeaderSampleComposer.composeClassHeaderMethodSampleCode(
-            service, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientMethodSampleComposer.composeCanonicalSample(
+                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",
+            "  WaitRequest request = WaitRequest.newBuilder().build();\n",
+            "  WaitResponse response = echoClient.waitAsync(request).get();\n",
             "}");
-    assertEquals(results, expected);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void composeClassHeaderMethodSampleCode_firstMethodIsStream() {
-    Descriptors.FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+  public void valid_composeDefaultSample_pureUnaryReturnVoid() {
+    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
     Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
     Map messageTypes = Parser.parseMessages(echoFileDescriptor);
-    TypeNode inputType =
+    TypeNode clientType =
         TypeNode.withReference(
             VaporReference.builder()
-                .setName("ExpandRequest")
+                .setName("EchoClient")
                 .setPakkage(SHOWCASE_PACKAGE_NAME)
                 .build());
-    TypeNode outputType =
+    TypeNode inputType =
         TypeNode.withReference(
             VaporReference.builder()
-                .setName("EchoResponse")
+                .setName("EchoRequest")
                 .setPakkage(SHOWCASE_PACKAGE_NAME)
                 .build());
+    TypeNode outputType =
+        TypeNode.withReference(
+            VaporReference.builder().setName("Empty").setPakkage(PROTO_PACKAGE_NAME).build());
     Method method =
         Method.builder()
-            .setName("Expand")
+            .setName("Echo")
             .setInputType(inputType)
             .setOutputType(outputType)
-            .setStream(Method.Stream.SERVER)
-            .build();
-    Service service =
-        Service.builder()
-            .setName("Echo")
-            .setDefaultHost("localhost:7469")
-            .setOauthScopes(Arrays.asList("https://www.googleapis.com/auth/cloud-platform"))
-            .setPakkage(SHOWCASE_PACKAGE_NAME)
-            .setProtoPakkage(SHOWCASE_PACKAGE_NAME)
-            .setOriginalJavaPackage(SHOWCASE_PACKAGE_NAME)
-            .setOverriddenName("Echo")
-            .setMethods(Arrays.asList(method))
+            .setMethodSignatures(Collections.emptyList())
             .build();
-    TypeNode clientType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoClient")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
     String results =
-        ServiceClientHeaderSampleComposer.composeClassHeaderMethodSampleCode(
-            service, clientType, resourceNames, messageTypes);
+        writeStatements(
+            ServiceClientMethodSampleComposer.composeCanonicalSample(
+                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",
+            "  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);
+    Assert.assertEquals(results, expected);
   }
 
   @Test
-  public void composeClassHeaderCredentialsSampleCode() {
+  public void valid_composeDefaultSample_pureUnaryReturnResponse() {
+    FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
+    Map resourceNames = Parser.parseResourceNames(echoFileDescriptor);
+    Map messageTypes = Parser.parseMessages(echoFileDescriptor);
     TypeNode clientType =
         TypeNode.withReference(
             VaporReference.builder()
                 .setName("EchoClient")
                 .setPakkage(SHOWCASE_PACKAGE_NAME)
                 .build());
-    TypeNode settingsType =
-        TypeNode.withReference(
-            VaporReference.builder()
-                .setName("EchoSettings")
-                .setPakkage(SHOWCASE_PACKAGE_NAME)
-                .build());
-    String results =
-        ServiceClientHeaderSampleComposer.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);");
-    assertEquals(expected, results);
-  }
-
-  @Test
-  public void composeClassHeaderEndpointSampleCode() {
-    TypeNode clientType =
+    TypeNode inputType =
         TypeNode.withReference(
             VaporReference.builder()
-                .setName("EchoClient")
+                .setName("EchoRequest")
                 .setPakkage(SHOWCASE_PACKAGE_NAME)
                 .build());
-    TypeNode settingsType =
+    TypeNode outputType =
         TypeNode.withReference(
             VaporReference.builder()
-                .setName("EchoSettings")
+                .setName("EchoResponse")
                 .setPakkage(SHOWCASE_PACKAGE_NAME)
                 .build());
+    Method method =
+        Method.builder()
+            .setName("Echo")
+            .setInputType(inputType)
+            .setOutputType(outputType)
+            .setMethodSignatures(Collections.emptyList())
+            .build();
     String results =
-        ServiceClientHeaderSampleComposer.composeClassHeaderEndpointSampleCode(
-            clientType, settingsType);
+        writeStatements(
+            ServiceClientMethodSampleComposer.composeCanonicalSample(
+                method, clientType, resourceNames, messageTypes));
     String expected =
         LineFormatter.lines(
-            "EchoSettings echoSettings ="
-                + " EchoSettings.newBuilder().setEndpoint(myEndpoint).build();\n",
-            "EchoClient echoClient = EchoClient.create(echoSettings);");
-    assertEquals(expected, results);
+            "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",
+            "}");
+    Assert.assertEquals(results, expected);
+  }
+
+  private String writeStatements(Sample sample) {
+    return SampleCodeWriter.write(sample.body());
   }
 }
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/SettingsSampleComposerTest.java
similarity index 77%
rename from src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java
rename to src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleComposerTest.java
index a62d57275c..33e428efeb 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/SettingsSampleComposerTest.java
@@ -18,13 +18,14 @@
 
 import com.google.api.generator.engine.ast.TypeNode;
 import com.google.api.generator.engine.ast.VaporReference;
+import com.google.api.generator.gapic.model.Sample;
 import com.google.api.generator.testutils.LineFormatter;
 import java.util.Optional;
 import org.junit.Test;
 
-public class SettingsSampleCodeComposerTest {
+public class SettingsSampleComposerTest {
   @Test
-  public void composeSettingsSampleCode_noMethods() {
+  public void composeSettingsSample_noMethods() {
     TypeNode classType =
         TypeNode.withReference(
             VaporReference.builder()
@@ -32,12 +33,14 @@ public void composeSettingsSampleCode_noMethods() {
                 .setPakkage("com.google.showcase.v1beta1")
                 .build());
     Optional results =
-        SettingsSampleCodeComposer.composeSampleCode(Optional.empty(), "EchoSettings", classType);
+        writeSample(
+            SettingsSampleComposer.composeSettingsSample(
+                Optional.empty(), "EchoSettings", classType));
     assertEquals(results, Optional.empty());
   }
 
   @Test
-  public void composeSettingsSampleCode_serviceSettingsClass() {
+  public void composeSettingsSample_serviceSettingsClass() {
     TypeNode classType =
         TypeNode.withReference(
             VaporReference.builder()
@@ -45,8 +48,9 @@ public void composeSettingsSampleCode_serviceSettingsClass() {
                 .setPakkage("com.google.showcase.v1beta1")
                 .build());
     Optional results =
-        SettingsSampleCodeComposer.composeSampleCode(
-            Optional.of("Echo"), "EchoSettings", classType);
+        writeSample(
+            SettingsSampleComposer.composeSettingsSample(
+                Optional.of("Echo"), "EchoSettings", classType));
     String expected =
         LineFormatter.lines(
             "EchoSettings.Builder echoSettingsBuilder = EchoSettings.newBuilder();\n",
@@ -64,7 +68,7 @@ public void composeSettingsSampleCode_serviceSettingsClass() {
   }
 
   @Test
-  public void composeSettingsSampleCode_serviceStubClass() {
+  public void composeSettingsSample_serviceStubClass() {
     TypeNode classType =
         TypeNode.withReference(
             VaporReference.builder()
@@ -72,8 +76,9 @@ public void composeSettingsSampleCode_serviceStubClass() {
                 .setPakkage("com.google.showcase.v1beta1")
                 .build());
     Optional results =
-        SettingsSampleCodeComposer.composeSampleCode(
-            Optional.of("Echo"), "EchoSettings", classType);
+        writeSample(
+            SettingsSampleComposer.composeSettingsSample(
+                Optional.of("Echo"), "EchoSettings", classType));
     String expected =
         LineFormatter.lines(
             "EchoStubSettings.Builder echoSettingsBuilder = EchoStubSettings.newBuilder();\n",
@@ -89,4 +94,11 @@ public void composeSettingsSampleCode_serviceStubClass() {
             "EchoStubSettings echoSettings = echoSettingsBuilder.build();");
     assertEquals(results.get(), expected);
   }
+
+  private Optional writeSample(Optional sample) {
+    if (sample.isPresent()) {
+      return Optional.of(SampleCodeWriter.write(sample.get().body()));
+    }
+    return Optional.empty();
+  }
 }
diff --git a/src/test/java/com/google/api/generator/gapic/model/SampleTest.java b/src/test/java/com/google/api/generator/gapic/model/SampleTest.java
index 566c4f37d6..7b880ba394 100644
--- a/src/test/java/com/google/api/generator/gapic/model/SampleTest.java
+++ b/src/test/java/com/google/api/generator/gapic/model/SampleTest.java
@@ -46,6 +46,7 @@ public void sampleValidMissingFields() {
     Assert.assertEquals(ImmutableList.of(), sample.fileHeader());
     Assert.assertEquals(ImmutableList.of(), sample.body());
     Assert.assertEquals(ImmutableList.of(), sample.variableAssignments());
+    Assert.assertEquals(false, sample.isCanonical());
   }
 
   @Test
@@ -70,4 +71,30 @@ public void sampleNameWithRegionTag() {
     sample = sample.withRegionTag(rt);
     Assert.assertEquals("AsyncRpcNameDisambiguation", sample.name());
   }
+
+  @Test
+  public void sampleNameWithRegionTagCanonical() {
+    String disambig = "Disambiguation";
+    Sample sample =
+        Sample.builder().setRegionTag(regionTag.withOverloadDisambiguation(disambig)).build();
+    Assert.assertEquals(disambig, sample.regionTag().overloadDisambiguation());
+
+    sample = sample.toBuilder().setIsCanonical(true).build();
+    disambig = "NewDisambiguation";
+    sample.withRegionTag(regionTag.withOverloadDisambiguation(disambig));
+    Assert.assertEquals("", sample.regionTag().overloadDisambiguation());
+  }
+
+  @Test
+  public void sampleCanonicalOverload() {
+    String disambig = "Disambiguation";
+    Sample sample =
+        Sample.builder().setRegionTag(regionTag.withOverloadDisambiguation(disambig)).build();
+    Assert.assertEquals(disambig, sample.regionTag().overloadDisambiguation());
+    Assert.assertEquals(false, sample.isCanonical());
+
+    sample = sample.toBuilder().setIsCanonical(true).build();
+    Assert.assertEquals("", sample.regionTag().overloadDisambiguation());
+    Assert.assertEquals(true, sample.isCanonical());
+  }
 }
diff --git a/src/test/java/com/google/api/generator/test/framework/Assert.java b/src/test/java/com/google/api/generator/test/framework/Assert.java
index 4ed6a932fd..20bc71b9b1 100644
--- a/src/test/java/com/google/api/generator/test/framework/Assert.java
+++ b/src/test/java/com/google/api/generator/test/framework/Assert.java
@@ -14,8 +14,16 @@
 
 package com.google.api.generator.test.framework;
 
+import com.google.api.generator.engine.writer.JavaWriterVisitor;
+import com.google.api.generator.gapic.composer.comment.CommentComposer;
+import com.google.api.generator.gapic.composer.samplecode.SampleCodeWriter;
+import com.google.api.generator.gapic.model.GapicClass;
+import com.google.api.generator.gapic.model.Sample;
 import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
 import java.util.List;
+import java.util.stream.Collectors;
 import junit.framework.AssertionFailedError;
 
 public class Assert {
@@ -41,4 +49,38 @@ public static void assertCodeEquals(String expected, String codegen) {
       throw new AssertionFailedError("Differences found: \n" + String.join("\n", diffList));
     }
   }
+
+  public static void assertEmptySamples(List samples) {
+    if (!samples.isEmpty()) {
+      List diffList = samples.stream().map(Sample::name).collect(Collectors.toList());
+      throw new AssertionFailedError("Differences found: \n" + String.join("\n", diffList));
+    }
+  }
+
+  public static void assertGoldenClass(Class clazz, GapicClass gapicClass, String fileName) {
+    JavaWriterVisitor visitor = new JavaWriterVisitor();
+    gapicClass.classDefinition().accept(visitor);
+    Utils.saveCodegenToFile(clazz, fileName, visitor.write());
+    Path goldenFilePath = Paths.get(Utils.getGoldenDir(clazz), fileName);
+    Assert.assertCodeEquals(goldenFilePath, visitor.write());
+  }
+
+  public static void assertGoldenSamples(
+      Class clazz, String sampleDirName, String packkage, List samples) {
+    for (Sample sample : samples) {
+      String fileName = sample.generateSampleFileName() + ".golden";
+      String goldenSampleDir =
+          Utils.getGoldenDir(clazz) + "/samples/" + sampleDirName.toLowerCase() + "/";
+      Path goldenFilePath = Paths.get(goldenSampleDir, fileName);
+      sample =
+          sample
+              .withHeader(Arrays.asList(CommentComposer.APACHE_LICENSE_COMMENT))
+              .withRegionTag(sample.regionTag().withApiShortName("goldenSample"));
+
+      String sampleString = SampleCodeWriter.writeExecutableSample(sample, packkage + ".samples");
+
+      Utils.saveSampleCodegenToFile(clazz, sampleDirName.toLowerCase(), fileName, sampleString);
+      assertCodeEquals(goldenFilePath, sampleString);
+    }
+  }
 }
diff --git a/src/test/java/com/google/api/generator/test/framework/Differ.java b/src/test/java/com/google/api/generator/test/framework/Differ.java
index 74e5d76135..eea5c7b937 100644
--- a/src/test/java/com/google/api/generator/test/framework/Differ.java
+++ b/src/test/java/com/google/api/generator/test/framework/Differ.java
@@ -44,7 +44,7 @@ public static List diff(String expectedStr, String actualStr) {
     return diffTwoStringLists(original, revised);
   }
 
-  private static List diffTwoStringLists(List original, List revised) {
+  static List diffTwoStringLists(List original, List revised) {
     Patch diff = null;
     try {
       diff = DiffUtils.diff(original, revised);
diff --git a/src/test/java/com/google/api/generator/test/framework/Utils.java b/src/test/java/com/google/api/generator/test/framework/Utils.java
index 3d5a4359ab..cb423046fb 100644
--- a/src/test/java/com/google/api/generator/test/framework/Utils.java
+++ b/src/test/java/com/google/api/generator/test/framework/Utils.java
@@ -34,6 +34,16 @@ public class Utils {
    */
   public static void saveCodegenToFile(Class clazz, String fileName, String codegen) {
     String relativeGoldenDir = getTestoutGoldenDir(clazz);
+    saveCodeToFile(relativeGoldenDir, fileName, codegen);
+  }
+
+  public static void saveSampleCodegenToFile(
+      Class clazz, String sampleDir, String fileName, String codegen) {
+    String relativeGoldenDir = getTestoutGoldenDir(clazz) + "/samples/" + sampleDir;
+    saveCodeToFile(relativeGoldenDir, fileName, codegen);
+  }
+
+  private static void saveCodeToFile(String relativeGoldenDir, String fileName, String codegen) {
     Path testOutputDir = Paths.get("src", "test", "java", relativeGoldenDir);
 
     // Auto-detect project workspace when running `bazel run //:update_TargetTest`.
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 872d51b763..501a2c124d 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,6 +47,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
  *   BatchGetAssetsHistoryRequest request =
  *       BatchGetAssetsHistoryRequest.newBuilder()
@@ -89,6 +91,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * AssetServiceSettings assetServiceSettings =
  *     AssetServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -99,6 +103,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * AssetServiceSettings assetServiceSettings =
  *     AssetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  * AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
@@ -183,6 +189,8 @@ public final OperationsClient getOperationsClient() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   ExportAssetsRequest request =
    *       ExportAssetsRequest.newBuilder()
@@ -219,6 +227,8 @@ public final OperationFuture exportAs
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   ExportAssetsRequest request =
    *       ExportAssetsRequest.newBuilder()
@@ -255,6 +265,8 @@ public final OperationFuture exportAs
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   ExportAssetsRequest request =
    *       ExportAssetsRequest.newBuilder()
@@ -282,6 +294,8 @@ public final UnaryCallable exportAssetsCallable(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   ResourceName parent = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
    *   for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
@@ -309,6 +323,8 @@ public final ListAssetsPagedResponse listAssets(ResourceName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   String parent = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
    *   for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
@@ -335,6 +351,8 @@ public final ListAssetsPagedResponse listAssets(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   ListAssetsRequest request =
    *       ListAssetsRequest.newBuilder()
@@ -366,6 +384,8 @@ public final ListAssetsPagedResponse listAssets(ListAssetsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   ListAssetsRequest request =
    *       ListAssetsRequest.newBuilder()
@@ -396,6 +416,8 @@ public final UnaryCallable listAsset
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   ListAssetsRequest request =
    *       ListAssetsRequest.newBuilder()
@@ -437,6 +459,8 @@ public final UnaryCallable listAssetsCall
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   BatchGetAssetsHistoryRequest request =
    *       BatchGetAssetsHistoryRequest.newBuilder()
@@ -469,6 +493,8 @@ public final BatchGetAssetsHistoryResponse batchGetAssetsHistory(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   BatchGetAssetsHistoryRequest request =
    *       BatchGetAssetsHistoryRequest.newBuilder()
@@ -497,6 +523,8 @@ public final BatchGetAssetsHistoryResponse batchGetAssetsHistory(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   String parent = "parent-995424086";
    *   Feed response = assetServiceClient.createFeed(parent);
@@ -521,6 +549,8 @@ public final Feed createFeed(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   CreateFeedRequest request =
    *       CreateFeedRequest.newBuilder()
@@ -546,6 +576,8 @@ public final Feed createFeed(CreateFeedRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   CreateFeedRequest request =
    *       CreateFeedRequest.newBuilder()
@@ -570,6 +602,8 @@ public final UnaryCallable createFeedCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
    *   Feed response = assetServiceClient.getFeed(name);
@@ -594,6 +628,8 @@ public final Feed getFeed(FeedName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
    *   Feed response = assetServiceClient.getFeed(name);
@@ -617,6 +653,8 @@ public final Feed getFeed(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   GetFeedRequest request =
    *       GetFeedRequest.newBuilder()
@@ -640,6 +678,8 @@ public final Feed getFeed(GetFeedRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   GetFeedRequest request =
    *       GetFeedRequest.newBuilder()
@@ -662,6 +702,8 @@ public final UnaryCallable getFeedCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   String parent = "parent-995424086";
    *   ListFeedsResponse response = assetServiceClient.listFeeds(parent);
@@ -685,6 +727,8 @@ public final ListFeedsResponse listFeeds(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   ListFeedsRequest request =
    *       ListFeedsRequest.newBuilder().setParent("parent-995424086").build();
@@ -706,6 +750,8 @@ public final ListFeedsResponse listFeeds(ListFeedsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   ListFeedsRequest request =
    *       ListFeedsRequest.newBuilder().setParent("parent-995424086").build();
@@ -727,6 +773,8 @@ public final UnaryCallable listFeedsCallabl
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   Feed feed = Feed.newBuilder().build();
    *   Feed response = assetServiceClient.updateFeed(feed);
@@ -750,6 +798,8 @@ public final Feed updateFeed(Feed feed) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   UpdateFeedRequest request =
    *       UpdateFeedRequest.newBuilder()
@@ -774,6 +824,8 @@ public final Feed updateFeed(UpdateFeedRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   UpdateFeedRequest request =
    *       UpdateFeedRequest.newBuilder()
@@ -797,6 +849,8 @@ public final UnaryCallable updateFeedCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
    *   assetServiceClient.deleteFeed(name);
@@ -821,6 +875,8 @@ public final void deleteFeed(FeedName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
    *   assetServiceClient.deleteFeed(name);
@@ -844,6 +900,8 @@ public final void deleteFeed(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   DeleteFeedRequest request =
    *       DeleteFeedRequest.newBuilder()
@@ -867,6 +925,8 @@ public final void deleteFeed(DeleteFeedRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   DeleteFeedRequest request =
    *       DeleteFeedRequest.newBuilder()
@@ -891,6 +951,8 @@ public final UnaryCallable deleteFeedCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   String scope = "scope109264468";
    *   String query = "query107944136";
@@ -985,6 +1047,8 @@ public final SearchAllResourcesPagedResponse searchAllResources(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   SearchAllResourcesRequest request =
    *       SearchAllResourcesRequest.newBuilder()
@@ -1020,6 +1084,8 @@ public final SearchAllResourcesPagedResponse searchAllResources(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   SearchAllResourcesRequest request =
    *       SearchAllResourcesRequest.newBuilder()
@@ -1054,6 +1120,8 @@ public final SearchAllResourcesPagedResponse searchAllResources(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   SearchAllResourcesRequest request =
    *       SearchAllResourcesRequest.newBuilder()
@@ -1095,6 +1163,8 @@ public final SearchAllResourcesPagedResponse searchAllResources(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   String scope = "scope109264468";
    *   String query = "query107944136";
@@ -1171,6 +1241,8 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(String scope
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   SearchAllIamPoliciesRequest request =
    *       SearchAllIamPoliciesRequest.newBuilder()
@@ -1205,6 +1277,8 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   SearchAllIamPoliciesRequest request =
    *       SearchAllIamPoliciesRequest.newBuilder()
@@ -1238,6 +1312,8 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   SearchAllIamPoliciesRequest request =
    *       SearchAllIamPoliciesRequest.newBuilder()
@@ -1276,6 +1352,8 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   AnalyzeIamPolicyRequest request =
    *       AnalyzeIamPolicyRequest.newBuilder()
@@ -1300,6 +1378,8 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   AnalyzeIamPolicyRequest request =
    *       AnalyzeIamPolicyRequest.newBuilder()
@@ -1332,6 +1412,8 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   AnalyzeIamPolicyLongrunningRequest request =
    *       AnalyzeIamPolicyLongrunningRequest.newBuilder()
@@ -1366,6 +1448,8 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   AnalyzeIamPolicyLongrunningRequest request =
    *       AnalyzeIamPolicyLongrunningRequest.newBuilder()
@@ -1402,6 +1486,8 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   AnalyzeIamPolicyLongrunningRequest request =
    *       AnalyzeIamPolicyLongrunningRequest.newBuilder()
@@ -1430,6 +1516,8 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   AnalyzeMoveRequest request =
    *       AnalyzeMoveRequest.newBuilder()
@@ -1457,6 +1545,8 @@ public final AnalyzeMoveResponse analyzeMove(AnalyzeMoveRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
    *   AnalyzeMoveRequest request =
    *       AnalyzeMoveRequest.newBuilder()
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 7fa69d5191..24fe05b9e5 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,6 +58,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * AssetServiceSettings.Builder assetServiceSettingsBuilder = AssetServiceSettings.newBuilder();
  * assetServiceSettingsBuilder
  *     .batchGetAssetsHistorySettings()
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 cb0c5531a1..e98658c5b0 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,6 +24,8 @@
  * 

Sample for AssetServiceClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
  *   BatchGetAssetsHistoryRequest request =
  *       BatchGetAssetsHistoryRequest.newBuilder()
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 4b5ca31957..842073522f 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,6 +102,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * AssetServiceStubSettings.Builder assetServiceSettingsBuilder =
  *     AssetServiceStubSettings.newBuilder();
  * assetServiceSettingsBuilder
diff --git a/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/BaseBigtableDataClient.java b/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/BaseBigtableDataClient.java
index f7ab00af96..b1543dcdca 100644
--- a/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/BaseBigtableDataClient.java
+++ b/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/BaseBigtableDataClient.java
@@ -52,6 +52,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
  *   TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
  *   ByteString rowKey = ByteString.EMPTY;
@@ -90,6 +92,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * BaseBigtableDataSettings baseBigtableDataSettings =
  *     BaseBigtableDataSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -101,6 +105,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * BaseBigtableDataSettings baseBigtableDataSettings =
  *     BaseBigtableDataSettings.newBuilder().setEndpoint(myEndpoint).build();
  * BaseBigtableDataClient baseBigtableDataClient =
@@ -172,6 +178,8 @@ public BigtableStub getStub() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   ReadRowsRequest request =
    *       ReadRowsRequest.newBuilder()
@@ -202,6 +210,8 @@ public final ServerStreamingCallable readRows
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   SampleRowKeysRequest request =
    *       SampleRowKeysRequest.newBuilder()
@@ -229,6 +239,8 @@ public final ServerStreamingCallable readRows
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
    *   ByteString rowKey = ByteString.EMPTY;
@@ -265,6 +277,8 @@ public final MutateRowResponse mutateRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   String tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
    *   ByteString rowKey = ByteString.EMPTY;
@@ -301,6 +315,8 @@ public final MutateRowResponse mutateRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
    *   ByteString rowKey = ByteString.EMPTY;
@@ -342,6 +358,8 @@ public final MutateRowResponse mutateRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   String tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
    *   ByteString rowKey = ByteString.EMPTY;
@@ -383,6 +401,8 @@ public final MutateRowResponse mutateRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   MutateRowRequest request =
    *       MutateRowRequest.newBuilder()
@@ -410,6 +430,8 @@ public final MutateRowResponse mutateRow(MutateRowRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   MutateRowRequest request =
    *       MutateRowRequest.newBuilder()
@@ -437,6 +459,8 @@ public final UnaryCallable mutateRowCallabl
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   MutateRowsRequest request =
    *       MutateRowsRequest.newBuilder()
@@ -463,6 +487,8 @@ public final ServerStreamingCallable muta
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
    *   ByteString rowKey = ByteString.EMPTY;
@@ -516,6 +542,8 @@ public final CheckAndMutateRowResponse checkAndMutateRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   String tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
    *   ByteString rowKey = ByteString.EMPTY;
@@ -569,6 +597,8 @@ public final CheckAndMutateRowResponse checkAndMutateRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
    *   ByteString rowKey = ByteString.EMPTY;
@@ -627,6 +657,8 @@ public final CheckAndMutateRowResponse checkAndMutateRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   String tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
    *   ByteString rowKey = ByteString.EMPTY;
@@ -685,6 +717,8 @@ public final CheckAndMutateRowResponse checkAndMutateRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   CheckAndMutateRowRequest request =
    *       CheckAndMutateRowRequest.newBuilder()
@@ -713,6 +747,8 @@ public final CheckAndMutateRowResponse checkAndMutateRow(CheckAndMutateRowReques
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   CheckAndMutateRowRequest request =
    *       CheckAndMutateRowRequest.newBuilder()
@@ -745,6 +781,8 @@ public final CheckAndMutateRowResponse checkAndMutateRow(CheckAndMutateRowReques
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
    *   ByteString rowKey = ByteString.EMPTY;
@@ -785,6 +823,8 @@ public final ReadModifyWriteRowResponse readModifyWriteRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   String tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
    *   ByteString rowKey = ByteString.EMPTY;
@@ -825,6 +865,8 @@ public final ReadModifyWriteRowResponse readModifyWriteRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
    *   ByteString rowKey = ByteString.EMPTY;
@@ -872,6 +914,8 @@ public final ReadModifyWriteRowResponse readModifyWriteRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   String tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
    *   ByteString rowKey = ByteString.EMPTY;
@@ -916,6 +960,8 @@ public final ReadModifyWriteRowResponse readModifyWriteRow(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   ReadModifyWriteRowRequest request =
    *       ReadModifyWriteRowRequest.newBuilder()
@@ -945,6 +991,8 @@ public final ReadModifyWriteRowResponse readModifyWriteRow(ReadModifyWriteRowReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
    *   ReadModifyWriteRowRequest request =
    *       ReadModifyWriteRowRequest.newBuilder()
diff --git a/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/BaseBigtableDataSettings.java b/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/BaseBigtableDataSettings.java
index b363e2367e..d98451c60b 100644
--- a/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/BaseBigtableDataSettings.java
+++ b/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/BaseBigtableDataSettings.java
@@ -63,6 +63,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * BaseBigtableDataSettings.Builder baseBigtableDataSettingsBuilder =
  *     BaseBigtableDataSettings.newBuilder();
  * baseBigtableDataSettingsBuilder
diff --git a/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/package-info.java b/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/package-info.java
index 8053595e28..5796a99103 100644
--- a/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/package-info.java
+++ b/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/package-info.java
@@ -24,6 +24,8 @@
  * 

Sample for BaseBigtableDataClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
  *   TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
  *   ByteString rowKey = ByteString.EMPTY;
diff --git a/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/stub/BigtableStubSettings.java b/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/stub/BigtableStubSettings.java
index a901956a22..9489b80f91 100644
--- a/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/stub/BigtableStubSettings.java
+++ b/test/integration/goldens/bigtable/com/google/cloud/bigtable/data/v2/stub/BigtableStubSettings.java
@@ -71,6 +71,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * BigtableStubSettings.Builder baseBigtableDataSettingsBuilder =
  *     BigtableStubSettings.newBuilder();
  * baseBigtableDataSettingsBuilder
diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1small/AddressesClient.java b/test/integration/goldens/compute/com/google/cloud/compute/v1small/AddressesClient.java
index f1af094dab..579e8a9336 100644
--- a/test/integration/goldens/compute/com/google/cloud/compute/v1small/AddressesClient.java
+++ b/test/integration/goldens/compute/com/google/cloud/compute/v1small/AddressesClient.java
@@ -46,6 +46,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (AddressesClient addressesClient = AddressesClient.create()) {
  *   String project = "project-309310695";
  *   for (Map.Entry element :
@@ -84,6 +86,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * AddressesSettings addressesSettings =
  *     AddressesSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -94,6 +98,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * AddressesSettings addressesSettings =
  *     AddressesSettings.newBuilder().setEndpoint(myEndpoint).build();
  * AddressesClient addressesClient = AddressesClient.create(addressesSettings);
@@ -159,6 +165,8 @@ public AddressesStub getStub() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   String project = "project-309310695";
    *   for (Map.Entry element :
@@ -184,6 +192,8 @@ public final AggregatedListPagedResponse aggregatedList(String project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   AggregatedListAddressesRequest request =
    *       AggregatedListAddressesRequest.newBuilder()
@@ -215,6 +225,8 @@ public final AggregatedListPagedResponse aggregatedList(AggregatedListAddressesR
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   AggregatedListAddressesRequest request =
    *       AggregatedListAddressesRequest.newBuilder()
@@ -246,6 +258,8 @@ public final AggregatedListPagedResponse aggregatedList(AggregatedListAddressesR
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   AggregatedListAddressesRequest request =
    *       AggregatedListAddressesRequest.newBuilder()
@@ -283,6 +297,8 @@ public final AggregatedListPagedResponse aggregatedList(AggregatedListAddressesR
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   String project = "project-309310695";
    *   String region = "region-934795532";
@@ -314,6 +330,8 @@ public final OperationFuture deleteAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   DeleteAddressRequest request =
    *       DeleteAddressRequest.newBuilder()
@@ -342,6 +360,8 @@ public final OperationFuture deleteAsync(DeleteAddressRequ
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   DeleteAddressRequest request =
    *       DeleteAddressRequest.newBuilder()
@@ -369,6 +389,8 @@ public final OperationFuture deleteAsync(DeleteAddressRequ
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   DeleteAddressRequest request =
    *       DeleteAddressRequest.newBuilder()
@@ -394,6 +416,8 @@ public final UnaryCallable deleteCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   String project = "project-309310695";
    *   String region = "region-934795532";
@@ -425,6 +449,8 @@ public final OperationFuture insertAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   InsertAddressRequest request =
    *       InsertAddressRequest.newBuilder()
@@ -453,6 +479,8 @@ public final OperationFuture insertAsync(InsertAddressRequ
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   InsertAddressRequest request =
    *       InsertAddressRequest.newBuilder()
@@ -480,6 +508,8 @@ public final OperationFuture insertAsync(InsertAddressRequ
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   InsertAddressRequest request =
    *       InsertAddressRequest.newBuilder()
@@ -505,6 +535,8 @@ public final UnaryCallable insertCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   String project = "project-309310695";
    *   String region = "region-934795532";
@@ -543,6 +575,8 @@ public final ListPagedResponse list(String project, String region, String orderB
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   ListAddressesRequest request =
    *       ListAddressesRequest.newBuilder()
@@ -573,6 +607,8 @@ public final ListPagedResponse list(ListAddressesRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   ListAddressesRequest request =
    *       ListAddressesRequest.newBuilder()
@@ -602,6 +638,8 @@ public final UnaryCallable listPagedCal
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (AddressesClient addressesClient = AddressesClient.create()) {
    *   ListAddressesRequest request =
    *       ListAddressesRequest.newBuilder()
diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1small/AddressesSettings.java b/test/integration/goldens/compute/com/google/cloud/compute/v1small/AddressesSettings.java
index 7023bdafb8..d5c799453b 100644
--- a/test/integration/goldens/compute/com/google/cloud/compute/v1small/AddressesSettings.java
+++ b/test/integration/goldens/compute/com/google/cloud/compute/v1small/AddressesSettings.java
@@ -55,6 +55,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * AddressesSettings.Builder addressesSettingsBuilder = AddressesSettings.newBuilder();
  * addressesSettingsBuilder
  *     .aggregatedListSettings()
diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1small/RegionOperationsClient.java b/test/integration/goldens/compute/com/google/cloud/compute/v1small/RegionOperationsClient.java
index b5b07641ad..dcec18f5b3 100644
--- a/test/integration/goldens/compute/com/google/cloud/compute/v1small/RegionOperationsClient.java
+++ b/test/integration/goldens/compute/com/google/cloud/compute/v1small/RegionOperationsClient.java
@@ -33,6 +33,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
  *   String project = "project-309310695";
  *   String region = "region-934795532";
@@ -71,6 +73,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * RegionOperationsSettings regionOperationsSettings =
  *     RegionOperationsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -82,6 +86,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * RegionOperationsSettings regionOperationsSettings =
  *     RegionOperationsSettings.newBuilder().setEndpoint(myEndpoint).build();
  * RegionOperationsClient regionOperationsClient =
@@ -150,6 +156,8 @@ public RegionOperationsStub getStub() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
    *   String project = "project-309310695";
    *   String region = "region-934795532";
@@ -180,6 +188,8 @@ public final Operation get(String project, String region, String operation) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
    *   GetRegionOperationRequest request =
    *       GetRegionOperationRequest.newBuilder()
@@ -205,6 +215,8 @@ public final Operation get(GetRegionOperationRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
    *   GetRegionOperationRequest request =
    *       GetRegionOperationRequest.newBuilder()
@@ -238,6 +250,8 @@ public final UnaryCallable getCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
    *   String project = "project-309310695";
    *   String region = "region-934795532";
@@ -277,6 +291,8 @@ public final Operation wait(String project, String region, String operation) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
    *   WaitRegionOperationRequest request =
    *       WaitRegionOperationRequest.newBuilder()
@@ -311,6 +327,8 @@ public final Operation wait(WaitRegionOperationRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
    *   WaitRegionOperationRequest request =
    *       WaitRegionOperationRequest.newBuilder()
diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1small/RegionOperationsSettings.java b/test/integration/goldens/compute/com/google/cloud/compute/v1small/RegionOperationsSettings.java
index 6972d21b7a..7481512b16 100644
--- a/test/integration/goldens/compute/com/google/cloud/compute/v1small/RegionOperationsSettings.java
+++ b/test/integration/goldens/compute/com/google/cloud/compute/v1small/RegionOperationsSettings.java
@@ -50,6 +50,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * RegionOperationsSettings.Builder regionOperationsSettingsBuilder =
  *     RegionOperationsSettings.newBuilder();
  * regionOperationsSettingsBuilder
diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1small/package-info.java b/test/integration/goldens/compute/com/google/cloud/compute/v1small/package-info.java
index a50a95d460..7f945ac078 100644
--- a/test/integration/goldens/compute/com/google/cloud/compute/v1small/package-info.java
+++ b/test/integration/goldens/compute/com/google/cloud/compute/v1small/package-info.java
@@ -26,6 +26,8 @@
  * 

Sample for AddressesClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (AddressesClient addressesClient = AddressesClient.create()) {
  *   String project = "project-309310695";
  *   for (Map.Entry element :
@@ -42,6 +44,8 @@
  * 

Sample for RegionOperationsClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
  *   String project = "project-309310695";
  *   String region = "region-934795532";
diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1small/stub/AddressesStubSettings.java b/test/integration/goldens/compute/com/google/cloud/compute/v1small/stub/AddressesStubSettings.java
index 29a32cc6b1..d870e63477 100644
--- a/test/integration/goldens/compute/com/google/cloud/compute/v1small/stub/AddressesStubSettings.java
+++ b/test/integration/goldens/compute/com/google/cloud/compute/v1small/stub/AddressesStubSettings.java
@@ -83,6 +83,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * AddressesStubSettings.Builder addressesSettingsBuilder = AddressesStubSettings.newBuilder();
  * addressesSettingsBuilder
  *     .aggregatedListSettings()
diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1small/stub/RegionOperationsStubSettings.java b/test/integration/goldens/compute/com/google/cloud/compute/v1small/stub/RegionOperationsStubSettings.java
index 8e64114336..83ba9319e1 100644
--- a/test/integration/goldens/compute/com/google/cloud/compute/v1small/stub/RegionOperationsStubSettings.java
+++ b/test/integration/goldens/compute/com/google/cloud/compute/v1small/stub/RegionOperationsStubSettings.java
@@ -61,6 +61,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * RegionOperationsStubSettings.Builder regionOperationsSettingsBuilder =
  *     RegionOperationsStubSettings.newBuilder();
  * regionOperationsSettingsBuilder
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 ccb4b7cc2f..5c1dd677c3 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,6 +43,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
  *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
  *   List delegates = new ArrayList<>();
@@ -82,6 +84,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * IamCredentialsSettings iamCredentialsSettings =
  *     IamCredentialsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -92,6 +96,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * IamCredentialsSettings iamCredentialsSettings =
  *     IamCredentialsSettings.newBuilder().setEndpoint(myEndpoint).build();
  * IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create(iamCredentialsSettings);
@@ -159,6 +165,8 @@ public IamCredentialsStub getStub() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
    *   List delegates = new ArrayList<>();
@@ -208,6 +216,8 @@ public final GenerateAccessTokenResponse generateAccessToken(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
    *   List delegates = new ArrayList<>();
@@ -257,6 +267,8 @@ public final GenerateAccessTokenResponse generateAccessToken(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   GenerateAccessTokenRequest request =
    *       GenerateAccessTokenRequest.newBuilder()
@@ -283,6 +295,8 @@ public final GenerateAccessTokenResponse generateAccessToken(GenerateAccessToken
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   GenerateAccessTokenRequest request =
    *       GenerateAccessTokenRequest.newBuilder()
@@ -310,6 +324,8 @@ public final GenerateAccessTokenResponse generateAccessToken(GenerateAccessToken
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
    *   List delegates = new ArrayList<>();
@@ -357,6 +373,8 @@ public final GenerateIdTokenResponse generateIdToken(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
    *   List delegates = new ArrayList<>();
@@ -404,6 +422,8 @@ public final GenerateIdTokenResponse generateIdToken(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   GenerateIdTokenRequest request =
    *       GenerateIdTokenRequest.newBuilder()
@@ -430,6 +450,8 @@ public final GenerateIdTokenResponse generateIdToken(GenerateIdTokenRequest requ
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   GenerateIdTokenRequest request =
    *       GenerateIdTokenRequest.newBuilder()
@@ -457,6 +479,8 @@ public final GenerateIdTokenResponse generateIdToken(GenerateIdTokenRequest requ
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
    *   List delegates = new ArrayList<>();
@@ -498,6 +522,8 @@ public final SignBlobResponse signBlob(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
    *   List delegates = new ArrayList<>();
@@ -538,6 +564,8 @@ public final SignBlobResponse signBlob(String name, List delegates, Byte
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   SignBlobRequest request =
    *       SignBlobRequest.newBuilder()
@@ -563,6 +591,8 @@ public final SignBlobResponse signBlob(SignBlobRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   SignBlobRequest request =
    *       SignBlobRequest.newBuilder()
@@ -588,6 +618,8 @@ public final UnaryCallable signBlobCallable()
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
    *   List delegates = new ArrayList<>();
@@ -629,6 +661,8 @@ public final SignJwtResponse signJwt(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
    *   List delegates = new ArrayList<>();
@@ -669,6 +703,8 @@ public final SignJwtResponse signJwt(String name, List delegates, String
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   SignJwtRequest request =
    *       SignJwtRequest.newBuilder()
@@ -694,6 +730,8 @@ public final SignJwtResponse signJwt(SignJwtRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
    *   SignJwtRequest request =
    *       SignJwtRequest.newBuilder()
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 57f32e2dc4..dd2dd1fdef 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,6 +51,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * IamCredentialsSettings.Builder iamCredentialsSettingsBuilder =
  *     IamCredentialsSettings.newBuilder();
  * iamCredentialsSettingsBuilder
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 c88c831eba..da4fef9f25 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,6 +31,8 @@
  * 

Sample for IamCredentialsClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
  *   ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
  *   List delegates = new ArrayList<>();
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 68f633d7d1..c5a188f4fc 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,6 +67,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * IamCredentialsStubSettings.Builder iamCredentialsSettingsBuilder =
  *     IamCredentialsStubSettings.newBuilder();
  * iamCredentialsSettingsBuilder
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 c8ed891b8f..64444f651d 100644
--- a/test/integration/goldens/iam/com/google/iam/v1/IAMPolicyClient.java
+++ b/test/integration/goldens/iam/com/google/iam/v1/IAMPolicyClient.java
@@ -54,6 +54,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
  *   SetIamPolicyRequest request =
  *       SetIamPolicyRequest.newBuilder()
@@ -93,6 +95,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * IAMPolicySettings iAMPolicySettings =
  *     IAMPolicySettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -103,6 +107,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * IAMPolicySettings iAMPolicySettings =
  *     IAMPolicySettings.newBuilder().setEndpoint(myEndpoint).build();
  * IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create(iAMPolicySettings);
@@ -168,6 +174,8 @@ public IAMPolicyStub getStub() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
    *   SetIamPolicyRequest request =
    *       SetIamPolicyRequest.newBuilder()
@@ -192,6 +200,8 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
    *   SetIamPolicyRequest request =
    *       SetIamPolicyRequest.newBuilder()
@@ -216,6 +226,8 @@ public final UnaryCallable setIamPolicyCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
    *   GetIamPolicyRequest request =
    *       GetIamPolicyRequest.newBuilder()
@@ -241,6 +253,8 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
    *   GetIamPolicyRequest request =
    *       GetIamPolicyRequest.newBuilder()
@@ -269,6 +283,8 @@ public final UnaryCallable getIamPolicyCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
    *   TestIamPermissionsRequest request =
    *       TestIamPermissionsRequest.newBuilder()
@@ -298,6 +314,8 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
    *   TestIamPermissionsRequest request =
    *       TestIamPermissionsRequest.newBuilder()
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 04b5f1d8b5..342de64f79 100644
--- a/test/integration/goldens/iam/com/google/iam/v1/IAMPolicySettings.java
+++ b/test/integration/goldens/iam/com/google/iam/v1/IAMPolicySettings.java
@@ -50,6 +50,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * IAMPolicySettings.Builder iAMPolicySettingsBuilder = IAMPolicySettings.newBuilder();
  * iAMPolicySettingsBuilder
  *     .setIamPolicySettings()
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 92ccf1f602..9765ae91e3 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,6 +45,8 @@
  * 

Sample for IAMPolicyClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (IAMPolicyClient iAMPolicyClient = IAMPolicyClient.create()) {
  *   SetIamPolicyRequest request =
  *       SetIamPolicyRequest.newBuilder()
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 ebeea7772d..063e2c605d 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,6 +63,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * IAMPolicyStubSettings.Builder iAMPolicySettingsBuilder = IAMPolicyStubSettings.newBuilder();
  * iAMPolicySettingsBuilder
  *     .setIamPolicySettings()
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 6dfc6544ea..7edd77bdc4 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,6 +65,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (KeyManagementServiceClient keyManagementServiceClient =
  *     KeyManagementServiceClient.create()) {
  *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
@@ -102,6 +104,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * KeyManagementServiceSettings keyManagementServiceSettings =
  *     KeyManagementServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -113,6 +117,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * KeyManagementServiceSettings keyManagementServiceSettings =
  *     KeyManagementServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  * KeyManagementServiceClient keyManagementServiceClient =
@@ -181,6 +187,8 @@ public KeyManagementServiceStub getStub() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
@@ -209,6 +217,8 @@ public final ListKeyRingsPagedResponse listKeyRings(LocationName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
@@ -234,6 +244,8 @@ public final ListKeyRingsPagedResponse listKeyRings(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListKeyRingsRequest request =
@@ -264,6 +276,8 @@ public final ListKeyRingsPagedResponse listKeyRings(ListKeyRingsRequest request)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListKeyRingsRequest request =
@@ -295,6 +309,8 @@ public final ListKeyRingsPagedResponse listKeyRings(ListKeyRingsRequest request)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListKeyRingsRequest request =
@@ -332,6 +348,8 @@ public final UnaryCallable listKeyRin
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
@@ -360,6 +378,8 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(KeyRingName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
@@ -385,6 +405,8 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListCryptoKeysRequest request =
@@ -415,6 +437,8 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(ListCryptoKeysRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListCryptoKeysRequest request =
@@ -446,6 +470,8 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(ListCryptoKeysRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListCryptoKeysRequest request =
@@ -484,6 +510,8 @@ public final ListCryptoKeysPagedResponse listCryptoKeys(ListCryptoKeysRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyName parent =
@@ -514,6 +542,8 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(CryptoKeyN
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String parent =
@@ -542,6 +572,8 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(String par
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListCryptoKeyVersionsRequest request =
@@ -576,6 +608,8 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListCryptoKeyVersionsRequest request =
@@ -609,6 +643,8 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListCryptoKeyVersionsRequest request =
@@ -649,6 +685,8 @@ public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
@@ -677,6 +715,8 @@ public final ListImportJobsPagedResponse listImportJobs(KeyRingName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
@@ -702,6 +742,8 @@ public final ListImportJobsPagedResponse listImportJobs(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListImportJobsRequest request =
@@ -732,6 +774,8 @@ public final ListImportJobsPagedResponse listImportJobs(ListImportJobsRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListImportJobsRequest request =
@@ -763,6 +807,8 @@ public final ListImportJobsPagedResponse listImportJobs(ListImportJobsRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListImportJobsRequest request =
@@ -801,6 +847,8 @@ public final ListImportJobsPagedResponse listImportJobs(ListImportJobsRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
@@ -825,6 +873,8 @@ public final KeyRing getKeyRing(KeyRingName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
@@ -848,6 +898,8 @@ public final KeyRing getKeyRing(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetKeyRingRequest request =
@@ -872,6 +924,8 @@ public final KeyRing getKeyRing(GetKeyRingRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetKeyRingRequest request =
@@ -898,6 +952,8 @@ public final UnaryCallable getKeyRingCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyName name =
@@ -925,6 +981,8 @@ public final CryptoKey getCryptoKey(CryptoKeyName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name =
@@ -951,6 +1009,8 @@ public final CryptoKey getCryptoKey(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetCryptoKeyRequest request =
@@ -979,6 +1039,8 @@ public final CryptoKey getCryptoKey(GetCryptoKeyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetCryptoKeyRequest request =
@@ -1005,6 +1067,8 @@ public final UnaryCallable getCryptoKeyCallable(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyVersionName name =
@@ -1033,6 +1097,8 @@ public final CryptoKeyVersion getCryptoKeyVersion(CryptoKeyVersionName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name =
@@ -1060,6 +1126,8 @@ public final CryptoKeyVersion getCryptoKeyVersion(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetCryptoKeyVersionRequest request =
@@ -1091,6 +1159,8 @@ public final CryptoKeyVersion getCryptoKeyVersion(GetCryptoKeyVersionRequest req
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetCryptoKeyVersionRequest request =
@@ -1126,6 +1196,8 @@ public final CryptoKeyVersion getCryptoKeyVersion(GetCryptoKeyVersionRequest req
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyVersionName name =
@@ -1155,6 +1227,8 @@ public final PublicKey getPublicKey(CryptoKeyVersionName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name =
@@ -1184,6 +1258,8 @@ public final PublicKey getPublicKey(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetPublicKeyRequest request =
@@ -1218,6 +1294,8 @@ public final PublicKey getPublicKey(GetPublicKeyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetPublicKeyRequest request =
@@ -1249,6 +1327,8 @@ public final UnaryCallable getPublicKeyCallable(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ImportJobName name =
@@ -1274,6 +1354,8 @@ public final ImportJob getImportJob(ImportJobName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name =
@@ -1298,6 +1380,8 @@ public final ImportJob getImportJob(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetImportJobRequest request =
@@ -1324,6 +1408,8 @@ public final ImportJob getImportJob(GetImportJobRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetImportJobRequest request =
@@ -1350,6 +1436,8 @@ public final UnaryCallable getImportJobCallable(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
@@ -1383,6 +1471,8 @@ public final KeyRing createKeyRing(LocationName parent, String keyRingId, KeyRin
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
@@ -1416,6 +1506,8 @@ public final KeyRing createKeyRing(String parent, String keyRingId, KeyRing keyR
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CreateKeyRingRequest request =
@@ -1442,6 +1534,8 @@ public final KeyRing createKeyRing(CreateKeyRingRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CreateKeyRingRequest request =
@@ -1473,6 +1567,8 @@ public final UnaryCallable createKeyRingCallable(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
@@ -1514,6 +1610,8 @@ public final CryptoKey createCryptoKey(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
@@ -1554,6 +1652,8 @@ public final CryptoKey createCryptoKey(String parent, String cryptoKeyId, Crypto
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CreateCryptoKeyRequest request =
@@ -1586,6 +1686,8 @@ public final CryptoKey createCryptoKey(CreateCryptoKeyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CreateCryptoKeyRequest request =
@@ -1618,6 +1720,8 @@ public final UnaryCallable createCryptoKeyCal
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyName parent =
@@ -1657,6 +1761,8 @@ public final CryptoKeyVersion createCryptoKeyVersion(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String parent =
@@ -1696,6 +1802,8 @@ public final CryptoKeyVersion createCryptoKeyVersion(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CreateCryptoKeyVersionRequest request =
@@ -1728,6 +1836,8 @@ public final CryptoKeyVersion createCryptoKeyVersion(CreateCryptoKeyVersionReque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CreateCryptoKeyVersionRequest request =
@@ -1761,6 +1871,8 @@ public final CryptoKeyVersion createCryptoKeyVersion(CreateCryptoKeyVersionReque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ImportCryptoKeyVersionRequest request =
@@ -1793,6 +1905,8 @@ public final CryptoKeyVersion importCryptoKeyVersion(ImportCryptoKeyVersionReque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ImportCryptoKeyVersionRequest request =
@@ -1824,6 +1938,8 @@ public final CryptoKeyVersion importCryptoKeyVersion(ImportCryptoKeyVersionReque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
@@ -1864,6 +1980,8 @@ public final ImportJob createImportJob(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
@@ -1903,6 +2021,8 @@ public final ImportJob createImportJob(String parent, String importJobId, Import
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CreateImportJobRequest request =
@@ -1932,6 +2052,8 @@ public final ImportJob createImportJob(CreateImportJobRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CreateImportJobRequest request =
@@ -1958,6 +2080,8 @@ public final UnaryCallable createImportJobCal
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKey cryptoKey = CryptoKey.newBuilder().build();
@@ -1986,6 +2110,8 @@ public final CryptoKey updateCryptoKey(CryptoKey cryptoKey, FieldMask updateMask
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   UpdateCryptoKeyRequest request =
@@ -2011,6 +2137,8 @@ public final CryptoKey updateCryptoKey(UpdateCryptoKeyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   UpdateCryptoKeyRequest request =
@@ -2044,6 +2172,8 @@ public final UnaryCallable updateCryptoKeyCal
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
@@ -2083,6 +2213,8 @@ public final CryptoKeyVersion updateCryptoKeyVersion(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   UpdateCryptoKeyVersionRequest request =
@@ -2116,6 +2248,8 @@ public final CryptoKeyVersion updateCryptoKeyVersion(UpdateCryptoKeyVersionReque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   UpdateCryptoKeyVersionRequest request =
@@ -2145,6 +2279,8 @@ public final CryptoKeyVersion updateCryptoKeyVersion(UpdateCryptoKeyVersionReque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ResourceName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
@@ -2185,6 +2321,8 @@ public final EncryptResponse encrypt(ResourceName name, ByteString plaintext) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name =
@@ -2223,6 +2361,8 @@ public final EncryptResponse encrypt(String name, ByteString plaintext) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   EncryptRequest request =
@@ -2256,6 +2396,8 @@ public final EncryptResponse encrypt(EncryptRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   EncryptRequest request =
@@ -2289,6 +2431,8 @@ public final UnaryCallable encryptCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyName name =
@@ -2323,6 +2467,8 @@ public final DecryptResponse decrypt(CryptoKeyName name, ByteString ciphertext)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name =
@@ -2354,6 +2500,8 @@ public final DecryptResponse decrypt(String name, ByteString ciphertext) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   DecryptRequest request =
@@ -2387,6 +2535,8 @@ public final DecryptResponse decrypt(DecryptRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   DecryptRequest request =
@@ -2420,6 +2570,8 @@ public final UnaryCallable decryptCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyVersionName name =
@@ -2456,6 +2608,8 @@ public final AsymmetricSignResponse asymmetricSign(CryptoKeyVersionName name, Di
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name =
@@ -2490,6 +2644,8 @@ public final AsymmetricSignResponse asymmetricSign(String name, Digest digest) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   AsymmetricSignRequest request =
@@ -2526,6 +2682,8 @@ public final AsymmetricSignResponse asymmetricSign(AsymmetricSignRequest request
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   AsymmetricSignRequest request =
@@ -2563,6 +2721,8 @@ public final AsymmetricSignResponse asymmetricSign(AsymmetricSignRequest request
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyVersionName name =
@@ -2600,6 +2760,8 @@ public final AsymmetricDecryptResponse asymmetricDecrypt(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name =
@@ -2634,6 +2796,8 @@ public final AsymmetricDecryptResponse asymmetricDecrypt(String name, ByteString
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   AsymmetricDecryptRequest request =
@@ -2670,6 +2834,8 @@ public final AsymmetricDecryptResponse asymmetricDecrypt(AsymmetricDecryptReques
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   AsymmetricDecryptRequest request =
@@ -2707,6 +2873,8 @@ public final AsymmetricDecryptResponse asymmetricDecrypt(AsymmetricDecryptReques
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyName name =
@@ -2743,6 +2911,8 @@ public final CryptoKey updateCryptoKeyPrimaryVersion(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name =
@@ -2778,6 +2948,8 @@ public final CryptoKey updateCryptoKeyPrimaryVersion(String name, String cryptoK
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   UpdateCryptoKeyPrimaryVersionRequest request =
@@ -2809,6 +2981,8 @@ public final CryptoKey updateCryptoKeyPrimaryVersion(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   UpdateCryptoKeyPrimaryVersionRequest request =
@@ -2850,6 +3024,8 @@ public final CryptoKey updateCryptoKeyPrimaryVersion(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyVersionName name =
@@ -2891,6 +3067,8 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(CryptoKeyVersionName name)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name =
@@ -2931,6 +3109,8 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   DestroyCryptoKeyVersionRequest request =
@@ -2975,6 +3155,8 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(DestroyCryptoKeyVersionReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   DestroyCryptoKeyVersionRequest request =
@@ -3014,6 +3196,8 @@ public final CryptoKeyVersion destroyCryptoKeyVersion(DestroyCryptoKeyVersionReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   CryptoKeyVersionName name =
@@ -3049,6 +3233,8 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(CryptoKeyVersionName name)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   String name =
@@ -3083,6 +3269,8 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   RestoreCryptoKeyVersionRequest request =
@@ -3121,6 +3309,8 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(RestoreCryptoKeyVersionReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   RestoreCryptoKeyVersionRequest request =
@@ -3154,6 +3344,8 @@ public final CryptoKeyVersion restoreCryptoKeyVersion(RestoreCryptoKeyVersionReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetIamPolicyRequest request =
@@ -3182,6 +3374,8 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetIamPolicyRequest request =
@@ -3209,6 +3403,8 @@ public final UnaryCallable getIamPolicyCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListLocationsRequest request =
@@ -3238,6 +3434,8 @@ public final ListLocationsPagedResponse listLocations(ListLocationsRequest reque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListLocationsRequest request =
@@ -3268,6 +3466,8 @@ public final ListLocationsPagedResponse listLocations(ListLocationsRequest reque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   ListLocationsRequest request =
@@ -3304,6 +3504,8 @@ public final UnaryCallable listLoca
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
@@ -3325,6 +3527,8 @@ public final Location getLocation(GetLocationRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
@@ -3347,6 +3551,8 @@ public final UnaryCallable getLocationCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   TestIamPermissionsRequest request =
@@ -3375,6 +3581,8 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (KeyManagementServiceClient keyManagementServiceClient =
    *     KeyManagementServiceClient.create()) {
    *   TestIamPermissionsRequest request =
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 3d141418d1..2b750af8a7 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,6 +65,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * KeyManagementServiceSettings.Builder keyManagementServiceSettingsBuilder =
  *     KeyManagementServiceSettings.newBuilder();
  * keyManagementServiceSettingsBuilder
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 879e6a2d3a..fc9d5ed30f 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,6 +39,8 @@
  * 

Sample for KeyManagementServiceClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (KeyManagementServiceClient keyManagementServiceClient =
  *     KeyManagementServiceClient.create()) {
  *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
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 a403a36e42..5c5f66fd26 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,6 +115,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * KeyManagementServiceStubSettings.Builder keyManagementServiceSettingsBuilder =
  *     KeyManagementServiceStubSettings.newBuilder();
  * keyManagementServiceSettingsBuilder
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 5efedbb486..ca7865e600 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,6 +67,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
  *   Shelf shelf = Shelf.newBuilder().build();
  *   Shelf response = libraryServiceClient.createShelf(shelf);
@@ -102,6 +104,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * LibraryServiceSettings libraryServiceSettings =
  *     LibraryServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -112,6 +116,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * LibraryServiceSettings libraryServiceSettings =
  *     LibraryServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  * LibraryServiceClient libraryServiceClient = LibraryServiceClient.create(libraryServiceSettings);
@@ -179,6 +185,8 @@ public LibraryServiceStub getStub() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   Shelf shelf = Shelf.newBuilder().build();
    *   Shelf response = libraryServiceClient.createShelf(shelf);
@@ -200,6 +208,8 @@ public final Shelf createShelf(Shelf shelf) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   CreateShelfRequest request =
    *       CreateShelfRequest.newBuilder().setShelf(Shelf.newBuilder().build()).build();
@@ -221,6 +231,8 @@ public final Shelf createShelf(CreateShelfRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   CreateShelfRequest request =
    *       CreateShelfRequest.newBuilder().setShelf(Shelf.newBuilder().build()).build();
@@ -241,6 +253,8 @@ public final UnaryCallable createShelfCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ShelfName name = ShelfName.of("[SHELF_ID]");
    *   Shelf response = libraryServiceClient.getShelf(name);
@@ -263,6 +277,8 @@ public final Shelf getShelf(ShelfName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   String name = ShelfName.of("[SHELF_ID]").toString();
    *   Shelf response = libraryServiceClient.getShelf(name);
@@ -284,6 +300,8 @@ public final Shelf getShelf(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   GetShelfRequest request =
    *       GetShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
@@ -305,6 +323,8 @@ public final Shelf getShelf(GetShelfRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   GetShelfRequest request =
    *       GetShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
@@ -326,6 +346,8 @@ public final UnaryCallable getShelfCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ListShelvesRequest request =
    *       ListShelvesRequest.newBuilder()
@@ -353,6 +375,8 @@ public final ListShelvesPagedResponse listShelves(ListShelvesRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ListShelvesRequest request =
    *       ListShelvesRequest.newBuilder()
@@ -380,6 +404,8 @@ public final ListShelvesPagedResponse listShelves(ListShelvesRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ListShelvesRequest request =
    *       ListShelvesRequest.newBuilder()
@@ -412,6 +438,8 @@ public final UnaryCallable listShelvesC
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ShelfName name = ShelfName.of("[SHELF_ID]");
    *   libraryServiceClient.deleteShelf(name);
@@ -434,6 +462,8 @@ public final void deleteShelf(ShelfName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   String name = ShelfName.of("[SHELF_ID]").toString();
    *   libraryServiceClient.deleteShelf(name);
@@ -455,6 +485,8 @@ public final void deleteShelf(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   DeleteShelfRequest request =
    *       DeleteShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
@@ -476,6 +508,8 @@ public final void deleteShelf(DeleteShelfRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   DeleteShelfRequest request =
    *       DeleteShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
@@ -501,6 +535,8 @@ public final UnaryCallable deleteShelfCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ShelfName name = ShelfName.of("[SHELF_ID]");
    *   ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
@@ -533,6 +569,8 @@ public final Shelf mergeShelves(ShelfName name, ShelfName otherShelf) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ShelfName name = ShelfName.of("[SHELF_ID]");
    *   String otherShelf = ShelfName.of("[SHELF_ID]").toString();
@@ -565,6 +603,8 @@ public final Shelf mergeShelves(ShelfName name, String otherShelf) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   String name = ShelfName.of("[SHELF_ID]").toString();
    *   ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
@@ -597,6 +637,8 @@ public final Shelf mergeShelves(String name, ShelfName otherShelf) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   String name = ShelfName.of("[SHELF_ID]").toString();
    *   String otherShelf = ShelfName.of("[SHELF_ID]").toString();
@@ -626,6 +668,8 @@ public final Shelf mergeShelves(String name, String otherShelf) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   MergeShelvesRequest request =
    *       MergeShelvesRequest.newBuilder()
@@ -655,6 +699,8 @@ public final Shelf mergeShelves(MergeShelvesRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   MergeShelvesRequest request =
    *       MergeShelvesRequest.newBuilder()
@@ -678,6 +724,8 @@ public final UnaryCallable mergeShelvesCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ShelfName parent = ShelfName.of("[SHELF_ID]");
    *   Book book = Book.newBuilder().build();
@@ -705,6 +753,8 @@ public final Book createBook(ShelfName parent, Book book) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   String parent = ShelfName.of("[SHELF_ID]").toString();
    *   Book book = Book.newBuilder().build();
@@ -729,6 +779,8 @@ public final Book createBook(String parent, Book book) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   CreateBookRequest request =
    *       CreateBookRequest.newBuilder()
@@ -753,6 +805,8 @@ public final Book createBook(CreateBookRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   CreateBookRequest request =
    *       CreateBookRequest.newBuilder()
@@ -776,6 +830,8 @@ public final UnaryCallable createBookCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   BookName name = BookName.of("[SHELF]", "[BOOK]");
    *   Book response = libraryServiceClient.getBook(name);
@@ -798,6 +854,8 @@ public final Book getBook(BookName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   String name = BookName.of("[SHELF]", "[BOOK]").toString();
    *   Book response = libraryServiceClient.getBook(name);
@@ -819,6 +877,8 @@ public final Book getBook(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   GetBookRequest request =
    *       GetBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).build();
@@ -840,6 +900,8 @@ public final Book getBook(GetBookRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   GetBookRequest request =
    *       GetBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).build();
@@ -862,6 +924,8 @@ public final UnaryCallable getBookCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ShelfName parent = ShelfName.of("[SHELF_ID]");
    *   for (Book element : libraryServiceClient.listBooks(parent).iterateAll()) {
@@ -888,6 +952,8 @@ public final ListBooksPagedResponse listBooks(ShelfName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   String parent = ShelfName.of("[SHELF_ID]").toString();
    *   for (Book element : libraryServiceClient.listBooks(parent).iterateAll()) {
@@ -913,6 +979,8 @@ public final ListBooksPagedResponse listBooks(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ListBooksRequest request =
    *       ListBooksRequest.newBuilder()
@@ -942,6 +1010,8 @@ public final ListBooksPagedResponse listBooks(ListBooksRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ListBooksRequest request =
    *       ListBooksRequest.newBuilder()
@@ -970,6 +1040,8 @@ public final UnaryCallable listBooksPa
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   ListBooksRequest request =
    *       ListBooksRequest.newBuilder()
@@ -1003,6 +1075,8 @@ public final UnaryCallable listBooksCallabl
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   BookName name = BookName.of("[SHELF]", "[BOOK]");
    *   libraryServiceClient.deleteBook(name);
@@ -1025,6 +1099,8 @@ public final void deleteBook(BookName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   String name = BookName.of("[SHELF]", "[BOOK]").toString();
    *   libraryServiceClient.deleteBook(name);
@@ -1046,6 +1122,8 @@ public final void deleteBook(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   DeleteBookRequest request =
    *       DeleteBookRequest.newBuilder()
@@ -1069,6 +1147,8 @@ public final void deleteBook(DeleteBookRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   DeleteBookRequest request =
    *       DeleteBookRequest.newBuilder()
@@ -1092,6 +1172,8 @@ public final UnaryCallable deleteBookCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   Book book = Book.newBuilder().build();
    *   FieldMask updateMask = FieldMask.newBuilder().build();
@@ -1117,6 +1199,8 @@ public final Book updateBook(Book book, FieldMask updateMask) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   UpdateBookRequest request =
    *       UpdateBookRequest.newBuilder()
@@ -1142,6 +1226,8 @@ public final Book updateBook(UpdateBookRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   UpdateBookRequest request =
    *       UpdateBookRequest.newBuilder()
@@ -1166,6 +1252,8 @@ public final UnaryCallable updateBookCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   BookName name = BookName.of("[SHELF]", "[BOOK]");
    *   ShelfName otherShelfName = ShelfName.of("[SHELF_ID]");
@@ -1194,6 +1282,8 @@ public final Book moveBook(BookName name, ShelfName otherShelfName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   BookName name = BookName.of("[SHELF]", "[BOOK]");
    *   String otherShelfName = ShelfName.of("[SHELF_ID]").toString();
@@ -1222,6 +1312,8 @@ public final Book moveBook(BookName name, String otherShelfName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   String name = BookName.of("[SHELF]", "[BOOK]").toString();
    *   ShelfName otherShelfName = ShelfName.of("[SHELF_ID]");
@@ -1250,6 +1342,8 @@ public final Book moveBook(String name, ShelfName otherShelfName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   String name = BookName.of("[SHELF]", "[BOOK]").toString();
    *   String otherShelfName = ShelfName.of("[SHELF_ID]").toString();
@@ -1275,6 +1369,8 @@ public final Book moveBook(String name, String otherShelfName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   MoveBookRequest request =
    *       MoveBookRequest.newBuilder()
@@ -1300,6 +1396,8 @@ public final Book moveBook(MoveBookRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
    *   MoveBookRequest request =
    *       MoveBookRequest.newBuilder()
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 990cf2ad5d..7e09a81049 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,6 +71,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * LibraryServiceSettings.Builder libraryServiceSettingsBuilder =
  *     LibraryServiceSettings.newBuilder();
  * libraryServiceSettingsBuilder
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 f211c32606..91c711a30b 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,6 +31,8 @@
  * 

Sample for LibraryServiceClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * 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 1016c03496..c12c6876f7 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,6 +85,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * LibraryServiceStubSettings.Builder libraryServiceSettingsBuilder =
  *     LibraryServiceStubSettings.newBuilder();
  * libraryServiceSettingsBuilder
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 dd94562e23..f4e4fd0932 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,6 +85,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (ConfigClient configClient = ConfigClient.create()) {
  *   GetBucketRequest request =
  *       GetBucketRequest.newBuilder()
@@ -125,6 +127,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * ConfigSettings configSettings =
  *     ConfigSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -135,6 +139,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * ConfigSettings configSettings = ConfigSettings.newBuilder().setEndpoint(myEndpoint).build();
  * ConfigClient configClient = ConfigClient.create(configSettings);
  * }
@@ -199,6 +205,8 @@ public ConfigServiceV2Stub getStub() { *

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   BillingAccountLocationName parent =
    *       BillingAccountLocationName.of("[BILLING_ACCOUNT]", "[LOCATION]");
@@ -232,6 +240,8 @@ public final ListBucketsPagedResponse listBuckets(BillingAccountLocationName par
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   FolderLocationName parent = FolderLocationName.of("[FOLDER]", "[LOCATION]");
    *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
@@ -264,6 +274,8 @@ public final ListBucketsPagedResponse listBuckets(FolderLocationName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
@@ -296,6 +308,8 @@ public final ListBucketsPagedResponse listBuckets(LocationName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
    *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
@@ -328,6 +342,8 @@ public final ListBucketsPagedResponse listBuckets(OrganizationLocationName paren
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
    *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
@@ -357,6 +373,8 @@ public final ListBucketsPagedResponse listBuckets(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListBucketsRequest request =
    *       ListBucketsRequest.newBuilder()
@@ -384,6 +402,8 @@ public final ListBucketsPagedResponse listBuckets(ListBucketsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListBucketsRequest request =
    *       ListBucketsRequest.newBuilder()
@@ -411,6 +431,8 @@ public final ListBucketsPagedResponse listBuckets(ListBucketsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListBucketsRequest request =
    *       ListBucketsRequest.newBuilder()
@@ -444,6 +466,8 @@ public final UnaryCallable listBucketsC
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   GetBucketRequest request =
    *       GetBucketRequest.newBuilder()
@@ -469,6 +493,8 @@ public final LogBucket getBucket(GetBucketRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   GetBucketRequest request =
    *       GetBucketRequest.newBuilder()
@@ -494,6 +520,8 @@ public final UnaryCallable getBucketCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   CreateBucketRequest request =
    *       CreateBucketRequest.newBuilder()
@@ -520,6 +548,8 @@ public final LogBucket createBucket(CreateBucketRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   CreateBucketRequest request =
    *       CreateBucketRequest.newBuilder()
@@ -553,6 +583,8 @@ public final UnaryCallable createBucketCallable(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UpdateBucketRequest request =
    *       UpdateBucketRequest.newBuilder()
@@ -589,6 +621,8 @@ public final LogBucket updateBucket(UpdateBucketRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UpdateBucketRequest request =
    *       UpdateBucketRequest.newBuilder()
@@ -616,6 +650,8 @@ public final UnaryCallable updateBucketCallable(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   DeleteBucketRequest request =
    *       DeleteBucketRequest.newBuilder()
@@ -642,6 +678,8 @@ public final void deleteBucket(DeleteBucketRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   DeleteBucketRequest request =
    *       DeleteBucketRequest.newBuilder()
@@ -667,6 +705,8 @@ public final UnaryCallable deleteBucketCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UndeleteBucketRequest request =
    *       UndeleteBucketRequest.newBuilder()
@@ -693,6 +733,8 @@ public final void undeleteBucket(UndeleteBucketRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UndeleteBucketRequest request =
    *       UndeleteBucketRequest.newBuilder()
@@ -717,6 +759,8 @@ public final UnaryCallable undeleteBucketCallable(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String parent = "parent-995424086";
    *   for (LogView element : configClient.listViews(parent).iterateAll()) {
@@ -741,6 +785,8 @@ public final ListViewsPagedResponse listViews(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListViewsRequest request =
    *       ListViewsRequest.newBuilder()
@@ -768,6 +814,8 @@ public final ListViewsPagedResponse listViews(ListViewsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListViewsRequest request =
    *       ListViewsRequest.newBuilder()
@@ -794,6 +842,8 @@ public final UnaryCallable listViewsPa
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListViewsRequest request =
    *       ListViewsRequest.newBuilder()
@@ -827,6 +877,8 @@ public final UnaryCallable listViewsCallabl
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   GetViewRequest request =
    *       GetViewRequest.newBuilder()
@@ -853,6 +905,8 @@ public final LogView getView(GetViewRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   GetViewRequest request =
    *       GetViewRequest.newBuilder()
@@ -878,6 +932,8 @@ public final UnaryCallable getViewCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   CreateViewRequest request =
    *       CreateViewRequest.newBuilder()
@@ -903,6 +959,8 @@ public final LogView createView(CreateViewRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   CreateViewRequest request =
    *       CreateViewRequest.newBuilder()
@@ -928,6 +986,8 @@ public final UnaryCallable createViewCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UpdateViewRequest request =
    *       UpdateViewRequest.newBuilder()
@@ -954,6 +1014,8 @@ public final LogView updateView(UpdateViewRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UpdateViewRequest request =
    *       UpdateViewRequest.newBuilder()
@@ -978,6 +1040,8 @@ public final UnaryCallable updateViewCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   DeleteViewRequest request =
    *       DeleteViewRequest.newBuilder()
@@ -1004,6 +1068,8 @@ public final void deleteView(DeleteViewRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   DeleteViewRequest request =
    *       DeleteViewRequest.newBuilder()
@@ -1029,6 +1095,8 @@ public final UnaryCallable deleteViewCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
    *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
@@ -1055,6 +1123,8 @@ public final ListSinksPagedResponse listSinks(BillingAccountName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   FolderName parent = FolderName.of("[FOLDER]");
    *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
@@ -1081,6 +1151,8 @@ public final ListSinksPagedResponse listSinks(FolderName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
    *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
@@ -1107,6 +1179,8 @@ public final ListSinksPagedResponse listSinks(OrganizationName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
@@ -1133,6 +1207,8 @@ public final ListSinksPagedResponse listSinks(ProjectName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
@@ -1158,6 +1234,8 @@ public final ListSinksPagedResponse listSinks(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListSinksRequest request =
    *       ListSinksRequest.newBuilder()
@@ -1185,6 +1263,8 @@ public final ListSinksPagedResponse listSinks(ListSinksRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListSinksRequest request =
    *       ListSinksRequest.newBuilder()
@@ -1211,6 +1291,8 @@ public final UnaryCallable listSinksPa
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListSinksRequest request =
    *       ListSinksRequest.newBuilder()
@@ -1244,6 +1326,8 @@ public final UnaryCallable listSinksCallabl
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
    *   LogSink response = configClient.getSink(sinkName);
@@ -1273,6 +1357,8 @@ public final LogSink getSink(LogSinkName sinkName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
    *   LogSink response = configClient.getSink(sinkName);
@@ -1299,6 +1385,8 @@ public final LogSink getSink(String sinkName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   GetSinkRequest request =
    *       GetSinkRequest.newBuilder()
@@ -1322,6 +1410,8 @@ public final LogSink getSink(GetSinkRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   GetSinkRequest request =
    *       GetSinkRequest.newBuilder()
@@ -1347,6 +1437,8 @@ public final UnaryCallable getSinkCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
    *   LogSink sink = LogSink.newBuilder().build();
@@ -1381,6 +1473,8 @@ public final LogSink createSink(BillingAccountName parent, LogSink sink) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   FolderName parent = FolderName.of("[FOLDER]");
    *   LogSink sink = LogSink.newBuilder().build();
@@ -1415,6 +1509,8 @@ public final LogSink createSink(FolderName parent, LogSink sink) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
    *   LogSink sink = LogSink.newBuilder().build();
@@ -1449,6 +1545,8 @@ public final LogSink createSink(OrganizationName parent, LogSink sink) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   LogSink sink = LogSink.newBuilder().build();
@@ -1483,6 +1581,8 @@ public final LogSink createSink(ProjectName parent, LogSink sink) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   LogSink sink = LogSink.newBuilder().build();
@@ -1514,6 +1614,8 @@ public final LogSink createSink(String parent, LogSink sink) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   CreateSinkRequest request =
    *       CreateSinkRequest.newBuilder()
@@ -1542,6 +1644,8 @@ public final LogSink createSink(CreateSinkRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   CreateSinkRequest request =
    *       CreateSinkRequest.newBuilder()
@@ -1570,6 +1674,8 @@ public final UnaryCallable createSinkCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
    *   LogSink sink = LogSink.newBuilder().build();
@@ -1608,6 +1714,8 @@ public final LogSink updateSink(LogSinkName sinkName, LogSink sink) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
    *   LogSink sink = LogSink.newBuilder().build();
@@ -1643,6 +1751,8 @@ public final LogSink updateSink(String sinkName, LogSink sink) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
    *   LogSink sink = LogSink.newBuilder().build();
@@ -1692,6 +1802,8 @@ public final LogSink updateSink(LogSinkName sinkName, LogSink sink, FieldMask up
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
    *   LogSink sink = LogSink.newBuilder().build();
@@ -1741,6 +1853,8 @@ public final LogSink updateSink(String sinkName, LogSink sink, FieldMask updateM
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UpdateSinkRequest request =
    *       UpdateSinkRequest.newBuilder()
@@ -1771,6 +1885,8 @@ public final LogSink updateSink(UpdateSinkRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UpdateSinkRequest request =
    *       UpdateSinkRequest.newBuilder()
@@ -1797,6 +1913,8 @@ public final UnaryCallable updateSinkCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
    *   configClient.deleteSink(sinkName);
@@ -1828,6 +1946,8 @@ public final void deleteSink(LogSinkName sinkName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
    *   configClient.deleteSink(sinkName);
@@ -1856,6 +1976,8 @@ public final void deleteSink(String sinkName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   DeleteSinkRequest request =
    *       DeleteSinkRequest.newBuilder()
@@ -1880,6 +2002,8 @@ public final void deleteSink(DeleteSinkRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   DeleteSinkRequest request =
    *       DeleteSinkRequest.newBuilder()
@@ -1902,6 +2026,8 @@ public final UnaryCallable deleteSinkCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
    *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
@@ -1930,6 +2056,8 @@ public final ListExclusionsPagedResponse listExclusions(BillingAccountName paren
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   FolderName parent = FolderName.of("[FOLDER]");
    *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
@@ -1958,6 +2086,8 @@ public final ListExclusionsPagedResponse listExclusions(FolderName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
    *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
@@ -1986,6 +2116,8 @@ public final ListExclusionsPagedResponse listExclusions(OrganizationName parent)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
@@ -2014,6 +2146,8 @@ public final ListExclusionsPagedResponse listExclusions(ProjectName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
@@ -2039,6 +2173,8 @@ public final ListExclusionsPagedResponse listExclusions(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListExclusionsRequest request =
    *       ListExclusionsRequest.newBuilder()
@@ -2066,6 +2202,8 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListExclusionsRequest request =
    *       ListExclusionsRequest.newBuilder()
@@ -2094,6 +2232,8 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ListExclusionsRequest request =
    *       ListExclusionsRequest.newBuilder()
@@ -2128,6 +2268,8 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
    *   LogExclusion response = configClient.getExclusion(name);
@@ -2155,6 +2297,8 @@ public final LogExclusion getExclusion(LogExclusionName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
    *   LogExclusion response = configClient.getExclusion(name);
@@ -2181,6 +2325,8 @@ public final LogExclusion getExclusion(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   GetExclusionRequest request =
    *       GetExclusionRequest.newBuilder()
@@ -2205,6 +2351,8 @@ public final LogExclusion getExclusion(GetExclusionRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   GetExclusionRequest request =
    *       GetExclusionRequest.newBuilder()
@@ -2229,6 +2377,8 @@ public final UnaryCallable getExclusionCallab
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
    *   LogExclusion exclusion = LogExclusion.newBuilder().build();
@@ -2261,6 +2411,8 @@ public final LogExclusion createExclusion(BillingAccountName parent, LogExclusio
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   FolderName parent = FolderName.of("[FOLDER]");
    *   LogExclusion exclusion = LogExclusion.newBuilder().build();
@@ -2293,6 +2445,8 @@ public final LogExclusion createExclusion(FolderName parent, LogExclusion exclus
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
    *   LogExclusion exclusion = LogExclusion.newBuilder().build();
@@ -2325,6 +2479,8 @@ public final LogExclusion createExclusion(OrganizationName parent, LogExclusion
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   LogExclusion exclusion = LogExclusion.newBuilder().build();
@@ -2357,6 +2513,8 @@ public final LogExclusion createExclusion(ProjectName parent, LogExclusion exclu
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   LogExclusion exclusion = LogExclusion.newBuilder().build();
@@ -2386,6 +2544,8 @@ public final LogExclusion createExclusion(String parent, LogExclusion exclusion)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   CreateExclusionRequest request =
    *       CreateExclusionRequest.newBuilder()
@@ -2411,6 +2571,8 @@ public final LogExclusion createExclusion(CreateExclusionRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   CreateExclusionRequest request =
    *       CreateExclusionRequest.newBuilder()
@@ -2434,6 +2596,8 @@ public final UnaryCallable createExclusion
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
    *   LogExclusion exclusion = LogExclusion.newBuilder().build();
@@ -2476,6 +2640,8 @@ public final LogExclusion updateExclusion(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
    *   LogExclusion exclusion = LogExclusion.newBuilder().build();
@@ -2518,6 +2684,8 @@ public final LogExclusion updateExclusion(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UpdateExclusionRequest request =
    *       UpdateExclusionRequest.newBuilder()
@@ -2544,6 +2712,8 @@ public final LogExclusion updateExclusion(UpdateExclusionRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UpdateExclusionRequest request =
    *       UpdateExclusionRequest.newBuilder()
@@ -2569,6 +2739,8 @@ public final UnaryCallable updateExclusion
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
    *   configClient.deleteExclusion(name);
@@ -2596,6 +2768,8 @@ public final void deleteExclusion(LogExclusionName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
    *   configClient.deleteExclusion(name);
@@ -2622,6 +2796,8 @@ public final void deleteExclusion(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   DeleteExclusionRequest request =
    *       DeleteExclusionRequest.newBuilder()
@@ -2646,6 +2822,8 @@ public final void deleteExclusion(DeleteExclusionRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   DeleteExclusionRequest request =
    *       DeleteExclusionRequest.newBuilder()
@@ -2675,6 +2853,8 @@ public final UnaryCallable deleteExclusionCallabl
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   GetCmekSettingsRequest request =
    *       GetCmekSettingsRequest.newBuilder()
@@ -2704,6 +2884,8 @@ public final CmekSettings getCmekSettings(GetCmekSettingsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   GetCmekSettingsRequest request =
    *       GetCmekSettingsRequest.newBuilder()
@@ -2737,6 +2919,8 @@ public final UnaryCallable getCmekSettings
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UpdateCmekSettingsRequest request =
    *       UpdateCmekSettingsRequest.newBuilder()
@@ -2773,6 +2957,8 @@ public final CmekSettings updateCmekSettings(UpdateCmekSettingsRequest request)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (ConfigClient configClient = ConfigClient.create()) {
    *   UpdateCmekSettingsRequest request =
    *       UpdateCmekSettingsRequest.newBuilder()
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 4f7620cd37..3ad7561d48 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,6 +89,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * ConfigSettings.Builder configSettingsBuilder = ConfigSettings.newBuilder();
  * configSettingsBuilder
  *     .getBucketSettings()
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 cc55e72ca2..e15a4f0960 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,6 +63,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (LoggingClient loggingClient = LoggingClient.create()) {
  *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
  *   loggingClient.deleteLog(logName);
@@ -98,6 +100,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * LoggingSettings loggingSettings =
  *     LoggingSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -108,6 +112,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * LoggingSettings loggingSettings = LoggingSettings.newBuilder().setEndpoint(myEndpoint).build();
  * LoggingClient loggingClient = LoggingClient.create(loggingSettings);
  * }
@@ -174,6 +180,8 @@ public LoggingServiceV2Stub getStub() { *

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
    *   loggingClient.deleteLog(logName);
@@ -205,6 +213,8 @@ public final void deleteLog(LogName logName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   String logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString();
    *   loggingClient.deleteLog(logName);
@@ -233,6 +243,8 @@ public final void deleteLog(String logName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   DeleteLogRequest request =
    *       DeleteLogRequest.newBuilder()
@@ -258,6 +270,8 @@ public final void deleteLog(DeleteLogRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   DeleteLogRequest request =
    *       DeleteLogRequest.newBuilder()
@@ -283,6 +297,8 @@ public final UnaryCallable deleteLogCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
    *   MonitoredResource resource = MonitoredResource.newBuilder().build();
@@ -358,6 +374,8 @@ public final WriteLogEntriesResponse writeLogEntries(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   String logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString();
    *   MonitoredResource resource = MonitoredResource.newBuilder().build();
@@ -433,6 +451,8 @@ public final WriteLogEntriesResponse writeLogEntries(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   WriteLogEntriesRequest request =
    *       WriteLogEntriesRequest.newBuilder()
@@ -464,6 +484,8 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   WriteLogEntriesRequest request =
    *       WriteLogEntriesRequest.newBuilder()
@@ -495,6 +517,8 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   List resourceNames = new ArrayList<>();
    *   String filter = "filter-1274492040";
@@ -549,6 +573,8 @@ public final ListLogEntriesPagedResponse listLogEntries(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   ListLogEntriesRequest request =
    *       ListLogEntriesRequest.newBuilder()
@@ -580,6 +606,8 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   ListLogEntriesRequest request =
    *       ListLogEntriesRequest.newBuilder()
@@ -611,6 +639,8 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   ListLogEntriesRequest request =
    *       ListLogEntriesRequest.newBuilder()
@@ -647,6 +677,8 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   ListMonitoredResourceDescriptorsRequest request =
    *       ListMonitoredResourceDescriptorsRequest.newBuilder()
@@ -675,6 +707,8 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   ListMonitoredResourceDescriptorsRequest request =
    *       ListMonitoredResourceDescriptorsRequest.newBuilder()
@@ -703,6 +737,8 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   ListMonitoredResourceDescriptorsRequest request =
    *       ListMonitoredResourceDescriptorsRequest.newBuilder()
@@ -739,6 +775,8 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
    *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
@@ -766,6 +804,8 @@ public final ListLogsPagedResponse listLogs(BillingAccountName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   FolderName parent = FolderName.of("[FOLDER]");
    *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
@@ -793,6 +833,8 @@ public final ListLogsPagedResponse listLogs(FolderName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
    *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
@@ -820,6 +862,8 @@ public final ListLogsPagedResponse listLogs(OrganizationName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
@@ -847,6 +891,8 @@ public final ListLogsPagedResponse listLogs(ProjectName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
@@ -873,6 +919,8 @@ public final ListLogsPagedResponse listLogs(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   ListLogsRequest request =
    *       ListLogsRequest.newBuilder()
@@ -902,6 +950,8 @@ public final ListLogsPagedResponse listLogs(ListLogsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   ListLogsRequest request =
    *       ListLogsRequest.newBuilder()
@@ -930,6 +980,8 @@ public final UnaryCallable listLogsPaged
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   ListLogsRequest request =
    *       ListLogsRequest.newBuilder()
@@ -965,6 +1017,8 @@ public final UnaryCallable listLogsCallable()
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (LoggingClient loggingClient = LoggingClient.create()) {
    *   BidiStream bidiStream =
    *       loggingClient.tailLogEntriesCallable().call();
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 8643ce5d28..a128b6498e 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,6 +69,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * LoggingSettings.Builder loggingSettingsBuilder = LoggingSettings.newBuilder();
  * loggingSettingsBuilder
  *     .deleteLogSettings()
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 bd686dac22..c74e0a912c 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,6 +51,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (MetricsClient metricsClient = MetricsClient.create()) {
  *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
  *   LogMetric response = metricsClient.getLogMetric(metricName);
@@ -86,6 +88,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * MetricsSettings metricsSettings =
  *     MetricsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -96,6 +100,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * MetricsSettings metricsSettings = MetricsSettings.newBuilder().setEndpoint(myEndpoint).build();
  * MetricsClient metricsClient = MetricsClient.create(metricsSettings);
  * }
@@ -160,6 +166,8 @@ public MetricsServiceV2Stub getStub() { *

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
@@ -187,6 +195,8 @@ public final ListLogMetricsPagedResponse listLogMetrics(ProjectName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
@@ -211,6 +221,8 @@ public final ListLogMetricsPagedResponse listLogMetrics(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   ListLogMetricsRequest request =
    *       ListLogMetricsRequest.newBuilder()
@@ -238,6 +250,8 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   ListLogMetricsRequest request =
    *       ListLogMetricsRequest.newBuilder()
@@ -265,6 +279,8 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   ListLogMetricsRequest request =
    *       ListLogMetricsRequest.newBuilder()
@@ -299,6 +315,8 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
    *   LogMetric response = metricsClient.getLogMetric(metricName);
@@ -324,6 +342,8 @@ public final LogMetric getLogMetric(LogMetricName metricName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
    *   LogMetric response = metricsClient.getLogMetric(metricName);
@@ -347,6 +367,8 @@ public final LogMetric getLogMetric(String metricName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   GetLogMetricRequest request =
    *       GetLogMetricRequest.newBuilder()
@@ -370,6 +392,8 @@ public final LogMetric getLogMetric(GetLogMetricRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   GetLogMetricRequest request =
    *       GetLogMetricRequest.newBuilder()
@@ -392,6 +416,8 @@ public final UnaryCallable getLogMetricCallable(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   LogMetric metric = LogMetric.newBuilder().build();
@@ -422,6 +448,8 @@ public final LogMetric createLogMetric(ProjectName parent, LogMetric metric) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   LogMetric metric = LogMetric.newBuilder().build();
@@ -449,6 +477,8 @@ public final LogMetric createLogMetric(String parent, LogMetric metric) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   CreateLogMetricRequest request =
    *       CreateLogMetricRequest.newBuilder()
@@ -473,6 +503,8 @@ public final LogMetric createLogMetric(CreateLogMetricRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   CreateLogMetricRequest request =
    *       CreateLogMetricRequest.newBuilder()
@@ -496,6 +528,8 @@ public final UnaryCallable createLogMetricCal
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
    *   LogMetric metric = LogMetric.newBuilder().build();
@@ -527,6 +561,8 @@ public final LogMetric updateLogMetric(LogMetricName metricName, LogMetric metri
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
    *   LogMetric metric = LogMetric.newBuilder().build();
@@ -555,6 +591,8 @@ public final LogMetric updateLogMetric(String metricName, LogMetric metric) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   UpdateLogMetricRequest request =
    *       UpdateLogMetricRequest.newBuilder()
@@ -579,6 +617,8 @@ public final LogMetric updateLogMetric(UpdateLogMetricRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   UpdateLogMetricRequest request =
    *       UpdateLogMetricRequest.newBuilder()
@@ -602,6 +642,8 @@ public final UnaryCallable updateLogMetricCal
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
    *   metricsClient.deleteLogMetric(metricName);
@@ -627,6 +669,8 @@ public final void deleteLogMetric(LogMetricName metricName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
    *   metricsClient.deleteLogMetric(metricName);
@@ -650,6 +694,8 @@ public final void deleteLogMetric(String metricName) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   DeleteLogMetricRequest request =
    *       DeleteLogMetricRequest.newBuilder()
@@ -673,6 +719,8 @@ public final void deleteLogMetric(DeleteLogMetricRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (MetricsClient metricsClient = MetricsClient.create()) {
    *   DeleteLogMetricRequest request =
    *       DeleteLogMetricRequest.newBuilder()
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 1cd15a6aa0..d795fcdd39 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,6 +61,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * MetricsSettings.Builder metricsSettingsBuilder = MetricsSettings.newBuilder();
  * metricsSettingsBuilder
  *     .getLogMetricSettings()
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 6de1226da7..291dcca51b 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,6 +24,8 @@
  * 

Sample for LoggingClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (LoggingClient loggingClient = LoggingClient.create()) {
  *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
  *   loggingClient.deleteLog(logName);
@@ -37,6 +39,8 @@
  * 

Sample for ConfigClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (ConfigClient configClient = ConfigClient.create()) {
  *   GetBucketRequest request =
  *       GetBucketRequest.newBuilder()
@@ -55,6 +59,8 @@
  * 

Sample for MetricsClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * 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 26115a15fd..456dd597f4 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,6 +103,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * ConfigServiceV2StubSettings.Builder configSettingsBuilder =
  *     ConfigServiceV2StubSettings.newBuilder();
  * configSettingsBuilder
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 79ba51699e..180ef48c6b 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,6 +93,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * LoggingServiceV2StubSettings.Builder loggingSettingsBuilder =
  *     LoggingServiceV2StubSettings.newBuilder();
  * loggingSettingsBuilder
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 7c0505427f..5716cdceae 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,6 +75,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * MetricsServiceV2StubSettings.Builder metricsSettingsBuilder =
  *     MetricsServiceV2StubSettings.newBuilder();
  * metricsSettingsBuilder
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 27f64bbed8..0efce32a29 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,6 +59,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
  *   ProjectName parent = ProjectName.of("[PROJECT]");
  *   Schema schema = Schema.newBuilder().build();
@@ -96,6 +98,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * SchemaServiceSettings schemaServiceSettings =
  *     SchemaServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -106,6 +110,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * SchemaServiceSettings schemaServiceSettings =
  *     SchemaServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  * SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings);
@@ -173,6 +179,8 @@ public SchemaServiceStub getStub() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   Schema schema = Schema.newBuilder().build();
@@ -209,6 +217,8 @@ public final Schema createSchema(ProjectName parent, Schema schema, String schem
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   Schema schema = Schema.newBuilder().build();
@@ -245,6 +255,8 @@ public final Schema createSchema(String parent, Schema schema, String schemaId)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   CreateSchemaRequest request =
    *       CreateSchemaRequest.newBuilder()
@@ -270,6 +282,8 @@ public final Schema createSchema(CreateSchemaRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   CreateSchemaRequest request =
    *       CreateSchemaRequest.newBuilder()
@@ -294,6 +308,8 @@ public final UnaryCallable createSchemaCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
    *   Schema response = schemaServiceClient.getSchema(name);
@@ -317,6 +333,8 @@ public final Schema getSchema(SchemaName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
    *   Schema response = schemaServiceClient.getSchema(name);
@@ -339,6 +357,8 @@ public final Schema getSchema(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   GetSchemaRequest request =
    *       GetSchemaRequest.newBuilder()
@@ -363,6 +383,8 @@ public final Schema getSchema(GetSchemaRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   GetSchemaRequest request =
    *       GetSchemaRequest.newBuilder()
@@ -386,6 +408,8 @@ public final UnaryCallable getSchemaCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) {
@@ -413,6 +437,8 @@ public final ListSchemasPagedResponse listSchemas(ProjectName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) {
@@ -437,6 +463,8 @@ public final ListSchemasPagedResponse listSchemas(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ListSchemasRequest request =
    *       ListSchemasRequest.newBuilder()
@@ -465,6 +493,8 @@ public final ListSchemasPagedResponse listSchemas(ListSchemasRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ListSchemasRequest request =
    *       ListSchemasRequest.newBuilder()
@@ -493,6 +523,8 @@ public final ListSchemasPagedResponse listSchemas(ListSchemasRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ListSchemasRequest request =
    *       ListSchemasRequest.newBuilder()
@@ -527,6 +559,8 @@ public final UnaryCallable listSchemasC
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
    *   schemaServiceClient.deleteSchema(name);
@@ -550,6 +584,8 @@ public final void deleteSchema(SchemaName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
    *   schemaServiceClient.deleteSchema(name);
@@ -572,6 +608,8 @@ public final void deleteSchema(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   DeleteSchemaRequest request =
    *       DeleteSchemaRequest.newBuilder()
@@ -595,6 +633,8 @@ public final void deleteSchema(DeleteSchemaRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   DeleteSchemaRequest request =
    *       DeleteSchemaRequest.newBuilder()
@@ -617,6 +657,8 @@ public final UnaryCallable deleteSchemaCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   Schema schema = Schema.newBuilder().build();
@@ -645,6 +687,8 @@ public final ValidateSchemaResponse validateSchema(ProjectName parent, Schema sc
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   Schema schema = Schema.newBuilder().build();
@@ -670,6 +714,8 @@ public final ValidateSchemaResponse validateSchema(String parent, Schema schema)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ValidateSchemaRequest request =
    *       ValidateSchemaRequest.newBuilder()
@@ -694,6 +740,8 @@ public final ValidateSchemaResponse validateSchema(ValidateSchemaRequest request
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ValidateSchemaRequest request =
    *       ValidateSchemaRequest.newBuilder()
@@ -719,6 +767,8 @@ public final ValidateSchemaResponse validateSchema(ValidateSchemaRequest request
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ValidateMessageRequest request =
    *       ValidateMessageRequest.newBuilder()
@@ -744,6 +794,8 @@ public final ValidateMessageResponse validateMessage(ValidateMessageRequest requ
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ValidateMessageRequest request =
    *       ValidateMessageRequest.newBuilder()
@@ -772,6 +824,8 @@ public final ValidateMessageResponse validateMessage(ValidateMessageRequest requ
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   SetIamPolicyRequest request =
    *       SetIamPolicyRequest.newBuilder()
@@ -798,6 +852,8 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   SetIamPolicyRequest request =
    *       SetIamPolicyRequest.newBuilder()
@@ -822,6 +878,8 @@ public final UnaryCallable setIamPolicyCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   GetIamPolicyRequest request =
    *       GetIamPolicyRequest.newBuilder()
@@ -847,6 +905,8 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   GetIamPolicyRequest request =
    *       GetIamPolicyRequest.newBuilder()
@@ -875,6 +935,8 @@ public final UnaryCallable getIamPolicyCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   TestIamPermissionsRequest request =
    *       TestIamPermissionsRequest.newBuilder()
@@ -904,6 +966,8 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   TestIamPermissionsRequest request =
    *       TestIamPermissionsRequest.newBuilder()
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 7fa08f222a..7633464d05 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,6 +69,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * SchemaServiceSettings.Builder schemaServiceSettingsBuilder = SchemaServiceSettings.newBuilder();
  * schemaServiceSettingsBuilder
  *     .createSchemaSettings()
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 17f81341f6..9b31bed522 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,6 +77,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
  *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
  *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
@@ -117,6 +119,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * SubscriptionAdminSettings subscriptionAdminSettings =
  *     SubscriptionAdminSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -128,6 +132,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * SubscriptionAdminSettings subscriptionAdminSettings =
  *     SubscriptionAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
  * SubscriptionAdminClient subscriptionAdminClient =
@@ -205,6 +211,8 @@ public SubscriberStub getStub() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
@@ -271,6 +279,8 @@ public final Subscription createSubscription(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
@@ -337,6 +347,8 @@ public final Subscription createSubscription(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
@@ -403,6 +415,8 @@ public final Subscription createSubscription(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
@@ -469,6 +483,8 @@ public final Subscription createSubscription(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   Subscription request =
    *       Subscription.newBuilder()
@@ -515,6 +531,8 @@ public final Subscription createSubscription(Subscription request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   Subscription request =
    *       Subscription.newBuilder()
@@ -552,6 +570,8 @@ public final UnaryCallable createSubscriptionCallabl
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   Subscription response = subscriptionAdminClient.getSubscription(subscription);
@@ -577,6 +597,8 @@ public final Subscription getSubscription(SubscriptionName subscription) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    *   Subscription response = subscriptionAdminClient.getSubscription(subscription);
@@ -600,6 +622,8 @@ public final Subscription getSubscription(String subscription) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   GetSubscriptionRequest request =
    *       GetSubscriptionRequest.newBuilder()
@@ -623,6 +647,8 @@ public final Subscription getSubscription(GetSubscriptionRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   GetSubscriptionRequest request =
    *       GetSubscriptionRequest.newBuilder()
@@ -647,6 +673,8 @@ public final UnaryCallable getSubscription
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   UpdateSubscriptionRequest request =
    *       UpdateSubscriptionRequest.newBuilder()
@@ -672,6 +700,8 @@ public final Subscription updateSubscription(UpdateSubscriptionRequest request)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   UpdateSubscriptionRequest request =
    *       UpdateSubscriptionRequest.newBuilder()
@@ -696,6 +726,8 @@ public final UnaryCallable updateSubscr
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectName project = ProjectName.of("[PROJECT]");
    *   for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
@@ -723,6 +755,8 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ProjectName projec
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String project = ProjectName.of("[PROJECT]").toString();
    *   for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
@@ -748,6 +782,8 @@ public final ListSubscriptionsPagedResponse listSubscriptions(String project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ListSubscriptionsRequest request =
    *       ListSubscriptionsRequest.newBuilder()
@@ -775,6 +811,8 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ListSubscriptionsRequest request =
    *       ListSubscriptionsRequest.newBuilder()
@@ -803,6 +841,8 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ListSubscriptionsRequest request =
    *       ListSubscriptionsRequest.newBuilder()
@@ -841,6 +881,8 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   subscriptionAdminClient.deleteSubscription(subscription);
@@ -869,6 +911,8 @@ public final void deleteSubscription(SubscriptionName subscription) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    *   subscriptionAdminClient.deleteSubscription(subscription);
@@ -895,6 +939,8 @@ public final void deleteSubscription(String subscription) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   DeleteSubscriptionRequest request =
    *       DeleteSubscriptionRequest.newBuilder()
@@ -921,6 +967,8 @@ public final void deleteSubscription(DeleteSubscriptionRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   DeleteSubscriptionRequest request =
    *       DeleteSubscriptionRequest.newBuilder()
@@ -947,6 +995,8 @@ public final UnaryCallable deleteSubscriptionC
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   List ackIds = new ArrayList<>();
@@ -988,6 +1038,8 @@ public final void modifyAckDeadline(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    *   List ackIds = new ArrayList<>();
@@ -1029,6 +1081,8 @@ public final void modifyAckDeadline(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ModifyAckDeadlineRequest request =
    *       ModifyAckDeadlineRequest.newBuilder()
@@ -1057,6 +1111,8 @@ public final void modifyAckDeadline(ModifyAckDeadlineRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ModifyAckDeadlineRequest request =
    *       ModifyAckDeadlineRequest.newBuilder()
@@ -1086,6 +1142,8 @@ public final UnaryCallable modifyAckDeadlineCal
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   List ackIds = new ArrayList<>();
@@ -1119,6 +1177,8 @@ public final void acknowledge(SubscriptionName subscription, List ackIds
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    *   List ackIds = new ArrayList<>();
@@ -1149,6 +1209,8 @@ public final void acknowledge(String subscription, List ackIds) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   AcknowledgeRequest request =
    *       AcknowledgeRequest.newBuilder()
@@ -1177,6 +1239,8 @@ public final void acknowledge(AcknowledgeRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   AcknowledgeRequest request =
    *       AcknowledgeRequest.newBuilder()
@@ -1201,6 +1265,8 @@ public final UnaryCallable acknowledgeCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   int maxMessages = 496131527;
@@ -1231,6 +1297,8 @@ public final PullResponse pull(SubscriptionName subscription, int maxMessages) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    *   int maxMessages = 496131527;
@@ -1258,6 +1326,8 @@ public final PullResponse pull(String subscription, int maxMessages) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   boolean returnImmediately = true;
@@ -1298,6 +1368,8 @@ public final PullResponse pull(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    *   boolean returnImmediately = true;
@@ -1337,6 +1409,8 @@ public final PullResponse pull(String subscription, boolean returnImmediately, i
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   PullRequest request =
    *       PullRequest.newBuilder()
@@ -1363,6 +1437,8 @@ public final PullResponse pull(PullRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   PullRequest request =
    *       PullRequest.newBuilder()
@@ -1392,6 +1468,8 @@ public final UnaryCallable pullCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   BidiStream bidiStream =
    *       subscriptionAdminClient.streamingPullCallable().call();
@@ -1430,6 +1508,8 @@ public final UnaryCallable pullCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   PushConfig pushConfig = PushConfig.newBuilder().build();
@@ -1466,6 +1546,8 @@ public final void modifyPushConfig(SubscriptionName subscription, PushConfig pus
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    *   PushConfig pushConfig = PushConfig.newBuilder().build();
@@ -1502,6 +1584,8 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ModifyPushConfigRequest request =
    *       ModifyPushConfigRequest.newBuilder()
@@ -1531,6 +1615,8 @@ public final void modifyPushConfig(ModifyPushConfigRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ModifyPushConfigRequest request =
    *       ModifyPushConfigRequest.newBuilder()
@@ -1558,6 +1644,8 @@ public final UnaryCallable modifyPushConfigCalla
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
    *   Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
@@ -1586,6 +1674,8 @@ public final Snapshot getSnapshot(SnapshotName snapshot) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
    *   Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
@@ -1611,6 +1701,8 @@ public final Snapshot getSnapshot(String snapshot) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   GetSnapshotRequest request =
    *       GetSnapshotRequest.newBuilder()
@@ -1637,6 +1729,8 @@ public final Snapshot getSnapshot(GetSnapshotRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   GetSnapshotRequest request =
    *       GetSnapshotRequest.newBuilder()
@@ -1663,6 +1757,8 @@ public final UnaryCallable getSnapshotCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectName project = ProjectName.of("[PROJECT]");
    *   for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
@@ -1693,6 +1789,8 @@ public final ListSnapshotsPagedResponse listSnapshots(ProjectName project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String project = ProjectName.of("[PROJECT]").toString();
    *   for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
@@ -1720,6 +1818,8 @@ public final ListSnapshotsPagedResponse listSnapshots(String project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ListSnapshotsRequest request =
    *       ListSnapshotsRequest.newBuilder()
@@ -1750,6 +1850,8 @@ public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest reque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ListSnapshotsRequest request =
    *       ListSnapshotsRequest.newBuilder()
@@ -1781,6 +1883,8 @@ public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest reque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ListSnapshotsRequest request =
    *       ListSnapshotsRequest.newBuilder()
@@ -1826,6 +1930,8 @@ public final UnaryCallable listSnap
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
    *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
@@ -1874,6 +1980,8 @@ public final Snapshot createSnapshot(SnapshotName name, SubscriptionName subscri
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
    *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
@@ -1922,6 +2030,8 @@ public final Snapshot createSnapshot(SnapshotName name, String subscription) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
    *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
@@ -1970,6 +2080,8 @@ public final Snapshot createSnapshot(String name, SubscriptionName subscription)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
    *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
@@ -2015,6 +2127,8 @@ public final Snapshot createSnapshot(String name, String subscription) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   CreateSnapshotRequest request =
    *       CreateSnapshotRequest.newBuilder()
@@ -2051,6 +2165,8 @@ public final Snapshot createSnapshot(CreateSnapshotRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   CreateSnapshotRequest request =
    *       CreateSnapshotRequest.newBuilder()
@@ -2079,6 +2195,8 @@ public final UnaryCallable createSnapshotCallab
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   UpdateSnapshotRequest request =
    *       UpdateSnapshotRequest.newBuilder()
@@ -2106,6 +2224,8 @@ public final Snapshot updateSnapshot(UpdateSnapshotRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   UpdateSnapshotRequest request =
    *       UpdateSnapshotRequest.newBuilder()
@@ -2136,6 +2256,8 @@ public final UnaryCallable updateSnapshotCallab
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
    *   subscriptionAdminClient.deleteSnapshot(snapshot);
@@ -2167,6 +2289,8 @@ public final void deleteSnapshot(SnapshotName snapshot) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
    *   subscriptionAdminClient.deleteSnapshot(snapshot);
@@ -2196,6 +2320,8 @@ public final void deleteSnapshot(String snapshot) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   DeleteSnapshotRequest request =
    *       DeleteSnapshotRequest.newBuilder()
@@ -2225,6 +2351,8 @@ public final void deleteSnapshot(DeleteSnapshotRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   DeleteSnapshotRequest request =
    *       DeleteSnapshotRequest.newBuilder()
@@ -2253,6 +2381,8 @@ public final UnaryCallable deleteSnapshotCallable(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SeekRequest request =
    *       SeekRequest.newBuilder()
@@ -2281,6 +2411,8 @@ public final SeekResponse seek(SeekRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SeekRequest request =
    *       SeekRequest.newBuilder()
@@ -2305,6 +2437,8 @@ public final UnaryCallable seekCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SetIamPolicyRequest request =
    *       SetIamPolicyRequest.newBuilder()
@@ -2331,6 +2465,8 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   SetIamPolicyRequest request =
    *       SetIamPolicyRequest.newBuilder()
@@ -2355,6 +2491,8 @@ public final UnaryCallable setIamPolicyCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   GetIamPolicyRequest request =
    *       GetIamPolicyRequest.newBuilder()
@@ -2380,6 +2518,8 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   GetIamPolicyRequest request =
    *       GetIamPolicyRequest.newBuilder()
@@ -2408,6 +2548,8 @@ public final UnaryCallable getIamPolicyCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   TestIamPermissionsRequest request =
    *       TestIamPermissionsRequest.newBuilder()
@@ -2437,6 +2579,8 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   TestIamPermissionsRequest request =
    *       TestIamPermissionsRequest.newBuilder()
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 93ae5556a8..963195e891 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,6 +83,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * SubscriptionAdminSettings.Builder subscriptionAdminSettingsBuilder =
  *     SubscriptionAdminSettings.newBuilder();
  * subscriptionAdminSettingsBuilder
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 a9f3308846..68bf054a86 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,6 +65,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
  *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
  *   Topic response = topicAdminClient.createTopic(name);
@@ -100,6 +102,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * TopicAdminSettings topicAdminSettings =
  *     TopicAdminSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -110,6 +114,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * TopicAdminSettings topicAdminSettings =
  *     TopicAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
  * TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
@@ -176,6 +182,8 @@ public PublisherStub getStub() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   Topic response = topicAdminClient.createTopic(name);
@@ -202,6 +210,8 @@ public final Topic createTopic(TopicName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   String name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
    *   Topic response = topicAdminClient.createTopic(name);
@@ -228,6 +238,8 @@ public final Topic createTopic(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   Topic request =
    *       Topic.newBuilder()
@@ -258,6 +270,8 @@ public final Topic createTopic(Topic request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   Topic request =
    *       Topic.newBuilder()
@@ -286,6 +300,8 @@ public final UnaryCallable createTopicCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   UpdateTopicRequest request =
    *       UpdateTopicRequest.newBuilder()
@@ -310,6 +326,8 @@ public final Topic updateTopic(UpdateTopicRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   UpdateTopicRequest request =
    *       UpdateTopicRequest.newBuilder()
@@ -333,6 +351,8 @@ public final UnaryCallable updateTopicCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   List messages = new ArrayList<>();
@@ -361,6 +381,8 @@ public final PublishResponse publish(TopicName topic, List messag
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
    *   List messages = new ArrayList<>();
@@ -386,6 +408,8 @@ public final PublishResponse publish(String topic, List messages)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   PublishRequest request =
    *       PublishRequest.newBuilder()
@@ -410,6 +434,8 @@ public final PublishResponse publish(PublishRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   PublishRequest request =
    *       PublishRequest.newBuilder()
@@ -433,6 +459,8 @@ public final UnaryCallable publishCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   Topic response = topicAdminClient.getTopic(topic);
@@ -456,6 +484,8 @@ public final Topic getTopic(TopicName topic) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
    *   Topic response = topicAdminClient.getTopic(topic);
@@ -478,6 +508,8 @@ public final Topic getTopic(String topic) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   GetTopicRequest request =
    *       GetTopicRequest.newBuilder()
@@ -501,6 +533,8 @@ public final Topic getTopic(GetTopicRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   GetTopicRequest request =
    *       GetTopicRequest.newBuilder()
@@ -523,6 +557,8 @@ public final UnaryCallable getTopicCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   ProjectName project = ProjectName.of("[PROJECT]");
    *   for (Topic element : topicAdminClient.listTopics(project).iterateAll()) {
@@ -550,6 +586,8 @@ public final ListTopicsPagedResponse listTopics(ProjectName project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   String project = ProjectName.of("[PROJECT]").toString();
    *   for (Topic element : topicAdminClient.listTopics(project).iterateAll()) {
@@ -574,6 +612,8 @@ public final ListTopicsPagedResponse listTopics(String project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   ListTopicsRequest request =
    *       ListTopicsRequest.newBuilder()
@@ -601,6 +641,8 @@ public final ListTopicsPagedResponse listTopics(ListTopicsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   ListTopicsRequest request =
    *       ListTopicsRequest.newBuilder()
@@ -627,6 +669,8 @@ public final UnaryCallable listTopic
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   ListTopicsRequest request =
    *       ListTopicsRequest.newBuilder()
@@ -660,6 +704,8 @@ public final UnaryCallable listTopicsCall
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   for (String element : topicAdminClient.listTopicSubscriptions(topic).iterateAll()) {
@@ -687,6 +733,8 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(TopicNam
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
    *   for (String element : topicAdminClient.listTopicSubscriptions(topic).iterateAll()) {
@@ -712,6 +760,8 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(String t
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   ListTopicSubscriptionsRequest request =
    *       ListTopicSubscriptionsRequest.newBuilder()
@@ -740,6 +790,8 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   ListTopicSubscriptionsRequest request =
    *       ListTopicSubscriptionsRequest.newBuilder()
@@ -768,6 +820,8 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   ListTopicSubscriptionsRequest request =
    *       ListTopicSubscriptionsRequest.newBuilder()
@@ -806,6 +860,8 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   for (String element : topicAdminClient.listTopicSnapshots(topic).iterateAll()) {
@@ -836,6 +892,8 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(TopicName topic)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
    *   for (String element : topicAdminClient.listTopicSnapshots(topic).iterateAll()) {
@@ -864,6 +922,8 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(String topic) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   ListTopicSnapshotsRequest request =
    *       ListTopicSnapshotsRequest.newBuilder()
@@ -895,6 +955,8 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   ListTopicSnapshotsRequest request =
    *       ListTopicSnapshotsRequest.newBuilder()
@@ -926,6 +988,8 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   ListTopicSnapshotsRequest request =
    *       ListTopicSnapshotsRequest.newBuilder()
@@ -964,6 +1028,8 @@ public final ListTopicSnapshotsPagedResponse listTopicSnapshots(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   topicAdminClient.deleteTopic(topic);
@@ -990,6 +1056,8 @@ public final void deleteTopic(TopicName topic) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
    *   topicAdminClient.deleteTopic(topic);
@@ -1015,6 +1083,8 @@ public final void deleteTopic(String topic) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   DeleteTopicRequest request =
    *       DeleteTopicRequest.newBuilder()
@@ -1041,6 +1111,8 @@ public final void deleteTopic(DeleteTopicRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   DeleteTopicRequest request =
    *       DeleteTopicRequest.newBuilder()
@@ -1065,6 +1137,8 @@ public final UnaryCallable deleteTopicCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   DetachSubscriptionRequest request =
    *       DetachSubscriptionRequest.newBuilder()
@@ -1090,6 +1164,8 @@ public final DetachSubscriptionResponse detachSubscription(DetachSubscriptionReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   DetachSubscriptionRequest request =
    *       DetachSubscriptionRequest.newBuilder()
@@ -1116,6 +1192,8 @@ public final DetachSubscriptionResponse detachSubscription(DetachSubscriptionReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   SetIamPolicyRequest request =
    *       SetIamPolicyRequest.newBuilder()
@@ -1142,6 +1220,8 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   SetIamPolicyRequest request =
    *       SetIamPolicyRequest.newBuilder()
@@ -1166,6 +1246,8 @@ public final UnaryCallable setIamPolicyCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   GetIamPolicyRequest request =
    *       GetIamPolicyRequest.newBuilder()
@@ -1191,6 +1273,8 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   GetIamPolicyRequest request =
    *       GetIamPolicyRequest.newBuilder()
@@ -1219,6 +1303,8 @@ public final UnaryCallable getIamPolicyCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TestIamPermissionsRequest request =
    *       TestIamPermissionsRequest.newBuilder()
@@ -1248,6 +1334,8 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TestIamPermissionsRequest request =
    *       TestIamPermissionsRequest.newBuilder()
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 44983d1b49..c3093a8641 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,6 +76,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * TopicAdminSettings.Builder topicAdminSettingsBuilder = TopicAdminSettings.newBuilder();
  * topicAdminSettingsBuilder
  *     .createTopicSettings()
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 5858190904..6e17761f9e 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,6 +27,8 @@
  * 

Sample for TopicAdminClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
  *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
  *   Topic response = topicAdminClient.createTopic(name);
@@ -42,6 +44,8 @@
  * 

Sample for SubscriptionAdminClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
  *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
  *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
@@ -59,6 +63,8 @@
  * 

Sample for SchemaServiceClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
  *   ProjectName parent = ProjectName.of("[PROJECT]");
  *   Schema schema = Schema.newBuilder().build();
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 945ce51e96..aaeb343d30 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,6 +99,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * PublisherStubSettings.Builder topicAdminSettingsBuilder = PublisherStubSettings.newBuilder();
  * topicAdminSettingsBuilder
  *     .createTopicSettings()
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 d97ca4fada..a7d8fc4ae4 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,6 +82,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * SchemaServiceStubSettings.Builder schemaServiceSettingsBuilder =
  *     SchemaServiceStubSettings.newBuilder();
  * schemaServiceSettingsBuilder
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 c58c8656d8..bb8299b268 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,6 +97,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * SubscriberStubSettings.Builder subscriptionAdminSettingsBuilder =
  *     SubscriberStubSettings.newBuilder();
  * subscriptionAdminSettingsBuilder
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 237e88ff06..da68b2788e 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
@@ -68,6 +68,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
  *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
  *   Instance response = cloudRedisClient.getInstance(name);
@@ -103,6 +105,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * CloudRedisSettings cloudRedisSettings =
  *     CloudRedisSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -113,6 +117,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * CloudRedisSettings cloudRedisSettings =
  *     CloudRedisSettings.newBuilder().setEndpoint(myEndpoint).build();
  * CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
@@ -200,6 +206,8 @@ public final OperationsClient getOperationsClient() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
@@ -237,6 +245,8 @@ public final ListInstancesPagedResponse listInstances(LocationName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
    *   for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
@@ -271,6 +281,8 @@ public final ListInstancesPagedResponse listInstances(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   ListInstancesRequest request =
    *       ListInstancesRequest.newBuilder()
@@ -308,6 +320,8 @@ public final ListInstancesPagedResponse listInstances(ListInstancesRequest reque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   ListInstancesRequest request =
    *       ListInstancesRequest.newBuilder()
@@ -346,6 +360,8 @@ public final ListInstancesPagedResponse listInstances(ListInstancesRequest reque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   ListInstancesRequest request =
    *       ListInstancesRequest.newBuilder()
@@ -379,6 +395,8 @@ public final UnaryCallable listInst
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
    *   Instance response = cloudRedisClient.getInstance(name);
@@ -403,6 +421,8 @@ public final Instance getInstance(InstanceName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
    *   Instance response = cloudRedisClient.getInstance(name);
@@ -426,6 +446,8 @@ public final Instance getInstance(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   GetInstanceRequest request =
    *       GetInstanceRequest.newBuilder()
@@ -449,6 +471,8 @@ public final Instance getInstance(GetInstanceRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   GetInstanceRequest request =
    *       GetInstanceRequest.newBuilder()
@@ -472,6 +496,8 @@ public final UnaryCallable getInstanceCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
    *   InstanceAuthString response = cloudRedisClient.getInstanceAuthString(name);
@@ -499,6 +525,8 @@ public final InstanceAuthString getInstanceAuthString(InstanceName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
    *   InstanceAuthString response = cloudRedisClient.getInstanceAuthString(name);
@@ -524,6 +552,8 @@ public final InstanceAuthString getInstanceAuthString(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   GetInstanceAuthStringRequest request =
    *       GetInstanceAuthStringRequest.newBuilder()
@@ -548,6 +578,8 @@ public final InstanceAuthString getInstanceAuthString(GetInstanceAuthStringReque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   GetInstanceAuthStringRequest request =
    *       GetInstanceAuthStringRequest.newBuilder()
@@ -583,6 +615,8 @@ public final InstanceAuthString getInstanceAuthString(GetInstanceAuthStringReque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   String instanceId = "instanceId902024336";
@@ -635,6 +669,8 @@ public final OperationFuture createInstanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
    *   String instanceId = "instanceId902024336";
@@ -687,6 +723,8 @@ public final OperationFuture createInstanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   CreateInstanceRequest request =
    *       CreateInstanceRequest.newBuilder()
@@ -723,6 +761,8 @@ public final OperationFuture createInstanceAsync(CreateInstanceRe
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   CreateInstanceRequest request =
    *       CreateInstanceRequest.newBuilder()
@@ -760,6 +800,8 @@ public final OperationFuture createInstanceAsync(CreateInstanceRe
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   CreateInstanceRequest request =
    *       CreateInstanceRequest.newBuilder()
@@ -788,6 +830,8 @@ public final UnaryCallable createInstanceCalla
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   FieldMask updateMask = FieldMask.newBuilder().build();
    *   Instance instance = Instance.newBuilder().build();
@@ -821,6 +865,8 @@ public final OperationFuture updateInstanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   UpdateInstanceRequest request =
    *       UpdateInstanceRequest.newBuilder()
@@ -849,6 +895,8 @@ public final OperationFuture updateInstanceAsync(UpdateInstanceRe
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   UpdateInstanceRequest request =
    *       UpdateInstanceRequest.newBuilder()
@@ -878,6 +926,8 @@ public final OperationFuture updateInstanceAsync(UpdateInstanceRe
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   UpdateInstanceRequest request =
    *       UpdateInstanceRequest.newBuilder()
@@ -901,6 +951,8 @@ public final UnaryCallable updateInstanceCalla
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
    *   String redisVersion = "redisVersion-1972584739";
@@ -931,6 +983,8 @@ public final OperationFuture upgradeInstanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
    *   String redisVersion = "redisVersion-1972584739";
@@ -958,6 +1012,8 @@ public final OperationFuture upgradeInstanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   UpgradeInstanceRequest request =
    *       UpgradeInstanceRequest.newBuilder()
@@ -982,6 +1038,8 @@ public final OperationFuture upgradeInstanceAsync(UpgradeInstance
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   UpgradeInstanceRequest request =
    *       UpgradeInstanceRequest.newBuilder()
@@ -1007,6 +1065,8 @@ public final OperationFuture upgradeInstanceAsync(UpgradeInstance
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   UpgradeInstanceRequest request =
    *       UpgradeInstanceRequest.newBuilder()
@@ -1036,6 +1096,8 @@ public final UnaryCallable upgradeInstanceCal
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   String name = "name3373707";
    *   InputConfig inputConfig = InputConfig.newBuilder().build();
@@ -1069,6 +1131,8 @@ public final OperationFuture importInstanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   ImportInstanceRequest request =
    *       ImportInstanceRequest.newBuilder()
@@ -1099,6 +1163,8 @@ public final OperationFuture importInstanceAsync(ImportInstanceRe
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   ImportInstanceRequest request =
    *       ImportInstanceRequest.newBuilder()
@@ -1130,6 +1196,8 @@ public final OperationFuture importInstanceAsync(ImportInstanceRe
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   ImportInstanceRequest request =
    *       ImportInstanceRequest.newBuilder()
@@ -1158,6 +1226,8 @@ public final UnaryCallable importInstanceCalla
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   String name = "name3373707";
    *   OutputConfig outputConfig = OutputConfig.newBuilder().build();
@@ -1190,6 +1260,8 @@ public final OperationFuture exportInstanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   ExportInstanceRequest request =
    *       ExportInstanceRequest.newBuilder()
@@ -1219,6 +1291,8 @@ public final OperationFuture exportInstanceAsync(ExportInstanceRe
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   ExportInstanceRequest request =
    *       ExportInstanceRequest.newBuilder()
@@ -1249,6 +1323,8 @@ public final OperationFuture exportInstanceAsync(ExportInstanceRe
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   ExportInstanceRequest request =
    *       ExportInstanceRequest.newBuilder()
@@ -1273,6 +1349,8 @@ public final UnaryCallable exportInstanceCalla
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
    *   FailoverInstanceRequest.DataProtectionMode dataProtectionMode =
@@ -1306,6 +1384,8 @@ public final OperationFuture failoverInstanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
    *   FailoverInstanceRequest.DataProtectionMode dataProtectionMode =
@@ -1339,6 +1419,8 @@ public final OperationFuture failoverInstanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   FailoverInstanceRequest request =
    *       FailoverInstanceRequest.newBuilder()
@@ -1364,6 +1446,8 @@ public final OperationFuture failoverInstanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   FailoverInstanceRequest request =
    *       FailoverInstanceRequest.newBuilder()
@@ -1389,6 +1473,8 @@ public final OperationFuture failoverInstanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   FailoverInstanceRequest request =
    *       FailoverInstanceRequest.newBuilder()
@@ -1411,6 +1497,8 @@ public final UnaryCallable failoverInstanceC
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
    *   cloudRedisClient.deleteInstanceAsync(name).get();
@@ -1435,6 +1523,8 @@ public final OperationFuture deleteInstanceAsync(InstanceName name)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
    *   cloudRedisClient.deleteInstanceAsync(name).get();
@@ -1458,6 +1548,8 @@ public final OperationFuture deleteInstanceAsync(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   DeleteInstanceRequest request =
    *       DeleteInstanceRequest.newBuilder()
@@ -1481,6 +1573,8 @@ public final OperationFuture deleteInstanceAsync(DeleteInstanceReque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   DeleteInstanceRequest request =
    *       DeleteInstanceRequest.newBuilder()
@@ -1505,6 +1599,8 @@ public final OperationFuture deleteInstanceAsync(DeleteInstanceReque
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   DeleteInstanceRequest request =
    *       DeleteInstanceRequest.newBuilder()
@@ -1527,6 +1623,8 @@ public final UnaryCallable deleteInstanceCalla
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
    *   RescheduleMaintenanceRequest.RescheduleType rescheduleType =
@@ -1566,6 +1664,8 @@ public final OperationFuture rescheduleMaintenanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
    *   RescheduleMaintenanceRequest.RescheduleType rescheduleType =
@@ -1605,6 +1705,8 @@ public final OperationFuture rescheduleMaintenanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   RescheduleMaintenanceRequest request =
    *       RescheduleMaintenanceRequest.newBuilder()
@@ -1630,6 +1732,8 @@ public final OperationFuture rescheduleMaintenanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   RescheduleMaintenanceRequest request =
    *       RescheduleMaintenanceRequest.newBuilder()
@@ -1655,6 +1759,8 @@ public final OperationFuture rescheduleMaintenanceAsync(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   RescheduleMaintenanceRequest request =
    *       RescheduleMaintenanceRequest.newBuilder()
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 07b8a88495..fc98568148 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,6 +57,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * CloudRedisSettings.Builder cloudRedisSettingsBuilder = CloudRedisSettings.newBuilder();
  * cloudRedisSettingsBuilder
  *     .getInstanceSettings()
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 2e50fe5c8e..9b934c1ddd 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
@@ -45,6 +45,8 @@
  * 

Sample for CloudRedisClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * 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 47b3185610..05ce9661a9 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
@@ -88,6 +88,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * CloudRedisStubSettings.Builder cloudRedisSettingsBuilder = CloudRedisStubSettings.newBuilder();
  * cloudRedisSettingsBuilder
  *     .getInstanceSettings()
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 730ab88f39..7ac3053780 100644
--- a/test/integration/goldens/storage/com/google/storage/v2/StorageClient.java
+++ b/test/integration/goldens/storage/com/google/storage/v2/StorageClient.java
@@ -65,6 +65,8 @@
  * calls that map to API methods. Sample code to get started:
  *
  * 
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (StorageClient storageClient = StorageClient.create()) {
  *   BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
  *   storageClient.deleteBucket(name);
@@ -100,6 +102,8 @@
  * 

To customize credentials: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * StorageSettings storageSettings =
  *     StorageSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
@@ -110,6 +114,8 @@
  * 

To customize the endpoint: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * StorageSettings storageSettings = StorageSettings.newBuilder().setEndpoint(myEndpoint).build();
  * StorageClient storageClient = StorageClient.create(storageSettings);
  * }
@@ -174,6 +180,8 @@ public StorageStub getStub() { *

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
    *   storageClient.deleteBucket(name);
@@ -196,6 +204,8 @@ public final void deleteBucket(BucketName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String name = BucketName.of("[PROJECT]", "[BUCKET]").toString();
    *   storageClient.deleteBucket(name);
@@ -217,6 +227,8 @@ public final void deleteBucket(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   DeleteBucketRequest request =
    *       DeleteBucketRequest.newBuilder()
@@ -243,6 +255,8 @@ public final void deleteBucket(DeleteBucketRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   DeleteBucketRequest request =
    *       DeleteBucketRequest.newBuilder()
@@ -268,6 +282,8 @@ public final UnaryCallable deleteBucketCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
    *   Bucket response = storageClient.getBucket(name);
@@ -290,6 +306,8 @@ public final Bucket getBucket(BucketName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String name = BucketName.of("[PROJECT]", "[BUCKET]").toString();
    *   Bucket response = storageClient.getBucket(name);
@@ -311,6 +329,8 @@ public final Bucket getBucket(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetBucketRequest request =
    *       GetBucketRequest.newBuilder()
@@ -338,6 +358,8 @@ public final Bucket getBucket(GetBucketRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetBucketRequest request =
    *       GetBucketRequest.newBuilder()
@@ -364,6 +386,8 @@ public final UnaryCallable getBucketCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   Bucket bucket = Bucket.newBuilder().build();
@@ -397,6 +421,8 @@ public final Bucket createBucket(ProjectName parent, Bucket bucket, String bucke
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   Bucket bucket = Bucket.newBuilder().build();
@@ -430,6 +456,8 @@ public final Bucket createBucket(String parent, Bucket bucket, String bucketId)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   CreateBucketRequest request =
    *       CreateBucketRequest.newBuilder()
@@ -457,6 +485,8 @@ public final Bucket createBucket(CreateBucketRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   CreateBucketRequest request =
    *       CreateBucketRequest.newBuilder()
@@ -483,6 +513,8 @@ public final UnaryCallable createBucketCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   for (Bucket element : storageClient.listBuckets(parent).iterateAll()) {
@@ -509,6 +541,8 @@ public final ListBucketsPagedResponse listBuckets(ProjectName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   for (Bucket element : storageClient.listBuckets(parent).iterateAll()) {
@@ -532,6 +566,8 @@ public final ListBucketsPagedResponse listBuckets(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListBucketsRequest request =
    *       ListBucketsRequest.newBuilder()
@@ -562,6 +598,8 @@ public final ListBucketsPagedResponse listBuckets(ListBucketsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListBucketsRequest request =
    *       ListBucketsRequest.newBuilder()
@@ -592,6 +630,8 @@ public final ListBucketsPagedResponse listBuckets(ListBucketsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListBucketsRequest request =
    *       ListBucketsRequest.newBuilder()
@@ -628,6 +668,8 @@ public final UnaryCallable listBucketsC
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   BucketName bucket = BucketName.of("[PROJECT]", "[BUCKET]");
    *   Bucket response = storageClient.lockBucketRetentionPolicy(bucket);
@@ -652,6 +694,8 @@ public final Bucket lockBucketRetentionPolicy(BucketName bucket) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String bucket = BucketName.of("[PROJECT]", "[BUCKET]").toString();
    *   Bucket response = storageClient.lockBucketRetentionPolicy(bucket);
@@ -674,6 +718,8 @@ public final Bucket lockBucketRetentionPolicy(String bucket) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   LockBucketRetentionPolicyRequest request =
    *       LockBucketRetentionPolicyRequest.newBuilder()
@@ -699,6 +745,8 @@ public final Bucket lockBucketRetentionPolicy(LockBucketRetentionPolicyRequest r
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   LockBucketRetentionPolicyRequest request =
    *       LockBucketRetentionPolicyRequest.newBuilder()
@@ -725,6 +773,8 @@ public final Bucket lockBucketRetentionPolicy(LockBucketRetentionPolicyRequest r
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ResourceName resource =
    *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
@@ -751,6 +801,8 @@ public final Policy getIamPolicy(ResourceName resource) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String resource =
    *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
@@ -774,6 +826,8 @@ public final Policy getIamPolicy(String resource) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetIamPolicyRequest request =
    *       GetIamPolicyRequest.newBuilder()
@@ -800,6 +854,8 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetIamPolicyRequest request =
    *       GetIamPolicyRequest.newBuilder()
@@ -825,6 +881,8 @@ public final UnaryCallable getIamPolicyCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ResourceName resource =
    *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
@@ -856,6 +914,8 @@ public final Policy setIamPolicy(ResourceName resource, Policy policy) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String resource =
    *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
@@ -884,6 +944,8 @@ public final Policy setIamPolicy(String resource, Policy policy) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   SetIamPolicyRequest request =
    *       SetIamPolicyRequest.newBuilder()
@@ -910,6 +972,8 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   SetIamPolicyRequest request =
    *       SetIamPolicyRequest.newBuilder()
@@ -935,6 +999,8 @@ public final UnaryCallable setIamPolicyCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ResourceName resource =
    *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
@@ -967,6 +1033,8 @@ public final TestIamPermissionsResponse testIamPermissions(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String resource =
    *       CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
@@ -999,6 +1067,8 @@ public final TestIamPermissionsResponse testIamPermissions(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   TestIamPermissionsRequest request =
    *       TestIamPermissionsRequest.newBuilder()
@@ -1025,6 +1095,8 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   TestIamPermissionsRequest request =
    *       TestIamPermissionsRequest.newBuilder()
@@ -1052,6 +1124,8 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   Bucket bucket = Bucket.newBuilder().build();
    *   FieldMask updateMask = FieldMask.newBuilder().build();
@@ -1083,6 +1157,8 @@ public final Bucket updateBucket(Bucket bucket, FieldMask updateMask) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   UpdateBucketRequest request =
    *       UpdateBucketRequest.newBuilder()
@@ -1112,6 +1188,8 @@ public final Bucket updateBucket(UpdateBucketRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   UpdateBucketRequest request =
    *       UpdateBucketRequest.newBuilder()
@@ -1140,6 +1218,8 @@ public final UnaryCallable updateBucketCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   NotificationName name = NotificationName.of("[PROJECT]", "[BUCKET]", "[NOTIFICATION]");
    *   storageClient.deleteNotification(name);
@@ -1164,6 +1244,8 @@ public final void deleteNotification(NotificationName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String name = NotificationName.of("[PROJECT]", "[BUCKET]", "[NOTIFICATION]").toString();
    *   storageClient.deleteNotification(name);
@@ -1186,6 +1268,8 @@ public final void deleteNotification(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   DeleteNotificationRequest request =
    *       DeleteNotificationRequest.newBuilder()
@@ -1209,6 +1293,8 @@ public final void deleteNotification(DeleteNotificationRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   DeleteNotificationRequest request =
    *       DeleteNotificationRequest.newBuilder()
@@ -1231,6 +1317,8 @@ public final UnaryCallable deleteNotificationC
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
    *   Notification response = storageClient.getNotification(name);
@@ -1254,6 +1342,8 @@ public final Notification getNotification(BucketName name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String name = BucketName.of("[PROJECT]", "[BUCKET]").toString();
    *   Notification response = storageClient.getNotification(name);
@@ -1276,6 +1366,8 @@ public final Notification getNotification(String name) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetNotificationRequest request =
    *       GetNotificationRequest.newBuilder()
@@ -1299,6 +1391,8 @@ public final Notification getNotification(GetNotificationRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetNotificationRequest request =
    *       GetNotificationRequest.newBuilder()
@@ -1323,6 +1417,8 @@ public final UnaryCallable getNotification
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   Notification notification = Notification.newBuilder().build();
@@ -1352,6 +1448,8 @@ public final Notification createNotification(ProjectName parent, Notification no
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   Notification notification = Notification.newBuilder().build();
@@ -1381,6 +1479,8 @@ public final Notification createNotification(String parent, Notification notific
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   CreateNotificationRequest request =
    *       CreateNotificationRequest.newBuilder()
@@ -1407,6 +1507,8 @@ public final Notification createNotification(CreateNotificationRequest request)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   CreateNotificationRequest request =
    *       CreateNotificationRequest.newBuilder()
@@ -1431,6 +1533,8 @@ public final UnaryCallable createNotifi
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   for (Notification element : storageClient.listNotifications(parent).iterateAll()) {
@@ -1457,6 +1561,8 @@ public final ListNotificationsPagedResponse listNotifications(ProjectName parent
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   for (Notification element : storageClient.listNotifications(parent).iterateAll()) {
@@ -1481,6 +1587,8 @@ public final ListNotificationsPagedResponse listNotifications(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListNotificationsRequest request =
    *       ListNotificationsRequest.newBuilder()
@@ -1508,6 +1616,8 @@ public final ListNotificationsPagedResponse listNotifications(ListNotificationsR
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListNotificationsRequest request =
    *       ListNotificationsRequest.newBuilder()
@@ -1536,6 +1646,8 @@ public final ListNotificationsPagedResponse listNotifications(ListNotificationsR
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListNotificationsRequest request =
    *       ListNotificationsRequest.newBuilder()
@@ -1571,6 +1683,8 @@ public final ListNotificationsPagedResponse listNotifications(ListNotificationsR
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ComposeObjectRequest request =
    *       ComposeObjectRequest.newBuilder()
@@ -1603,6 +1717,8 @@ public final Object composeObject(ComposeObjectRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ComposeObjectRequest request =
    *       ComposeObjectRequest.newBuilder()
@@ -1635,6 +1751,8 @@ public final UnaryCallable composeObjectCallable()
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String bucket = "bucket-1378203158";
    *   String object = "object-1023368385";
@@ -1660,6 +1778,8 @@ public final void deleteObject(String bucket, String object) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String bucket = "bucket-1378203158";
    *   String object = "object-1023368385";
@@ -1692,6 +1812,8 @@ public final void deleteObject(String bucket, String object, long generation) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   DeleteObjectRequest request =
    *       DeleteObjectRequest.newBuilder()
@@ -1725,6 +1847,8 @@ public final void deleteObject(DeleteObjectRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   DeleteObjectRequest request =
    *       DeleteObjectRequest.newBuilder()
@@ -1756,6 +1880,8 @@ public final UnaryCallable deleteObjectCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String bucket = "bucket-1378203158";
    *   String object = "object-1023368385";
@@ -1780,6 +1906,8 @@ public final Object getObject(String bucket, String object) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String bucket = "bucket-1378203158";
    *   String object = "object-1023368385";
@@ -1811,6 +1939,8 @@ public final Object getObject(String bucket, String object, long generation) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetObjectRequest request =
    *       GetObjectRequest.newBuilder()
@@ -1843,6 +1973,8 @@ public final Object getObject(GetObjectRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetObjectRequest request =
    *       GetObjectRequest.newBuilder()
@@ -1874,6 +2006,8 @@ public final UnaryCallable getObjectCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ReadObjectRequest request =
    *       ReadObjectRequest.newBuilder()
@@ -1908,6 +2042,8 @@ public final ServerStreamingCallable read
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   Object object = Object.newBuilder().build();
    *   FieldMask updateMask = FieldMask.newBuilder().build();
@@ -1941,6 +2077,8 @@ public final Object updateObject(Object object, FieldMask updateMask) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   UpdateObjectRequest request =
    *       UpdateObjectRequest.newBuilder()
@@ -1972,6 +2110,8 @@ public final Object updateObject(UpdateObjectRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   UpdateObjectRequest request =
    *       UpdateObjectRequest.newBuilder()
@@ -2021,6 +2161,8 @@ public final UnaryCallable updateObjectCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ApiStreamObserver responseObserver =
    *       new ApiStreamObserver() {
@@ -2065,6 +2207,8 @@ public final UnaryCallable updateObjectCallable() {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   for (Object element : storageClient.listObjects(parent).iterateAll()) {
@@ -2091,6 +2235,8 @@ public final ListObjectsPagedResponse listObjects(ProjectName parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String parent = ProjectName.of("[PROJECT]").toString();
    *   for (Object element : storageClient.listObjects(parent).iterateAll()) {
@@ -2114,6 +2260,8 @@ public final ListObjectsPagedResponse listObjects(String parent) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListObjectsRequest request =
    *       ListObjectsRequest.newBuilder()
@@ -2149,6 +2297,8 @@ public final ListObjectsPagedResponse listObjects(ListObjectsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListObjectsRequest request =
    *       ListObjectsRequest.newBuilder()
@@ -2184,6 +2334,8 @@ public final ListObjectsPagedResponse listObjects(ListObjectsRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListObjectsRequest request =
    *       ListObjectsRequest.newBuilder()
@@ -2225,6 +2377,8 @@ public final UnaryCallable listObjectsC
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   RewriteObjectRequest request =
    *       RewriteObjectRequest.newBuilder()
@@ -2272,6 +2426,8 @@ public final RewriteResponse rewriteObject(RewriteObjectRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   RewriteObjectRequest request =
    *       RewriteObjectRequest.newBuilder()
@@ -2319,6 +2475,8 @@ public final UnaryCallable rewriteObjectC
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   StartResumableWriteRequest request =
    *       StartResumableWriteRequest.newBuilder()
@@ -2345,6 +2503,8 @@ public final StartResumableWriteResponse startResumableWrite(StartResumableWrite
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   StartResumableWriteRequest request =
    *       StartResumableWriteRequest.newBuilder()
@@ -2381,6 +2541,8 @@ public final StartResumableWriteResponse startResumableWrite(StartResumableWrite
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String uploadId = "uploadId1563990780";
    *   QueryWriteStatusResponse response = storageClient.queryWriteStatus(uploadId);
@@ -2414,6 +2576,8 @@ public final QueryWriteStatusResponse queryWriteStatus(String uploadId) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   QueryWriteStatusRequest request =
    *       QueryWriteStatusRequest.newBuilder()
@@ -2449,6 +2613,8 @@ public final QueryWriteStatusResponse queryWriteStatus(QueryWriteStatusRequest r
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   QueryWriteStatusRequest request =
    *       QueryWriteStatusRequest.newBuilder()
@@ -2475,6 +2641,8 @@ public final QueryWriteStatusResponse queryWriteStatus(QueryWriteStatusRequest r
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ProjectName project = ProjectName.of("[PROJECT]");
    *   ServiceAccount response = storageClient.getServiceAccount(project);
@@ -2499,6 +2667,8 @@ public final ServiceAccount getServiceAccount(ProjectName project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String project = ProjectName.of("[PROJECT]").toString();
    *   ServiceAccount response = storageClient.getServiceAccount(project);
@@ -2521,6 +2691,8 @@ public final ServiceAccount getServiceAccount(String project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetServiceAccountRequest request =
    *       GetServiceAccountRequest.newBuilder()
@@ -2545,6 +2717,8 @@ public final ServiceAccount getServiceAccount(GetServiceAccountRequest request)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetServiceAccountRequest request =
    *       GetServiceAccountRequest.newBuilder()
@@ -2569,6 +2743,8 @@ public final UnaryCallable getServiceA
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ProjectName project = ProjectName.of("[PROJECT]");
    *   String serviceAccountEmail = "serviceAccountEmail1825953988";
@@ -2597,6 +2773,8 @@ public final CreateHmacKeyResponse createHmacKey(
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String project = ProjectName.of("[PROJECT]").toString();
    *   String serviceAccountEmail = "serviceAccountEmail1825953988";
@@ -2624,6 +2802,8 @@ public final CreateHmacKeyResponse createHmacKey(String project, String serviceA
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   CreateHmacKeyRequest request =
    *       CreateHmacKeyRequest.newBuilder()
@@ -2649,6 +2829,8 @@ public final CreateHmacKeyResponse createHmacKey(CreateHmacKeyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   CreateHmacKeyRequest request =
    *       CreateHmacKeyRequest.newBuilder()
@@ -2674,6 +2856,8 @@ public final UnaryCallable createHm
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String accessId = "accessId-2146437729";
    *   ProjectName project = ProjectName.of("[PROJECT]");
@@ -2701,6 +2885,8 @@ public final void deleteHmacKey(String accessId, ProjectName project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String accessId = "accessId-2146437729";
    *   String project = ProjectName.of("[PROJECT]").toString();
@@ -2725,6 +2911,8 @@ public final void deleteHmacKey(String accessId, String project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   DeleteHmacKeyRequest request =
    *       DeleteHmacKeyRequest.newBuilder()
@@ -2750,6 +2938,8 @@ public final void deleteHmacKey(DeleteHmacKeyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   DeleteHmacKeyRequest request =
    *       DeleteHmacKeyRequest.newBuilder()
@@ -2774,6 +2964,8 @@ public final UnaryCallable deleteHmacKeyCallable()
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String accessId = "accessId-2146437729";
    *   ProjectName project = ProjectName.of("[PROJECT]");
@@ -2801,6 +2993,8 @@ public final HmacKeyMetadata getHmacKey(String accessId, ProjectName project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String accessId = "accessId-2146437729";
    *   String project = ProjectName.of("[PROJECT]").toString();
@@ -2825,6 +3019,8 @@ public final HmacKeyMetadata getHmacKey(String accessId, String project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetHmacKeyRequest request =
    *       GetHmacKeyRequest.newBuilder()
@@ -2850,6 +3046,8 @@ public final HmacKeyMetadata getHmacKey(GetHmacKeyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   GetHmacKeyRequest request =
    *       GetHmacKeyRequest.newBuilder()
@@ -2874,6 +3072,8 @@ public final UnaryCallable getHmacKeyCallabl
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ProjectName project = ProjectName.of("[PROJECT]");
    *   for (HmacKeyMetadata element : storageClient.listHmacKeys(project).iterateAll()) {
@@ -2900,6 +3100,8 @@ public final ListHmacKeysPagedResponse listHmacKeys(ProjectName project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   String project = ProjectName.of("[PROJECT]").toString();
    *   for (HmacKeyMetadata element : storageClient.listHmacKeys(project).iterateAll()) {
@@ -2923,6 +3125,8 @@ public final ListHmacKeysPagedResponse listHmacKeys(String project) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListHmacKeysRequest request =
    *       ListHmacKeysRequest.newBuilder()
@@ -2953,6 +3157,8 @@ public final ListHmacKeysPagedResponse listHmacKeys(ListHmacKeysRequest request)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListHmacKeysRequest request =
    *       ListHmacKeysRequest.newBuilder()
@@ -2984,6 +3190,8 @@ public final ListHmacKeysPagedResponse listHmacKeys(ListHmacKeysRequest request)
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   ListHmacKeysRequest request =
    *       ListHmacKeysRequest.newBuilder()
@@ -3020,6 +3228,8 @@ public final UnaryCallable listHmacKe
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   HmacKeyMetadata hmacKey = HmacKeyMetadata.newBuilder().build();
    *   FieldMask updateMask = FieldMask.newBuilder().build();
@@ -3046,6 +3256,8 @@ public final HmacKeyMetadata updateHmacKey(HmacKeyMetadata hmacKey, FieldMask up
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   UpdateHmacKeyRequest request =
    *       UpdateHmacKeyRequest.newBuilder()
@@ -3071,6 +3283,8 @@ public final HmacKeyMetadata updateHmacKey(UpdateHmacKeyRequest request) {
    * 

Sample code: * *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
    * try (StorageClient storageClient = StorageClient.create()) {
    *   UpdateHmacKeyRequest request =
    *       UpdateHmacKeyRequest.newBuilder()
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 c1c35ab39b..63956a25a7 100644
--- a/test/integration/goldens/storage/com/google/storage/v2/StorageSettings.java
+++ b/test/integration/goldens/storage/com/google/storage/v2/StorageSettings.java
@@ -64,6 +64,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * StorageSettings.Builder storageSettingsBuilder = StorageSettings.newBuilder();
  * storageSettingsBuilder
  *     .deleteBucketSettings()
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 c9655f85d2..b303dd1e34 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
@@ -38,6 +38,8 @@
  * 

Sample for StorageClient: * *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * try (StorageClient storageClient = StorageClient.create()) {
  *   BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
  *   storageClient.deleteBucket(name);
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 25e85c92be..5e786e6bca 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
@@ -119,6 +119,8 @@
  * 

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

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
  * StorageStubSettings.Builder storageSettingsBuilder = StorageStubSettings.newBuilder();
  * storageSettingsBuilder
  *     .deleteBucketSettings()