1 package software.amazon.smithy.aws.go.codegen;
2 
3 import java.util.List;
4 import software.amazon.smithy.go.codegen.integration.GoIntegration;
5 import software.amazon.smithy.go.codegen.integration.HttpProtocolUtils;
6 import software.amazon.smithy.go.codegen.integration.ProtocolGenerator;
7 import software.amazon.smithy.go.codegen.integration.RuntimeClientPlugin;
8 import software.amazon.smithy.utils.ListUtils;
9 
10 public class AddProtocols implements GoIntegration {
11     /**
12      * Gets the sort order of the customization from -128 to 127, with lowest
13      * executed first.
14      *
15      * @return Returns the sort order, defaults to -10.
16      */
17     @Override
getOrder()18     public byte getOrder() {
19         return -10;
20     }
21 
22     @Override
getClientPlugins()23     public List<RuntimeClientPlugin> getClientPlugins() {
24         List<RuntimeClientPlugin> plugins = HttpProtocolUtils.getCloseResponseClientPlugins((model, service) -> {
25             // All AWS protocols are HTTP based currently. When protocol is added that is not it must be
26             // excluded if the service is configured for that protocol.
27             return true;
28         });
29 
30         return plugins;
31     }
32 
33     @Override
getProtocolGenerators()34     public List<ProtocolGenerator> getProtocolGenerators() {
35         return ListUtils.of(
36                 new AwsRestJson1(),
37                 new AwsJsonRpc1_0(),
38                 new AwsJsonRpc1_1(),
39                 new AwsRestXml(),
40                 new AwsQuery(),
41                 new Ec2Query()
42         );
43     }
44 }
45