Refine search
@Override public String convert(Integer val) { return StringUtils.fromInteger(val); } };
/** * <p> Asserts that the specified parameter value is neither <code>empty</code> nor null, and if * it is, throws a <code>SdkClientException</code> with the specified error message. </p> * * @param parameterValue The parameter value being checked. * @param errorMessage The error message to include in the SdkClientException if the * specified parameter value is empty. */ private void assertParameterNotEmpty(String parameterValue, String errorMessage) { if (StringUtils.isNullOrEmpty(parameterValue)) { throw new SdkClientException(errorMessage); } }
@Override public String convert(Boolean val) { return StringUtils.fromBoolean(val); } };
public Request<ReleaseHostsRequest> marshall(ReleaseHostsRequest releaseHostsRequest) { if (releaseHostsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<ReleaseHostsRequest> request = new DefaultRequest<ReleaseHostsRequest>(releaseHostsRequest, "AmazonEC2"); request.addParameter("Action", "ReleaseHosts"); request.addParameter("Version", "2016-11-15"); request.setHttpMethod(HttpMethodName.POST); com.amazonaws.internal.SdkInternalList<String> releaseHostsRequestHostIdsList = (com.amazonaws.internal.SdkInternalList<String>) releaseHostsRequest .getHostIds(); if (!releaseHostsRequestHostIdsList.isEmpty() || !releaseHostsRequestHostIdsList.isAutoConstruct()) { int hostIdsListIndex = 1; for (String releaseHostsRequestHostIdsListValue : releaseHostsRequestHostIdsList) { if (releaseHostsRequestHostIdsListValue != null) { request.addParameter("HostId." + hostIdsListIndex, StringUtils.fromString(releaseHostsRequestHostIdsListValue)); } hostIdsListIndex++; } } return request; }
public Request<DescribeBundleTasksRequest> marshall(DescribeBundleTasksRequest describeBundleTasksRequest) { throw new SdkClientException("Invalid argument passed to marshall(...)"); request.addParameter("Action", "DescribeBundleTasks"); request.addParameter("Version", "2016-11-15"); request.setHttpMethod(HttpMethodName.POST); if (!describeBundleTasksRequestBundleIdsList.isEmpty() || !describeBundleTasksRequestBundleIdsList.isAutoConstruct()) { int bundleIdsListIndex = 1; request.addParameter("BundleId." + bundleIdsListIndex, StringUtils.fromString(describeBundleTasksRequestBundleIdsListValue)); if (!describeBundleTasksRequestFiltersList.isEmpty() || !describeBundleTasksRequestFiltersList.isAutoConstruct()) { int filtersListIndex = 1; if (describeBundleTasksRequestFiltersListValue.getName() != null) { request.addParameter("Filter." + filtersListIndex + ".Name", StringUtils.fromString(describeBundleTasksRequestFiltersListValue.getName())); .getValues(); if (!filterValuesList.isEmpty() || !filterValuesList.isAutoConstruct()) { int valuesListIndex = 1; request.addParameter("Filter." + filtersListIndex + ".Value." + valuesListIndex, StringUtils.fromString(filterValuesListValue));
request.addParameter("DBClusterIdentifier", StringUtils.fromString(restoreDBClusterToPointInTimeRequest.getDBClusterIdentifier())); request.addParameter("RestoreType", StringUtils.fromString(restoreDBClusterToPointInTimeRequest.getRestoreType())); request.addParameter("SourceDBClusterIdentifier", StringUtils.fromString(restoreDBClusterToPointInTimeRequest.getSourceDBClusterIdentifier())); request.addParameter("RestoreToTime", StringUtils.fromDate(restoreDBClusterToPointInTimeRequest.getRestoreToTime())); request.addParameter("UseLatestRestorableTime", StringUtils.fromBoolean(restoreDBClusterToPointInTimeRequest.getUseLatestRestorableTime())); request.addParameter("Port", StringUtils.fromInteger(restoreDBClusterToPointInTimeRequest.getPort())); request.addParameter("DBSubnetGroupName", StringUtils.fromString(restoreDBClusterToPointInTimeRequest.getDBSubnetGroupName())); request.addParameter("OptionGroupName", StringUtils.fromString(restoreDBClusterToPointInTimeRequest.getOptionGroupName())); StringUtils.fromString(vpcSecurityGroupIdsListValue)); request.addParameter("Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.getKey())); request.addParameter("Tags.Tag." + tagsListIndex + ".Value", StringUtils.fromString(tagsListValue.getValue())); request.addParameter("KmsKeyId", StringUtils.fromString(restoreDBClusterToPointInTimeRequest.getKmsKeyId())); StringUtils.fromBoolean(restoreDBClusterToPointInTimeRequest.getEnableIAMDatabaseAuthentication())); request.addParameter("BacktrackWindow", StringUtils.fromLong(restoreDBClusterToPointInTimeRequest.getBacktrackWindow())); StringUtils.fromString(enableCloudwatchLogsExportsListValue));
public Request<CreateReservedInstancesListingRequest> marshall(CreateReservedInstancesListingRequest createReservedInstancesListingRequest) { throw new SdkClientException("Invalid argument passed to marshall(...)"); request.addParameter("Action", "CreateReservedInstancesListing"); request.addParameter("Version", "2016-11-15"); request.setHttpMethod(HttpMethodName.POST); request.addParameter("ClientToken", StringUtils.fromString(createReservedInstancesListingRequest.getClientToken())); request.addParameter("InstanceCount", StringUtils.fromInteger(createReservedInstancesListingRequest.getInstanceCount())); if (!createReservedInstancesListingRequestPriceSchedulesList.isEmpty() || !createReservedInstancesListingRequestPriceSchedulesList.isAutoConstruct()) { int priceSchedulesListIndex = 1; request.addParameter("PriceSchedules." + priceSchedulesListIndex + ".CurrencyCode", StringUtils.fromString(createReservedInstancesListingRequestPriceSchedulesListValue.getCurrencyCode())); request.addParameter("PriceSchedules." + priceSchedulesListIndex + ".Price", StringUtils.fromDouble(createReservedInstancesListingRequestPriceSchedulesListValue.getPrice())); request.addParameter("PriceSchedules." + priceSchedulesListIndex + ".Term", StringUtils.fromLong(createReservedInstancesListingRequestPriceSchedulesListValue.getTerm())); request.addParameter("ReservedInstancesId", StringUtils.fromString(createReservedInstancesListingRequest.getReservedInstancesId()));
public Request<DescribeDBLogFilesRequest> marshall(DescribeDBLogFilesRequest describeDBLogFilesRequest) { throw new SdkClientException("Invalid argument passed to marshall(...)"); request.addParameter("Action", "DescribeDBLogFiles"); request.addParameter("Version", "2014-10-31"); request.setHttpMethod(HttpMethodName.POST); request.addParameter("DBInstanceIdentifier", StringUtils.fromString(describeDBLogFilesRequest.getDBInstanceIdentifier())); request.addParameter("FilenameContains", StringUtils.fromString(describeDBLogFilesRequest.getFilenameContains())); request.addParameter("FileLastWritten", StringUtils.fromLong(describeDBLogFilesRequest.getFileLastWritten())); request.addParameter("FileSize", StringUtils.fromLong(describeDBLogFilesRequest.getFileSize())); || !((com.amazonaws.internal.SdkInternalList<Filter>) describeDBLogFilesRequest.getFilters()).isAutoConstruct()) { com.amazonaws.internal.SdkInternalList<Filter> filtersList = (com.amazonaws.internal.SdkInternalList<Filter>) describeDBLogFilesRequest .getFilters(); request.addParameter("Filters.Filter." + filtersListIndex + ".Name", StringUtils.fromString(filtersListValue.getName())); if (valuesListValue != null) { request.addParameter("Filters.Filter." + filtersListIndex + ".Values.Value." + valuesListIndex, StringUtils.fromString(valuesListValue)); request.addParameter("MaxRecords", StringUtils.fromInteger(describeDBLogFilesRequest.getMaxRecords())); request.addParameter("Marker", StringUtils.fromString(describeDBLogFilesRequest.getMarker()));
protected boolean shouldUseHttpsScheme(SignableRequest<?> request) throws SdkClientException { try { String protocol = StringUtils.lowerCase(request.getEndpoint().toURL().getProtocol()); if (protocol.equals("http")) { return false; } else if (protocol.equals("https")) { return true; } else { throw new SdkClientException("Unknown request endpoint protocol " + "encountered while signing request: " + protocol); } } catch (MalformedURLException e) { throw new SdkClientException("Unable to parse request endpoint during signing", e); } }
private static String uriFrom(Request<?> sdkRequest) { StringBuilder uriBuilder = new StringBuilder(sdkRequest.getEndpoint().toString()); if (!StringUtils.isNullOrEmpty(sdkRequest.getResourcePath())) { uriBuilder.append(sdkRequest.getResourcePath()); } QueryStringEncoder encoder = new QueryStringEncoder(uriBuilder.toString()); for (Map.Entry<String, List<String>> param : sdkRequest.getParameters().entrySet()) { for (String value : param.getValue()) { encoder.addParam(param.getKey(), value); } } return encoder.toString(); }
/** * @return true if the given value is non-null and non-empty */ public static boolean hasValue(String str) { return !isNullOrEmpty(str); }
@Override public void marshall(Date val, JsonMarshallerContext context, MarshallingInfo<Date> marshallingInfo) { TimestampFormat timestampFormat = marshallingInfo.timestampFormat(); context.request().addParameter(marshallingInfo.marshallLocationName(), StringUtils.fromDate(val, timestampFormat.getFormat())); } };
@Override public void marshall(Date val, JsonMarshallerContext context, MarshallingInfo<Date> marshallingInfo) { TimestampFormat timestampFormat = marshallingInfo.timestampFormat(); if (TimestampFormat.UNKNOWN.equals(timestampFormat)) { timestampFormat = TimestampFormat.ISO_8601; } context.request().addHeader(marshallingInfo.marshallLocationName(), StringUtils.fromDate(val, timestampFormat.getFormat())); } };
public static boolean isJavaKeyword(String word) { return reservedKeywords.contains(word) || reservedKeywords.contains(StringUtils.lowerCase(word)); } }
@Override public String convert(Date val) { return StringUtils.fromDate(val); } };
@Override public String convert(Long val) { return StringUtils.fromLong(val); } };
public Request<DeleteLoginProfileRequest> marshall(DeleteLoginProfileRequest deleteLoginProfileRequest) { if (deleteLoginProfileRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<DeleteLoginProfileRequest> request = new DefaultRequest<DeleteLoginProfileRequest>(deleteLoginProfileRequest, "AmazonIdentityManagement"); request.addParameter("Action", "DeleteLoginProfile"); request.addParameter("Version", "2010-05-08"); request.setHttpMethod(HttpMethodName.POST); if (deleteLoginProfileRequest.getUserName() != null) { request.addParameter("UserName", StringUtils.fromString(deleteLoginProfileRequest.getUserName())); } return request; }
public Request<DescribeKeyPairsRequest> marshall(DescribeKeyPairsRequest describeKeyPairsRequest) { throw new SdkClientException("Invalid argument passed to marshall(...)"); request.addParameter("Action", "DescribeKeyPairs"); request.addParameter("Version", "2016-11-15"); request.setHttpMethod(HttpMethodName.POST); if (!describeKeyPairsRequestFiltersList.isEmpty() || !describeKeyPairsRequestFiltersList.isAutoConstruct()) { int filtersListIndex = 1; if (describeKeyPairsRequestFiltersListValue.getName() != null) { request.addParameter("Filter." + filtersListIndex + ".Name", StringUtils.fromString(describeKeyPairsRequestFiltersListValue.getName())); .getValues(); if (!filterValuesList.isEmpty() || !filterValuesList.isAutoConstruct()) { int valuesListIndex = 1; request.addParameter("Filter." + filtersListIndex + ".Value." + valuesListIndex, StringUtils.fromString(filterValuesListValue)); request.addParameter("KeyName." + keyNamesListIndex, StringUtils.fromString(describeKeyPairsRequestKeyNamesListValue));
/** * Converts a given String to lower case with Locale.ENGLISH * * @param str the string to be converted to lower case * @return the lower case of string, or itself if string is null/empty */ public static String lowerCase(String str) { if(isNullOrEmpty(str)) { return str; } return str.toLowerCase(LOCALE_ENGLISH); }