3131import software .amazon .awssdk .core .protocol .MarshallLocation ;
3232import software .amazon .awssdk .core .protocol .MarshallingType ;
3333import software .amazon .awssdk .core .traits .LocationTrait ;
34+ import software .amazon .awssdk .core .traits .MapTrait ;
35+ import software .amazon .awssdk .core .util .DefaultSdkAutoConstructMap ;
36+ import software .amazon .awssdk .core .util .SdkAutoConstructMap ;
3437import software .amazon .awssdk .utils .ToString ;
3538import software .amazon .awssdk .utils .builder .CopyableBuilder ;
3639import software .amazon .awssdk .utils .builder .ToCopyableBuilder ;
@@ -52,8 +55,22 @@ public final class NestedOptions implements SdkPojo, Serializable, ToCopyableBui
5255 .memberName ("queryParam" ).getter (getter (NestedOptions ::queryParam )).setter (setter (Builder ::queryParam ))
5356 .traits (LocationTrait .builder ().location (MarshallLocation .PAYLOAD ).locationName ("nestedQuery" ).build ()).build ();
5457
58+ private static final SdkField <Map <String , String >> PREFIX_HEADERS_FIELD = SdkField
59+ .<Map <String , String >> builder (MarshallingType .MAP )
60+ .memberName ("prefixHeaders" )
61+ .getter (getter (NestedOptions ::prefixHeaders ))
62+ .setter (setter (Builder ::prefixHeaders ))
63+ .traits (LocationTrait .builder ().location (MarshallLocation .PAYLOAD ).locationName ("x-amz-prefix-" ).build (),
64+ MapTrait .builder ()
65+ .keyLocationName ("key" )
66+ .valueLocationName ("value" )
67+ .valueFieldInfo (
68+ SdkField .<String > builder (MarshallingType .STRING )
69+ .traits (LocationTrait .builder ().location (MarshallLocation .PAYLOAD )
70+ .locationName ("value" ).build ()).build ()).build ()).build ();
71+
5572 private static final List <SdkField <?>> SDK_FIELDS = Collections .unmodifiableList (Arrays .asList (PAGE_SIZE_FIELD ,
56- HEADER_PARAM_FIELD , QUERY_PARAM_FIELD ));
73+ HEADER_PARAM_FIELD , QUERY_PARAM_FIELD , PREFIX_HEADERS_FIELD ));
5774
5875 private static final Map <String , SdkField <?>> SDK_NAME_TO_FIELD = memberNameToFieldInitializer ();
5976
@@ -65,10 +82,13 @@ public final class NestedOptions implements SdkPojo, Serializable, ToCopyableBui
6582
6683 private final String queryParam ;
6784
85+ private final Map <String , String > prefixHeaders ;
86+
6887 private NestedOptions (BuilderImpl builder ) {
6988 this .pageSize = builder .pageSize ;
7089 this .headerParam = builder .headerParam ;
7190 this .queryParam = builder .queryParam ;
91+ this .prefixHeaders = builder .prefixHeaders ;
7292 }
7393
7494 /**
@@ -98,6 +118,34 @@ public final String queryParam() {
98118 return queryParam ;
99119 }
100120
121+ /**
122+ * For responses, this returns true if the service returned a value for the PrefixHeaders property. This DOES NOT
123+ * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
124+ * This is useful because the SDK will never return a null collection or map, but you may need to differentiate
125+ * between the service returning nothing (or null) and the service returning an empty collection or map. For
126+ * requests, this returns true if a value for the property was specified in the request builder, and false if a
127+ * value was not specified.
128+ */
129+ public final boolean hasPrefixHeaders () {
130+ return prefixHeaders != null && !(prefixHeaders instanceof SdkAutoConstructMap );
131+ }
132+
133+ /**
134+ * Returns the value of the PrefixHeaders property for this object.
135+ * <p>
136+ * Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
137+ * </p>
138+ * <p>
139+ * This method will never return null. If you would like to know whether the service returned this field (so that
140+ * you can differentiate between null and empty), you can use the {@link #hasPrefixHeaders} method.
141+ * </p>
142+ *
143+ * @return The value of the PrefixHeaders property for this object.
144+ */
145+ public final Map <String , String > prefixHeaders () {
146+ return prefixHeaders ;
147+ }
148+
101149 @ Override
102150 public Builder toBuilder () {
103151 return new BuilderImpl (this );
@@ -117,6 +165,7 @@ public final int hashCode() {
117165 hashCode = 31 * hashCode + Objects .hashCode (pageSize ());
118166 hashCode = 31 * hashCode + Objects .hashCode (headerParam ());
119167 hashCode = 31 * hashCode + Objects .hashCode (queryParam ());
168+ hashCode = 31 * hashCode + Objects .hashCode (hasPrefixHeaders () ? prefixHeaders () : null );
120169 return hashCode ;
121170 }
122171
@@ -138,7 +187,8 @@ public final boolean equalsBySdkFields(Object obj) {
138187 }
139188 NestedOptions other = (NestedOptions ) obj ;
140189 return Objects .equals (pageSize (), other .pageSize ()) && Objects .equals (headerParam (), other .headerParam ())
141- && Objects .equals (queryParam (), other .queryParam ());
190+ && Objects .equals (queryParam (), other .queryParam ()) && hasPrefixHeaders () == other .hasPrefixHeaders ()
191+ && Objects .equals (prefixHeaders (), other .prefixHeaders ());
142192 }
143193
144194 /**
@@ -148,7 +198,7 @@ public final boolean equalsBySdkFields(Object obj) {
148198 @ Override
149199 public final String toString () {
150200 return ToString .builder ("NestedOptions" ).add ("PageSize" , pageSize ()).add ("HeaderParam" , headerParam ())
151- .add ("QueryParam" , queryParam ()).build ();
201+ .add ("QueryParam" , queryParam ()).add ( "PrefixHeaders" , hasPrefixHeaders () ? prefixHeaders () : null ). build ();
152202 }
153203
154204 public final <T > Optional <T > getValueForField (String fieldName , Class <T > clazz ) {
@@ -159,6 +209,8 @@ public final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz)
159209 return Optional .ofNullable (clazz .cast (headerParam ()));
160210 case "queryParam" :
161211 return Optional .ofNullable (clazz .cast (queryParam ()));
212+ case "prefixHeaders" :
213+ return Optional .ofNullable (clazz .cast (prefixHeaders ()));
162214 default :
163215 return Optional .empty ();
164216 }
@@ -179,6 +231,7 @@ private static Map<String, SdkField<?>> memberNameToFieldInitializer() {
179231 map .put ("pageSize" , PAGE_SIZE_FIELD );
180232 map .put ("x-amz-nested-header" , HEADER_PARAM_FIELD );
181233 map .put ("nestedQuery" , QUERY_PARAM_FIELD );
234+ map .put ("x-amz-prefix-" , PREFIX_HEADERS_FIELD );
182235 return Collections .unmodifiableMap (map );
183236 }
184237
@@ -219,6 +272,15 @@ public interface Builder extends SdkPojo, CopyableBuilder<Builder, NestedOptions
219272 * @return Returns a reference to this object so that method calls can be chained together.
220273 */
221274 Builder queryParam (String queryParam );
275+
276+ /**
277+ * Sets the value of the PrefixHeaders property for this object.
278+ *
279+ * @param prefixHeaders
280+ * The new value for the PrefixHeaders property for this object.
281+ * @return Returns a reference to this object so that method calls can be chained together.
282+ */
283+ Builder prefixHeaders (Map <String , String > prefixHeaders );
222284 }
223285
224286 static final class BuilderImpl implements Builder {
@@ -228,13 +290,16 @@ static final class BuilderImpl implements Builder {
228290
229291 private String queryParam ;
230292
293+ private Map <String , String > prefixHeaders = DefaultSdkAutoConstructMap .getInstance ();
294+
231295 private BuilderImpl () {
232296 }
233297
234298 private BuilderImpl (NestedOptions model ) {
235299 pageSize (model .pageSize );
236300 headerParam (model .headerParam );
237301 queryParam (model .queryParam );
302+ prefixHeaders (model .prefixHeaders );
238303 }
239304
240305 public final String getPageSize () {
@@ -279,6 +344,23 @@ public final Builder queryParam(String queryParam) {
279344 return this ;
280345 }
281346
347+ public final Map <String , String > getPrefixHeaders () {
348+ if (prefixHeaders instanceof SdkAutoConstructMap ) {
349+ return null ;
350+ }
351+ return prefixHeaders ;
352+ }
353+
354+ public final void setPrefixHeaders (Map <String , String > prefixHeaders ) {
355+ this .prefixHeaders = MapOfStringsCopier .copy (prefixHeaders );
356+ }
357+
358+ @ Override
359+ public final Builder prefixHeaders (Map <String , String > prefixHeaders ) {
360+ this .prefixHeaders = MapOfStringsCopier .copy (prefixHeaders );
361+ return this ;
362+ }
363+
282364 @ Override
283365 public NestedOptions build () {
284366 return new NestedOptions (this );
0 commit comments