public Request<AdminUpdateDeviceStatusRequest> marshall( AdminUpdateDeviceStatusRequest adminUpdateDeviceStatusRequest) { if (adminUpdateDeviceStatusRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<AdminUpdateDeviceStatusRequest> request = new DefaultRequest<AdminUpdateDeviceStatusRequest>( adminUpdateDeviceStatusRequest, "AWSCognitoIdentityProvider"); request.addHeader("X-Amz-Target", "AWSCognitoIdentityProviderService.AdminUpdateDeviceStatus"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (adminUpdateDeviceStatusRequest.getUserPoolId() != null) { jsonGenerator .writeFieldName("UserPoolId") .writeValue(adminUpdateDeviceStatusRequest.getUserPoolId()); } if (adminUpdateDeviceStatusRequest.getUsername() != null) { jsonGenerator .writeFieldName("Username") .writeValue(adminUpdateDeviceStatusRequest.getUsername()); } if (adminUpdateDeviceStatusRequest.getDeviceKey() != null) { jsonGenerator .writeFieldName("DeviceKey") .writeValue(adminUpdateDeviceStatusRequest.getDeviceKey()); } if (adminUpdateDeviceStatusRequest.getDeviceRememberedStatus() != null) { jsonGenerator .writeFieldName("DeviceRememberedStatus") .writeValue(adminUpdateDeviceStatusRequest.getDeviceRememberedStatus()); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", protocolFactory.getContentType()); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<ListDevicesRequest> marshall(ListDevicesRequest listDevicesRequest) { if (listDevicesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<ListDevicesRequest> request = new DefaultRequest<ListDevicesRequest>(listDevicesRequest, "AWSCognitoIdentityProvider"); request.addHeader("X-Amz-Target", "AWSCognitoIdentityProviderService.ListDevices"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (listDevicesRequest.getAccessToken() != null) { jsonGenerator.writeFieldName("AccessToken").writeValue(listDevicesRequest.getAccessToken()); } if (listDevicesRequest.getLimit() != null) { jsonGenerator.writeFieldName("Limit").writeValue(listDevicesRequest.getLimit()); } if (listDevicesRequest.getPaginationToken() != null) { jsonGenerator .writeFieldName("PaginationToken") .writeValue(listDevicesRequest.getPaginationToken()); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", protocolFactory.getContentType()); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }