1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 package com.amazonaws.util.awsclientgenerator.domainmodels.codegeneration; 7 8 import lombok.AccessLevel; 9 import lombok.Data; 10 import lombok.Getter; 11 import lombok.Setter; 12 13 import java.util.*; 14 import java.util.stream.Collectors; 15 16 @Data 17 public class ServiceModel { 18 String version; 19 String runtimeMajorVersion; 20 String runtimeMajorVersionUpperBound; 21 String runtimeMinorVersion; 22 String namespace; 23 String serviceName; 24 Metadata metadata; 25 String documentation; 26 String licenseText; 27 Map<String, Shape> shapes; 28 Map<String, Operation> operations; 29 boolean enableVirtualOperations; 30 Collection<Error> serviceErrors; 31 32 @Getter(AccessLevel.PRIVATE) 33 @Setter(AccessLevel.PRIVATE) 34 Set<String> inputShapes = new HashSet<>(); 35 36 @Getter(AccessLevel.PRIVATE) 37 @Setter(AccessLevel.PRIVATE) 38 Set<String> outputShapes = new HashSet<>(); 39 hasStreamingRequestShapes()40 public boolean hasStreamingRequestShapes() { 41 return shapes.values().parallelStream().anyMatch(shape -> shape.isRequest() && (shape.hasStreamMembers() || shape.hasEventStreamMembers())); 42 } 43 getNonCoreServiceErrors()44 public Collection<Error> getNonCoreServiceErrors() { 45 return serviceErrors.stream().filter(e -> !e.isCoreError()).collect(Collectors.toSet()); 46 } 47 } 48