public Request<GetExportRequest> marshall(GetExportRequest getExportRequest) { if (getExportRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<GetExportRequest> request = new DefaultRequest<GetExportRequest>(getExportRequest, "AmazonApiGateway"); request.setHttpMethod(HttpMethodName.GET); if (getExportRequest.getAccepts() != null) { request.addHeader("Accept", StringUtils.fromString(getExportRequest.getAccepts())); } String uriResourcePath = "/restapis/{restapi_id}/stages/{stage_name}/exports/{export_type}"; uriResourcePath = uriResourcePath.replace( "{restapi_id}", (getExportRequest.getRestApiId() != null) ? SdkHttpUtils.urlEncode( StringUtils.fromString(getExportRequest.getRestApiId()), false) : ""); uriResourcePath = uriResourcePath.replace( "{stage_name}", (getExportRequest.getStageName() != null) ? SdkHttpUtils.urlEncode( StringUtils.fromString(getExportRequest.getStageName()), false) : ""); uriResourcePath = uriResourcePath.replace( "{export_type}", (getExportRequest.getExportType() != null) ? SdkHttpUtils.urlEncode( StringUtils.fromString(getExportRequest.getExportType()), false) : ""); request.setResourcePath(uriResourcePath); java.util.Map<String, String> parameters = getExportRequest.getParameters(); if (parameters != null) { for (Map.Entry<String, String> entry : parameters.entrySet()) { if (entry.getValue() != null) { request.addParameter( StringUtils.fromString(entry.getKey()), StringUtils.fromString(entry.getValue())); } } } request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE); } return request; }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(AccountSettings accountSettings, StructuredJsonGenerator jsonGenerator) { if (accountSettings == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (accountSettings.getAwsAccountNumber() != null) { jsonGenerator .writeFieldName("awsAccountNumber") .writeValue(accountSettings.getAwsAccountNumber()); } java.util.Map<String, Integer> unmeteredDevicesMap = accountSettings.getUnmeteredDevices(); if (unmeteredDevicesMap != null) { jsonGenerator.writeFieldName("unmeteredDevices"); jsonGenerator.writeStartObject(); for (Map.Entry<String, Integer> unmeteredDevicesMapValue : unmeteredDevicesMap.entrySet()) { if (unmeteredDevicesMapValue.getValue() != null) { jsonGenerator.writeFieldName(unmeteredDevicesMapValue.getKey()); jsonGenerator.writeValue(unmeteredDevicesMapValue.getValue()); } } jsonGenerator.writeEndObject(); } java.util.Map<String, Integer> unmeteredRemoteAccessDevicesMap = accountSettings.getUnmeteredRemoteAccessDevices(); if (unmeteredRemoteAccessDevicesMap != null) { jsonGenerator.writeFieldName("unmeteredRemoteAccessDevices"); jsonGenerator.writeStartObject(); for (Map.Entry<String, Integer> unmeteredRemoteAccessDevicesMapValue : unmeteredRemoteAccessDevicesMap.entrySet()) { if (unmeteredRemoteAccessDevicesMapValue.getValue() != null) { jsonGenerator.writeFieldName(unmeteredRemoteAccessDevicesMapValue.getKey()); jsonGenerator.writeValue(unmeteredRemoteAccessDevicesMapValue.getValue()); } } jsonGenerator.writeEndObject(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(ScheduleRunTest scheduleRunTest, StructuredJsonGenerator jsonGenerator) { if (scheduleRunTest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (scheduleRunTest.getType() != null) { jsonGenerator.writeFieldName("type").writeValue(scheduleRunTest.getType()); } if (scheduleRunTest.getTestPackageArn() != null) { jsonGenerator .writeFieldName("testPackageArn") .writeValue(scheduleRunTest.getTestPackageArn()); } if (scheduleRunTest.getFilter() != null) { jsonGenerator.writeFieldName("filter").writeValue(scheduleRunTest.getFilter()); } java.util.Map<String, String> parametersMap = scheduleRunTest.getParameters(); if (parametersMap != null) { jsonGenerator.writeFieldName("parameters"); jsonGenerator.writeStartObject(); for (Map.Entry<String, String> parametersMapValue : parametersMap.entrySet()) { if (parametersMapValue.getValue() != null) { jsonGenerator.writeFieldName(parametersMapValue.getKey()); jsonGenerator.writeValue(parametersMapValue.getValue()); } } jsonGenerator.writeEndObject(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(EventDetails eventDetails, StructuredJsonGenerator jsonGenerator) { if (eventDetails == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (eventDetails.getEvent() != null) { jsonGenerator.writeFieldName("event"); EventJsonMarshaller.getInstance().marshall(eventDetails.getEvent(), jsonGenerator); } if (eventDetails.getEventDescription() != null) { jsonGenerator.writeFieldName("eventDescription"); EventDescriptionJsonMarshaller.getInstance() .marshall(eventDetails.getEventDescription(), jsonGenerator); } java.util.Map<String, String> eventMetadataMap = eventDetails.getEventMetadata(); if (eventMetadataMap != null) { jsonGenerator.writeFieldName("eventMetadata"); jsonGenerator.writeStartObject(); for (Map.Entry<String, String> eventMetadataMapValue : eventMetadataMap.entrySet()) { if (eventMetadataMapValue.getValue() != null) { jsonGenerator.writeFieldName(eventMetadataMapValue.getKey()); jsonGenerator.writeValue(eventMetadataMapValue.getValue()); } } jsonGenerator.writeEndObject(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<UnlinkIdentityRequest> marshall(UnlinkIdentityRequest unlinkIdentityRequest) { if (unlinkIdentityRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<UnlinkIdentityRequest> request = new DefaultRequest<UnlinkIdentityRequest>(unlinkIdentityRequest, "AmazonCognitoIdentity"); request.addHeader("X-Amz-Target", "AWSCognitoIdentityService.UnlinkIdentity"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (unlinkIdentityRequest.getIdentityId() != null) { jsonGenerator .writeFieldName("IdentityId") .writeValue(unlinkIdentityRequest.getIdentityId()); } java.util.Map<String, String> loginsMap = unlinkIdentityRequest.getLogins(); if (loginsMap != null) { jsonGenerator.writeFieldName("Logins"); jsonGenerator.writeStartObject(); for (Map.Entry<String, String> loginsMapValue : loginsMap.entrySet()) { if (loginsMapValue.getValue() != null) { jsonGenerator.writeFieldName(loginsMapValue.getKey()); jsonGenerator.writeValue(loginsMapValue.getValue()); } } jsonGenerator.writeEndObject(); } java.util.List<String> loginsToRemoveList = unlinkIdentityRequest.getLoginsToRemove(); if (loginsToRemoveList != null) { jsonGenerator.writeFieldName("LoginsToRemove"); jsonGenerator.writeStartArray(); for (String loginsToRemoveListValue : loginsToRemoveList) { if (loginsToRemoveListValue != null) { jsonGenerator.writeValue(loginsToRemoveListValue); } } jsonGenerator.writeEndArray(); } 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<AdminInitiateAuthRequest> marshall( AdminInitiateAuthRequest adminInitiateAuthRequest) { if (adminInitiateAuthRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<AdminInitiateAuthRequest> request = new DefaultRequest<AdminInitiateAuthRequest>( adminInitiateAuthRequest, "AWSCognitoIdentityProvider"); request.addHeader("X-Amz-Target", "AWSCognitoIdentityProviderService.AdminInitiateAuth"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (adminInitiateAuthRequest.getUserPoolId() != null) { jsonGenerator .writeFieldName("UserPoolId") .writeValue(adminInitiateAuthRequest.getUserPoolId()); } if (adminInitiateAuthRequest.getClientId() != null) { jsonGenerator.writeFieldName("ClientId").writeValue(adminInitiateAuthRequest.getClientId()); } if (adminInitiateAuthRequest.getAuthFlow() != null) { jsonGenerator.writeFieldName("AuthFlow").writeValue(adminInitiateAuthRequest.getAuthFlow()); } java.util.Map<String, String> authParametersMap = adminInitiateAuthRequest.getAuthParameters(); if (authParametersMap != null) { jsonGenerator.writeFieldName("AuthParameters"); jsonGenerator.writeStartObject(); for (Map.Entry<String, String> authParametersMapValue : authParametersMap.entrySet()) { if (authParametersMapValue.getValue() != null) { jsonGenerator.writeFieldName(authParametersMapValue.getKey()); jsonGenerator.writeValue(authParametersMapValue.getValue()); } } jsonGenerator.writeEndObject(); } java.util.Map<String, String> clientMetadataMap = adminInitiateAuthRequest.getClientMetadata(); if (clientMetadataMap != null) { jsonGenerator.writeFieldName("ClientMetadata"); jsonGenerator.writeStartObject(); for (Map.Entry<String, String> clientMetadataMapValue : clientMetadataMap.entrySet()) { if (clientMetadataMapValue.getValue() != null) { jsonGenerator.writeFieldName(clientMetadataMapValue.getKey()); jsonGenerator.writeValue(clientMetadataMapValue.getValue()); } } jsonGenerator.writeEndObject(); } 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 AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( ElasticsearchDomainStatus elasticsearchDomainStatus, StructuredJsonGenerator jsonGenerator) { if (elasticsearchDomainStatus == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (elasticsearchDomainStatus.getDomainId() != null) { jsonGenerator .writeFieldName("DomainId") .writeValue(elasticsearchDomainStatus.getDomainId()); } if (elasticsearchDomainStatus.getDomainName() != null) { jsonGenerator .writeFieldName("DomainName") .writeValue(elasticsearchDomainStatus.getDomainName()); } if (elasticsearchDomainStatus.getARN() != null) { jsonGenerator.writeFieldName("ARN").writeValue(elasticsearchDomainStatus.getARN()); } if (elasticsearchDomainStatus.getCreated() != null) { jsonGenerator.writeFieldName("Created").writeValue(elasticsearchDomainStatus.getCreated()); } if (elasticsearchDomainStatus.getDeleted() != null) { jsonGenerator.writeFieldName("Deleted").writeValue(elasticsearchDomainStatus.getDeleted()); } if (elasticsearchDomainStatus.getEndpoint() != null) { jsonGenerator .writeFieldName("Endpoint") .writeValue(elasticsearchDomainStatus.getEndpoint()); } if (elasticsearchDomainStatus.getProcessing() != null) { jsonGenerator .writeFieldName("Processing") .writeValue(elasticsearchDomainStatus.getProcessing()); } if (elasticsearchDomainStatus.getElasticsearchVersion() != null) { jsonGenerator .writeFieldName("ElasticsearchVersion") .writeValue(elasticsearchDomainStatus.getElasticsearchVersion()); } if (elasticsearchDomainStatus.getElasticsearchClusterConfig() != null) { jsonGenerator.writeFieldName("ElasticsearchClusterConfig"); ElasticsearchClusterConfigJsonMarshaller.getInstance() .marshall(elasticsearchDomainStatus.getElasticsearchClusterConfig(), jsonGenerator); } if (elasticsearchDomainStatus.getEBSOptions() != null) { jsonGenerator.writeFieldName("EBSOptions"); EBSOptionsJsonMarshaller.getInstance() .marshall(elasticsearchDomainStatus.getEBSOptions(), jsonGenerator); } if (elasticsearchDomainStatus.getAccessPolicies() != null) { jsonGenerator .writeFieldName("AccessPolicies") .writeValue(elasticsearchDomainStatus.getAccessPolicies()); } if (elasticsearchDomainStatus.getSnapshotOptions() != null) { jsonGenerator.writeFieldName("SnapshotOptions"); SnapshotOptionsJsonMarshaller.getInstance() .marshall(elasticsearchDomainStatus.getSnapshotOptions(), jsonGenerator); } java.util.Map<String, String> advancedOptionsMap = elasticsearchDomainStatus.getAdvancedOptions(); if (advancedOptionsMap != null) { jsonGenerator.writeFieldName("AdvancedOptions"); jsonGenerator.writeStartObject(); for (Map.Entry<String, String> advancedOptionsMapValue : advancedOptionsMap.entrySet()) { if (advancedOptionsMapValue.getValue() != null) { jsonGenerator.writeFieldName(advancedOptionsMapValue.getKey()); jsonGenerator.writeValue(advancedOptionsMapValue.getValue()); } } jsonGenerator.writeEndObject(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }