idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
31,000
public static IAMInfo getIAMInstanceProfileInfo ( ) { String json = getData ( EC2_METADATA_ROOT + "/iam/info" ) ; if ( null == json ) { return null ; } try { return mapper . readValue ( json , IAMInfo . class ) ; } catch ( Exception e ) { log . warn ( "Unable to parse IAM Instance profile info (" + json + "): " + e . getMessage ( ) , e ) ; return null ; } }
Get information about the last time the instance profile was updated including the instance s LastUpdated date InstanceProfileArn and InstanceProfileId .
31,001
public static Map < String , String > getBlockDeviceMapping ( ) { Map < String , String > blockDeviceMapping = new HashMap < String , String > ( ) ; List < String > devices = getItems ( EC2_METADATA_ROOT + "/block-device-mapping" ) ; if ( devices != null ) { for ( String device : devices ) { blockDeviceMapping . put ( device , getData ( EC2_METADATA_ROOT + "/block-device-mapping/" + device ) ) ; } } return blockDeviceMapping ; }
Get the virtual devices associated with the ami root ebs and swap .
31,002
public static List < NetworkInterface > getNetworkInterfaces ( ) { List < NetworkInterface > networkInterfaces = new LinkedList < NetworkInterface > ( ) ; List < String > macs = getItems ( EC2_METADATA_ROOT + "/network/interfaces/macs/" ) ; if ( macs != null ) { for ( String mac : macs ) { String key = mac . trim ( ) ; if ( key . endsWith ( "/" ) ) { key = key . substring ( 0 , key . length ( ) - 1 ) ; } networkInterfaces . add ( new NetworkInterface ( key ) ) ; } } return networkInterfaces ; }
Get the list of network interfaces on the instance .
31,003
public static String getHostAddressForEC2MetadataService ( ) { String host = System . getProperty ( EC2_METADATA_SERVICE_OVERRIDE_SYSTEM_PROPERTY ) ; return host != null ? host : EC2_METADATA_SERVICE_URL ; }
Returns the host address of the Amazon EC2 Instance Metadata Service .
31,004
public boolean pollResource ( ) throws AmazonServiceException , WaiterTimedOutException , WaiterUnrecoverableException { int retriesAttempted = 0 ; while ( true ) { switch ( getCurrentState ( ) ) { case SUCCESS : return true ; case FAILURE : throw new WaiterUnrecoverableException ( "Resource never entered the desired state as it failed." ) ; case RETRY : PollingStrategyContext pollingStrategyContext = new PollingStrategyContext ( request , retriesAttempted ) ; if ( pollingStrategy . getRetryStrategy ( ) . shouldRetry ( pollingStrategyContext ) ) { safeCustomDelay ( pollingStrategyContext ) ; retriesAttempted ++ ; } else { throw new WaiterTimedOutException ( "Reached maximum attempts without transitioning to the desired state" ) ; } break ; } } }
Polls until a specified resource transitions into either success or failure state or until the specified number of retries has been made .
31,005
private WaiterState getCurrentState ( ) throws AmazonServiceException { try { return acceptor . accepts ( sdkFunction . apply ( request ) ) ; } catch ( AmazonServiceException amazonServiceException ) { return acceptor . accepts ( amazonServiceException ) ; } }
Fetches the current state of the resource based on the acceptor it matches
31,006
private void safeCustomDelay ( PollingStrategyContext pollingStrategyContext ) { try { pollingStrategy . getDelayStrategy ( ) . delayBeforeNextRetry ( pollingStrategyContext ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new RuntimeException ( e ) ; } }
Calls the custom delay strategy to control the sleep time
31,007
public static RegionMetadata getRegionMetadata ( ) { RegionMetadata rval = regionMetadata ; if ( rval != null ) { return rval ; } synchronized ( RegionUtils . class ) { if ( regionMetadata == null ) { initialize ( ) ; } } return regionMetadata ; }
Returns the current set of region metadata for this process initializing it if it has not yet been explicitly initialized before .
31,008
public static RegionMetadata loadMetadataFromResource ( final String name ) throws IOException { return LegacyRegionXmlLoadUtils . load ( RegionUtils . class , name ) ; }
Loads a set of region metadata from an XML file stored as a resource of the classloader used to load the RegionUtils class .
31,009
public static synchronized void initializeFromFile ( final File file ) { try { regionMetadata = loadMetadataFromFile ( file ) ; } catch ( IOException exception ) { throw new SdkClientException ( "Error parsing region metadata from " + file , exception ) ; } }
Initializes the region metadata singleton from an XML file on disk .
31,010
private static void addAclHeaders ( Request < ? extends AmazonWebServiceRequest > request , AccessControlList acl ) { List < Grant > grants = acl . getGrantsAsList ( ) ; Map < Permission , Collection < Grantee > > grantsByPermission = new HashMap < Permission , Collection < Grantee > > ( ) ; for ( Grant grant : grants ) { if ( ! grantsByPermission . containsKey ( grant . getPermission ( ) ) ) { grantsByPermission . put ( grant . getPermission ( ) , new LinkedList < Grantee > ( ) ) ; } grantsByPermission . get ( grant . getPermission ( ) ) . add ( grant . getGrantee ( ) ) ; } for ( Permission permission : Permission . values ( ) ) { if ( grantsByPermission . containsKey ( permission ) ) { Collection < Grantee > grantees = grantsByPermission . get ( permission ) ; boolean seenOne = false ; StringBuilder granteeString = new StringBuilder ( ) ; for ( Grantee grantee : grantees ) { if ( ! seenOne ) seenOne = true ; else granteeString . append ( ", " ) ; granteeString . append ( grantee . getTypeIdentifier ( ) ) . append ( "=" ) . append ( "\"" ) . append ( grantee . getIdentifier ( ) ) . append ( "\"" ) ; } request . addHeader ( permission . getHeaderName ( ) , granteeString . toString ( ) ) ; } } }
Sets the access control headers for the request given .
31,011
private void setAcl ( String bucketName , String key , String versionId , CannedAccessControlList cannedAcl , boolean isRequesterPays , AmazonWebServiceRequest originalRequest ) { if ( originalRequest == null ) originalRequest = new GenericBucketRequest ( bucketName ) ; Request < AmazonWebServiceRequest > request = createRequest ( bucketName , key , originalRequest , HttpMethodName . PUT ) ; if ( bucketName != null && key != null ) { request . addHandlerContext ( HandlerContextKey . OPERATION_NAME , "PutObjectAcl" ) ; } else if ( bucketName != null ) { request . addHandlerContext ( HandlerContextKey . OPERATION_NAME , "PutBucketAcl" ) ; } request . addParameter ( "acl" , null ) ; request . addHeader ( Headers . S3_CANNED_ACL , cannedAcl . toString ( ) ) ; if ( versionId != null ) request . addParameter ( "versionId" , versionId ) ; populateRequesterPaysHeader ( request , isRequesterPays ) ; invoke ( request , voidResponseHandler , bucketName , key ) ; }
Sets the Canned ACL for the specified resource in S3 . If only bucketName is specified the canned ACL will be applied to the bucket otherwise if bucketName and key are specified the canned ACL will be applied to the object .
31,012
private void setAcl ( String bucketName , String key , String versionId , AccessControlList acl , boolean isRequesterPays , AmazonWebServiceRequest originalRequest ) { if ( originalRequest == null ) originalRequest = new GenericBucketRequest ( bucketName ) ; Request < AmazonWebServiceRequest > request = createRequest ( bucketName , key , originalRequest , HttpMethodName . PUT ) ; if ( bucketName != null && key != null ) { request . addHandlerContext ( HandlerContextKey . OPERATION_NAME , "PutObjectAcl" ) ; } else if ( bucketName != null ) { request . addHandlerContext ( HandlerContextKey . OPERATION_NAME , "PutBucketAcl" ) ; } request . addParameter ( "acl" , null ) ; if ( versionId != null ) request . addParameter ( "versionId" , versionId ) ; populateRequesterPaysHeader ( request , isRequesterPays ) ; byte [ ] aclAsXml = new AclXmlFactory ( ) . convertToXmlByteArray ( acl ) ; request . addHeader ( "Content-Type" , "application/xml" ) ; request . addHeader ( "Content-Length" , String . valueOf ( aclAsXml . length ) ) ; request . setContent ( new ByteArrayInputStream ( aclAsXml ) ) ; invoke ( request , voidResponseHandler , bucketName , key ) ; }
Sets the ACL for the specified resource in S3 . If only bucketName is specified the ACL will be applied to the bucket otherwise if bucketName and key are specified the ACL will be applied to the object .
31,013
protected < T > void presignRequest ( Request < T > request , HttpMethod methodName , String bucketName , String key , Date expiration , String subResource ) { beforeRequest ( request ) ; String resourcePath = "/" + ( ( bucketName != null ) ? bucketName + "/" : "" ) + ( ( key != null ) ? SdkHttpUtils . urlEncode ( key , true ) : "" ) + ( ( subResource != null ) ? "?" + subResource : "" ) ; resourcePath = resourcePath . replaceAll ( "(?<=/)/" , "%2F" ) ; new S3QueryStringSigner ( methodName . toString ( ) , resourcePath , expiration ) . sign ( request , CredentialUtils . getCredentialsProvider ( request . getOriginalRequest ( ) , awsCredentialsProvider ) . getCredentials ( ) ) ; if ( request . getHeaders ( ) . containsKey ( Headers . SECURITY_TOKEN ) ) { String value = request . getHeaders ( ) . get ( Headers . SECURITY_TOKEN ) ; request . addParameter ( Headers . SECURITY_TOKEN , value ) ; request . getHeaders ( ) . remove ( Headers . SECURITY_TOKEN ) ; } }
Pre - signs the specified request using a signature query - string parameter .
31,014
private void addPartNumberIfNotNull ( Request < ? > request , Integer partNumber ) { if ( partNumber != null ) { request . addParameter ( "partNumber" , partNumber . toString ( ) ) ; } }
Adds the part number to the specified request if partNumber is not null .
31,015
private static void addHeaderIfNotNull ( Request < ? > request , String header , String value ) { if ( value != null ) { request . addHeader ( header , value ) ; } }
Adds the specified header to the specified request if the header value is not null .
31,016
public String getResourceUrl ( String bucketName , String key ) { try { return getUrl ( bucketName , key ) . toString ( ) ; } catch ( Exception e ) { return null ; } }
Returns the URL to the key in the bucket given using the client s scheme and endpoint . Returns null if the given bucket and key cannot be converted to a URL .
31,017
protected < X extends AmazonWebServiceRequest > Request < X > createRequest ( String bucketName , String key , X originalRequest , HttpMethodName httpMethod ) { return createRequest ( bucketName , key , originalRequest , httpMethod , endpoint ) ; }
Creates and initializes a new request object for the specified S3 resource . This method is responsible for determining the right way to address resources . For example bucket names that are not DNS addressable cannot be addressed in V2 virtual host style and instead must use V1 path style . The returned request object has the service name endpoint and resource path correctly populated . Callers can take the request add any additional headers or parameters then sign and execute the request .
31,018
private void resolveRequestEndpoint ( Request < ? > request , String bucketName , String key , URI endpoint ) { ServiceEndpointBuilder builder = getBuilder ( endpoint , endpoint . getScheme ( ) , false ) ; buildEndpointResolver ( builder , bucketName , key ) . resolveRequestEndpoint ( request ) ; }
Configure the given request with an endpoint and resource path based on the bucket name and key provided
31,019
private boolean isSigV2PresignedUrl ( URL presignedUrl ) { String url = presignedUrl . toString ( ) ; return url . contains ( "AWSAccessKeyId=" ) && ! presignedUrl . toString ( ) . contains ( "X-Amz-Algorithm=AWS4-HMAC-SHA256" ) ; }
SigV2 presigned url has AWSAccessKeyId in the params . Also doing X - Amz - Algorithm check to ensure AWSAccessKeyId = is not present in the bucket or key name
31,020
protected final InitiateMultipartUploadRequest newInitiateMultipartUploadRequest ( UploadObjectRequest req ) { return new InitiateMultipartUploadRequest ( req . getBucketName ( ) , req . getKey ( ) , req . getMetadata ( ) ) . withRedirectLocation ( req . getRedirectLocation ( ) ) . withSSEAwsKeyManagementParams ( req . getSSEAwsKeyManagementParams ( ) ) . withSSECustomerKey ( req . getSSECustomerKey ( ) ) . withStorageClass ( req . getStorageClass ( ) ) . withAccessControlList ( req . getAccessControlList ( ) ) . withCannedACL ( req . getCannedAcl ( ) ) . withGeneralProgressListener ( req . getGeneralProgressListener ( ) ) . withRequestMetricCollector ( req . getRequestMetricCollector ( ) ) ; }
Creates and returns a multi - part upload initiation request from the given upload - object request .
31,021
private void putLocalObject ( final UploadObjectRequest reqIn , OutputStream os ) throws IOException { UploadObjectRequest req = reqIn . clone ( ) ; final File fileOrig = req . getFile ( ) ; final InputStream isOrig = req . getInputStream ( ) ; if ( isOrig == null ) { if ( fileOrig == null ) throw new IllegalArgumentException ( "Either a file lor input stream must be specified" ) ; req . setInputStream ( new FileInputStream ( fileOrig ) ) ; req . setFile ( null ) ; } try { IOUtils . copy ( req . getInputStream ( ) , os ) ; } finally { cleanupDataSource ( req , fileOrig , isOrig , req . getInputStream ( ) , log ) ; IOUtils . closeQuietly ( os , log ) ; } return ; }
Used for performance testing purposes only .
31,022
CompleteMultipartUploadResult uploadObject ( final UploadObjectRequest req ) throws IOException , InterruptedException , ExecutionException { ExecutorService es = req . getExecutorService ( ) ; final boolean defaultExecutorService = es == null ; if ( es == null ) es = Executors . newFixedThreadPool ( clientConfiguration . getMaxConnections ( ) ) ; UploadObjectObserver observer = req . getUploadObjectObserver ( ) ; if ( observer == null ) observer = new UploadObjectObserver ( ) ; observer . init ( req , this , this , es ) ; observer . onUploadInitiation ( req ) ; final List < PartETag > partETags = new ArrayList < PartETag > ( ) ; MultiFileOutputStream mfos = req . getMultiFileOutputStream ( ) ; if ( mfos == null ) mfos = new MultiFileOutputStream ( ) ; try { mfos . init ( observer , req . getPartSize ( ) , req . getDiskLimit ( ) ) ; putLocalObject ( req , mfos ) ; for ( Future < UploadPartResult > future : observer . getFutures ( ) ) { UploadPartResult partResult = future . get ( ) ; partETags . add ( new PartETag ( partResult . getPartNumber ( ) , partResult . getETag ( ) ) ) ; } } finally { if ( defaultExecutorService ) es . shutdownNow ( ) ; mfos . cleanup ( ) ; } return observer . onCompletion ( partETags ) ; }
Used for performance testing purposes only . Hence package private . This method is subject to removal anytime without notice .
31,023
URI resolveServiceEndpoint ( String bucketName ) { if ( getSignerRegion ( ) != null || isSignerOverridden ( ) ) return endpoint ; final String regionStr = fetchRegionFromCache ( bucketName ) ; final com . amazonaws . regions . Region region = RegionUtils . getRegion ( regionStr ) ; if ( region == null ) { log . warn ( "Region information for " + regionStr + " is not available. Please upgrade to latest version of AWS Java SDK" ) ; } return region != null ? RuntimeHttpUtils . toUri ( region . getServiceEndpoint ( S3_SERVICE_NAME ) , clientConfiguration ) : endpoint ; }
Specifically made package access for testing . Used for internal consumption of AWS SDK .
31,024
private String fetchRegionFromCache ( String bucketName ) { String bucketRegion = bucketRegionCache . get ( bucketName ) ; if ( bucketRegion == null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Bucket region cache doesn't have an entry for " + bucketName + ". Trying to get bucket region from Amazon S3." ) ; } bucketRegion = getBucketRegionViaHeadRequest ( bucketName ) ; if ( bucketRegion != null ) { bucketRegionCache . put ( bucketName , bucketRegion ) ; } } if ( log . isDebugEnabled ( ) ) { log . debug ( "Region for " + bucketName + " is " + bucketRegion ) ; } return bucketRegion ; }
Fetches the region of the bucket from the cache maintained . If the cache doesn t have an entry fetches the region from Amazon S3 and updates the cache .
31,025
private String getBucketRegionViaHeadRequest ( String bucketName ) { String bucketRegion = null ; try { Request < HeadBucketRequest > request = createRequest ( bucketName , null , new HeadBucketRequest ( bucketName ) , HttpMethodName . HEAD ) ; request . addHandlerContext ( HandlerContextKey . OPERATION_NAME , "HeadBucket" ) ; HeadBucketResult result = invoke ( request , new HeadBucketResultHandler ( ) , bucketName , null , true ) ; bucketRegion = result . getBucketRegion ( ) ; } catch ( AmazonS3Exception exception ) { if ( exception . getAdditionalDetails ( ) != null ) { bucketRegion = exception . getAdditionalDetails ( ) . get ( Headers . S3_BUCKET_REGION ) ; } } if ( bucketRegion == null && log . isDebugEnabled ( ) ) { log . debug ( "Not able to derive region of the " + bucketName + " from the HEAD Bucket requests." ) ; } return bucketRegion ; }
Retrieves the region of the bucket by making a HeadBucket request to us - west - 1 region .
31,026
public void setEntitlements ( java . util . Collection < GrantEntitlementRequest > entitlements ) { if ( entitlements == null ) { this . entitlements = null ; return ; } this . entitlements = new java . util . ArrayList < GrantEntitlementRequest > ( entitlements ) ; }
The list of entitlements that you want to grant .
31,027
private FileOutputStream fos ( ) throws IOException { if ( closed ) throw new IOException ( "Output stream is already closed" ) ; if ( os == null || currFileBytesWritten >= partSize ) { if ( os != null ) { os . close ( ) ; observer . onPartCreate ( new PartCreationEvent ( getFile ( filesCreated ) , filesCreated , false , this ) ) ; } currFileBytesWritten = 0 ; filesCreated ++ ; blockIfNecessary ( ) ; final File file = getFile ( filesCreated ) ; os = new FileOutputStream ( file ) ; } return os ; }
Returns the file output stream to be used for writing blocking if necessary if running out of disk space .
31,028
private void blockIfNecessary ( ) { if ( diskPermits == null || diskLimit == Long . MAX_VALUE ) return ; try { diskPermits . acquire ( ) ; } catch ( InterruptedException e ) { throw new AbortedException ( e ) ; } }
Blocks the running thread if running out of disk space .
31,029
boolean isVersionAttributeGetter ( Method getter ) { synchronized ( versionAttributeGetterCache ) { if ( ! versionAttributeGetterCache . containsKey ( getter ) ) { versionAttributeGetterCache . put ( getter , getter . getName ( ) . startsWith ( "get" ) && getter . getParameterTypes ( ) . length == 0 && ReflectionUtils . getterOrFieldHasAnnotation ( getter , DynamoDBVersionAttribute . class ) ) ; } return versionAttributeGetterCache . get ( getter ) ; } }
Returns whether the method given is an annotated no - args getter of a version attribute .
31,030
String getPrimaryRangeKeyName ( Class < ? > clazz ) { Method primaryRangeKeyGetter = getPrimaryHashKeyGetter ( clazz ) ; return primaryRangeKeyGetter == null ? null : getAttributeName ( getPrimaryRangeKeyGetter ( clazz ) ) ; }
Returns the name of the primary range key or null if the table does not one .
31,031
ObjectMetadata toObjectMetadata ( ObjectMetadata metadata , CryptoMode mode ) { return mode == CryptoMode . EncryptionOnly && ! usesKMSKey ( ) ? toObjectMetadataEO ( metadata ) : toObjectMetadata ( metadata ) ; }
Returns the given metadata updated with this content crypto material .
31,032
private ObjectMetadata toObjectMetadata ( ObjectMetadata metadata ) { byte [ ] encryptedCEK = getEncryptedCEK ( ) ; metadata . addUserMetadata ( Headers . CRYPTO_KEY_V2 , Base64 . encodeAsString ( encryptedCEK ) ) ; byte [ ] iv = cipherLite . getIV ( ) ; metadata . addUserMetadata ( Headers . CRYPTO_IV , Base64 . encodeAsString ( iv ) ) ; metadata . addUserMetadata ( Headers . MATERIALS_DESCRIPTION , kekMaterialDescAsJson ( ) ) ; ContentCryptoScheme scheme = getContentCryptoScheme ( ) ; metadata . addUserMetadata ( Headers . CRYPTO_CEK_ALGORITHM , scheme . getCipherAlgorithm ( ) ) ; int tagLen = scheme . getTagLengthInBits ( ) ; if ( tagLen > 0 ) metadata . addUserMetadata ( Headers . CRYPTO_TAG_LENGTH , String . valueOf ( tagLen ) ) ; String keyWrapAlgo = getKeyWrappingAlgorithm ( ) ; if ( keyWrapAlgo != null ) metadata . addUserMetadata ( Headers . CRYPTO_KEYWRAP_ALGORITHM , keyWrapAlgo ) ; return metadata ; }
Returns the metadata in the latest format .
31,033
private String toJsonString ( ) { Map < String , String > map = new HashMap < String , String > ( ) ; byte [ ] encryptedCEK = getEncryptedCEK ( ) ; map . put ( Headers . CRYPTO_KEY_V2 , Base64 . encodeAsString ( encryptedCEK ) ) ; byte [ ] iv = cipherLite . getIV ( ) ; map . put ( Headers . CRYPTO_IV , Base64 . encodeAsString ( iv ) ) ; map . put ( Headers . MATERIALS_DESCRIPTION , kekMaterialDescAsJson ( ) ) ; ContentCryptoScheme scheme = getContentCryptoScheme ( ) ; map . put ( Headers . CRYPTO_CEK_ALGORITHM , scheme . getCipherAlgorithm ( ) ) ; int tagLen = scheme . getTagLengthInBits ( ) ; if ( tagLen > 0 ) map . put ( Headers . CRYPTO_TAG_LENGTH , String . valueOf ( tagLen ) ) ; String keyWrapAlgo = getKeyWrappingAlgorithm ( ) ; if ( keyWrapAlgo != null ) map . put ( Headers . CRYPTO_KEYWRAP_ALGORITHM , keyWrapAlgo ) ; return Jackson . toJsonString ( map ) ; }
Returns the json string in the latest format .
31,034
private String kekMaterialDescAsJson ( ) { Map < String , String > kekMaterialDesc = getKEKMaterialsDescription ( ) ; if ( kekMaterialDesc == null ) kekMaterialDesc = Collections . emptyMap ( ) ; return Jackson . toJsonString ( kekMaterialDesc ) ; }
Returns the key - encrypting - key material description as a non - null json string ;
31,035
@ SuppressWarnings ( "unchecked" ) private static Map < String , String > matdescFromJson ( String json ) { Map < String , String > map = Jackson . fromJsonString ( json , Map . class ) ; return map == null ? null : Collections . unmodifiableMap ( map ) ; }
Returns the corresponding kek material description from the given json ; or null if the input is null .
31,036
private static SecretKey cek ( byte [ ] cekSecured , String keyWrapAlgo , EncryptionMaterials materials , Provider securityProvider , ContentCryptoScheme contentCryptoScheme , AWSKMS kms ) { if ( isKMSKeyWrapped ( keyWrapAlgo ) ) return cekByKMS ( cekSecured , keyWrapAlgo , materials , contentCryptoScheme , kms ) ; Key kek ; if ( materials . getKeyPair ( ) != null ) { kek = materials . getKeyPair ( ) . getPrivate ( ) ; if ( kek == null ) { throw new SdkClientException ( "Key encrypting key not available" ) ; } } else { kek = materials . getSymmetricKey ( ) ; if ( kek == null ) { throw new SdkClientException ( "Key encrypting key not available" ) ; } } try { if ( keyWrapAlgo != null ) { Cipher cipher = securityProvider == null ? Cipher . getInstance ( keyWrapAlgo ) : Cipher . getInstance ( keyWrapAlgo , securityProvider ) ; cipher . init ( Cipher . UNWRAP_MODE , kek ) ; return ( SecretKey ) cipher . unwrap ( cekSecured , keyWrapAlgo , Cipher . SECRET_KEY ) ; } Cipher cipher ; if ( securityProvider != null ) { cipher = Cipher . getInstance ( kek . getAlgorithm ( ) , securityProvider ) ; } else { cipher = Cipher . getInstance ( kek . getAlgorithm ( ) ) ; } cipher . init ( Cipher . DECRYPT_MODE , kek ) ; byte [ ] decryptedSymmetricKeyBytes = cipher . doFinal ( cekSecured ) ; return new SecretKeySpec ( decryptedSymmetricKeyBytes , JceEncryptionConstants . SYMMETRIC_KEY_ALGORITHM ) ; } catch ( Exception e ) { throw failure ( e , "Unable to decrypt symmetric key from object metadata" ) ; } }
Returns the content encrypting key unwrapped or decrypted . Note if KMS is used for key protection a remote call will be made to KMS to decrypt the ciphertext blob .
31,037
private static SecretKey cekByKMS ( byte [ ] cekSecured , String keyWrapAlgo , EncryptionMaterials materials , ContentCryptoScheme contentCryptoScheme , AWSKMS kms ) { DecryptRequest kmsreq = new DecryptRequest ( ) . withEncryptionContext ( materials . getMaterialsDescription ( ) ) . withCiphertextBlob ( ByteBuffer . wrap ( cekSecured ) ) ; DecryptResult result = kms . decrypt ( kmsreq ) ; return new SecretKeySpec ( copyAllBytesFrom ( result . getPlaintext ( ) ) , contentCryptoScheme . getKeyGeneratorAlgorithm ( ) ) ; }
Decrypts the secured CEK via KMS ; involves network calls .
31,038
static ContentCryptoMaterial fromObjectMetadata ( ObjectMetadata metadata , EncryptionMaterialsAccessor kekMaterialAccessor , Provider securityProvider , boolean alwaysUseSecurityProvider , long [ ] range , ExtraMaterialsDescription extra , boolean keyWrapExpected , AWSKMS kms ) { return fromObjectMetadata0 ( metadata , kekMaterialAccessor , securityProvider , alwaysUseSecurityProvider , range , extra , keyWrapExpected , kms ) ; }
Factory method to return the content crypto material from the S3 object meta data using the specified key encrypting key material accessor and an optional security provider .
31,039
static ContentCryptoMaterial fromInstructionFile ( Map < String , String > instFile , EncryptionMaterialsAccessor kekMaterialAccessor , Provider securityProvider , boolean alwaysUseSecurityProvider , long [ ] range , ExtraMaterialsDescription extra , boolean keyWrapExpected , AWSKMS kms ) { return fromInstructionFile0 ( instFile , kekMaterialAccessor , securityProvider , alwaysUseSecurityProvider , range , extra , keyWrapExpected , kms ) ; }
Factory method to return the content crypto material from the S3 instruction file using the specified key encrypting key material accessor and an optional security provider .
31,040
static String parseInstructionFile ( S3Object instructionFile ) { try { return convertStreamToString ( instructionFile . getObjectContent ( ) ) ; } catch ( Exception e ) { throw failure ( e , "Error parsing JSON instruction file" ) ; } }
Parses instruction data retrieved from S3 and returns a JSON string representing the instruction . Made for testing purposes .
31,041
private static String convertStreamToString ( InputStream inputStream ) throws IOException { if ( inputStream == null ) { return "" ; } else { StringBuilder stringBuilder = new StringBuilder ( ) ; String line ; try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream , StringUtils . UTF8 ) ) ; while ( ( line = reader . readLine ( ) ) != null ) { stringBuilder . append ( line ) ; } } finally { inputStream . close ( ) ; } return stringBuilder . toString ( ) ; } }
Converts the contents of an input stream to a String
31,042
ContentCryptoMaterial recreate ( EncryptionMaterials newKEK , EncryptionMaterialsAccessor accessor , S3CryptoScheme targetScheme , CryptoConfiguration config , AWSKMS kms , AmazonWebServiceRequest req ) { if ( ! usesKMSKey ( ) && newKEK . getMaterialsDescription ( ) . equals ( kekMaterialsDescription ) ) { throw new SecurityException ( "Material description of the new KEK must differ from the current one" ) ; } final EncryptionMaterials origKEK ; if ( usesKMSKey ( ) ) { origKEK = new KMSEncryptionMaterials ( kekMaterialsDescription . get ( KMSEncryptionMaterials . CUSTOMER_MASTER_KEY_ID ) ) ; } else { origKEK = accessor . getEncryptionMaterials ( kekMaterialsDescription ) ; } SecretKey cek = cek ( encryptedCEK , keyWrappingAlgorithm , origKEK , config . getCryptoProvider ( ) , getContentCryptoScheme ( ) , kms ) ; ContentCryptoMaterial output = create ( cek , cipherLite . getIV ( ) , newKEK , getContentCryptoScheme ( ) , targetScheme , config , kms , req ) ; if ( Arrays . equals ( output . encryptedCEK , encryptedCEK ) ) { throw new SecurityException ( "The new KEK must differ from the original" ) ; } return output ; }
Recreates a new content crypto material from the current material given a new KEK encryption materials . The purpose is to re - encrypt the CEK under the new KEK .
31,043
public synchronized static Mimetypes getInstance ( ) { if ( mimetypes != null ) return mimetypes ; mimetypes = new Mimetypes ( ) ; InputStream is = mimetypes . getClass ( ) . getResourceAsStream ( "/mime.types" ) ; if ( is != null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Loading mime types from file in the classpath: mime.types" ) ; } try { mimetypes . loadAndReplaceMimetypes ( is ) ; } catch ( IOException e ) { if ( log . isErrorEnabled ( ) ) { log . error ( "Failed to load mime types from file in the classpath: mime.types" , e ) ; } } finally { try { is . close ( ) ; } catch ( IOException ex ) { log . debug ( "" , ex ) ; } } } else { if ( log . isWarnEnabled ( ) ) { log . warn ( "Unable to find 'mime.types' file in classpath" ) ; } } return mimetypes ; }
Loads MIME type info from the file mime . types in the classpath if it s available .
31,044
public void loadAndReplaceMimetypes ( InputStream is ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( is , StringUtils . UTF8 ) ) ; String line = null ; while ( ( line = br . readLine ( ) ) != null ) { line = line . trim ( ) ; if ( line . startsWith ( "#" ) || line . length ( ) == 0 ) { } else { StringTokenizer st = new StringTokenizer ( line , " \t" ) ; if ( st . countTokens ( ) > 1 ) { String mimetype = st . nextToken ( ) ; while ( st . hasMoreTokens ( ) ) { String extension = st . nextToken ( ) ; extensionToMimetypeMap . put ( StringUtils . lowerCase ( extension ) , mimetype ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Setting mime type for extension '" + StringUtils . lowerCase ( extension ) + "' to '" + mimetype + "'" ) ; } } } else { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignoring mimetype with no associated file extensions: '" + line + "'" ) ; } } } } }
Reads and stores the mime type setting corresponding to a file extension by reading text from an InputStream . If a mime type setting already exists when this method is run the mime type value is replaced with the newer one .
31,045
public SelectParameters withExpressionType ( ExpressionType expressionType ) { setExpressionType ( expressionType == null ? null : expressionType . toString ( ) ) ; return this ; }
Sets the expressionType
31,046
public void addRequestContentLength ( long contentLength ) { if ( contentLength < 0 ) throw new IllegalArgumentException ( ) ; synchronized ( lock ) { if ( this . requestContentLength == - 1 ) this . requestContentLength = contentLength ; else this . requestContentLength += contentLength ; } }
Adds the number of bytes to be expected in the request .
31,047
public void addResponseContentLength ( long contentLength ) { if ( contentLength < 0 ) throw new IllegalArgumentException ( ) ; synchronized ( lock ) { if ( this . responseContentLength == - 1 ) this . responseContentLength = contentLength ; else this . responseContentLength += contentLength ; } }
Adds the number of bytes to be expected in the response .
31,048
public void setInputSecurityGroups ( java . util . Collection < InputSecurityGroup > inputSecurityGroups ) { if ( inputSecurityGroups == null ) { this . inputSecurityGroups = null ; return ; } this . inputSecurityGroups = new java . util . ArrayList < InputSecurityGroup > ( inputSecurityGroups ) ; }
List of input security groups
31,049
public JsonNode evaluate ( List < JsonNode > evaluatedArgs ) throws InvalidTypeException { JsonNode arg = evaluatedArgs . get ( 0 ) ; if ( arg . isTextual ( ) ) { return getStringLength ( arg ) ; } else if ( arg . isArray ( ) || arg . isObject ( ) ) { return new IntNode ( arg . size ( ) ) ; } throw new InvalidTypeException ( "Type mismatch. Expecting a string or an array or an object." ) ; }
Evaluates the length of the given argument .
31,050
private static BooleanNode doesArrayContain ( JsonNode subject , JsonNode search ) { Iterator < JsonNode > elements = subject . elements ( ) ; while ( elements . hasNext ( ) ) { if ( elements . next ( ) . equals ( search ) ) { return BooleanNode . TRUE ; } } return BooleanNode . FALSE ; }
If subject is an array this function returns true if one of the elements in the array is equal to the provided search value .
31,051
private static BooleanNode doesStringContain ( JsonNode subject , JsonNode search ) { if ( subject . asText ( ) . contains ( search . asText ( ) ) ) { return BooleanNode . TRUE ; } return BooleanNode . FALSE ; }
If the provided subject is a string this function returns true if the string contains the provided search argument .
31,052
@ com . fasterxml . jackson . annotation . JsonProperty ( "errorAttribute" ) public void setErrorAttribute ( String errorAttribute ) { this . errorAttribute = errorAttribute ; }
The attribute which caused the error .
31,053
private static void sendMessageOperationMd5Check ( SendMessageRequest sendMessageRequest , SendMessageResult sendMessageResult ) { String messageBodySent = sendMessageRequest . getMessageBody ( ) ; String bodyMd5Returned = sendMessageResult . getMD5OfMessageBody ( ) ; String clientSideBodyMd5 = calculateMessageBodyMd5 ( messageBodySent ) ; if ( ! clientSideBodyMd5 . equals ( bodyMd5Returned ) ) { throw new AmazonClientException ( String . format ( MD5_MISMATCH_ERROR_MESSAGE , MESSAGE_BODY , clientSideBodyMd5 , bodyMd5Returned ) ) ; } Map < String , MessageAttributeValue > messageAttrSent = sendMessageRequest . getMessageAttributes ( ) ; if ( messageAttrSent != null && ! messageAttrSent . isEmpty ( ) ) { String clientSideAttrMd5 = calculateMessageAttributesMd5 ( messageAttrSent ) ; String attrMd5Returned = sendMessageResult . getMD5OfMessageAttributes ( ) ; if ( ! clientSideAttrMd5 . equals ( attrMd5Returned ) ) { throw new AmazonClientException ( String . format ( MD5_MISMATCH_ERROR_MESSAGE , MESSAGE_ATTRIBUTES , clientSideAttrMd5 , attrMd5Returned ) ) ; } } }
Throw an exception if the MD5 checksums returned in the SendMessageResult do not match the client - side calculation based on the original message in the SendMessageRequest .
31,054
private static void receiveMessageResultMd5Check ( ReceiveMessageResult receiveMessageResult ) { if ( receiveMessageResult . getMessages ( ) != null ) { for ( Message messageReceived : receiveMessageResult . getMessages ( ) ) { String messageBody = messageReceived . getBody ( ) ; String bodyMd5Returned = messageReceived . getMD5OfBody ( ) ; String clientSideBodyMd5 = calculateMessageBodyMd5 ( messageBody ) ; if ( ! clientSideBodyMd5 . equals ( bodyMd5Returned ) ) { throw new AmazonClientException ( String . format ( MD5_MISMATCH_ERROR_MESSAGE , MESSAGE_BODY , clientSideBodyMd5 , bodyMd5Returned ) ) ; } Map < String , MessageAttributeValue > messageAttr = messageReceived . getMessageAttributes ( ) ; if ( messageAttr != null && ! messageAttr . isEmpty ( ) ) { String attrMd5Returned = messageReceived . getMD5OfMessageAttributes ( ) ; String clientSideAttrMd5 = calculateMessageAttributesMd5 ( messageAttr ) ; if ( ! clientSideAttrMd5 . equals ( attrMd5Returned ) ) { throw new AmazonClientException ( String . format ( MD5_MISMATCH_ERROR_MESSAGE , MESSAGE_ATTRIBUTES , clientSideAttrMd5 , attrMd5Returned ) ) ; } } } } }
Throw an exception if the MD5 checksums included in the ReceiveMessageResult do not match the client - side calculation on the received messages .
31,055
private static void sendMessageBatchOperationMd5Check ( SendMessageBatchRequest sendMessageBatchRequest , SendMessageBatchResult sendMessageBatchResult ) { Map < String , SendMessageBatchRequestEntry > idToRequestEntryMap = new HashMap < String , SendMessageBatchRequestEntry > ( ) ; if ( sendMessageBatchRequest . getEntries ( ) != null ) { for ( SendMessageBatchRequestEntry entry : sendMessageBatchRequest . getEntries ( ) ) { idToRequestEntryMap . put ( entry . getId ( ) , entry ) ; } } if ( sendMessageBatchResult . getSuccessful ( ) != null ) { for ( SendMessageBatchResultEntry entry : sendMessageBatchResult . getSuccessful ( ) ) { String messageBody = idToRequestEntryMap . get ( entry . getId ( ) ) . getMessageBody ( ) ; String bodyMd5Returned = entry . getMD5OfMessageBody ( ) ; String clientSideBodyMd5 = calculateMessageBodyMd5 ( messageBody ) ; if ( ! clientSideBodyMd5 . equals ( bodyMd5Returned ) ) { throw new AmazonClientException ( String . format ( MD5_MISMATCH_ERROR_MESSAGE_WITH_ID , MESSAGE_BODY , entry . getId ( ) , clientSideBodyMd5 , bodyMd5Returned ) ) ; } Map < String , MessageAttributeValue > messageAttr = idToRequestEntryMap . get ( entry . getId ( ) ) . getMessageAttributes ( ) ; if ( messageAttr != null && ! messageAttr . isEmpty ( ) ) { String attrMd5Returned = entry . getMD5OfMessageAttributes ( ) ; String clientSideAttrMd5 = calculateMessageAttributesMd5 ( messageAttr ) ; if ( ! clientSideAttrMd5 . equals ( attrMd5Returned ) ) { throw new AmazonClientException ( String . format ( MD5_MISMATCH_ERROR_MESSAGE_WITH_ID , MESSAGE_ATTRIBUTES , entry . getId ( ) , clientSideAttrMd5 , attrMd5Returned ) ) ; } } } } }
Throw an exception if the MD5 checksums returned in the SendMessageBatchResult do not match the client - side calculation based on the original messages in the SendMessageBatchRequest .
31,056
private static String calculateMessageBodyMd5 ( String messageBody ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Message body: " + messageBody ) ; } byte [ ] expectedMd5 ; try { expectedMd5 = Md5Utils . computeMD5Hash ( messageBody . getBytes ( UTF8 ) ) ; } catch ( Exception e ) { throw new AmazonClientException ( "Unable to calculate the MD5 hash of the message body. " + e . getMessage ( ) , e ) ; } String expectedMd5Hex = BinaryUtils . toHex ( expectedMd5 ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Expected MD5 of message body: " + expectedMd5Hex ) ; } return expectedMd5Hex ; }
Returns the hex - encoded MD5 hash String of the given message body .
31,057
private static String calculateMessageAttributesMd5 ( final Map < String , MessageAttributeValue > messageAttributes ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Message attribtues: " + messageAttributes ) ; } List < String > sortedAttributeNames = new ArrayList < String > ( messageAttributes . keySet ( ) ) ; Collections . sort ( sortedAttributeNames ) ; MessageDigest md5Digest = null ; try { md5Digest = MessageDigest . getInstance ( "MD5" ) ; for ( String attrName : sortedAttributeNames ) { MessageAttributeValue attrValue = messageAttributes . get ( attrName ) ; updateLengthAndBytes ( md5Digest , attrName ) ; updateLengthAndBytes ( md5Digest , attrValue . getDataType ( ) ) ; if ( attrValue . getStringValue ( ) != null ) { md5Digest . update ( STRING_TYPE_FIELD_INDEX ) ; updateLengthAndBytes ( md5Digest , attrValue . getStringValue ( ) ) ; } else if ( attrValue . getBinaryValue ( ) != null ) { md5Digest . update ( BINARY_TYPE_FIELD_INDEX ) ; updateLengthAndBytes ( md5Digest , attrValue . getBinaryValue ( ) ) ; } else if ( attrValue . getStringListValues ( ) . size ( ) > 0 ) { md5Digest . update ( STRING_LIST_TYPE_FIELD_INDEX ) ; for ( String strListMember : attrValue . getStringListValues ( ) ) { updateLengthAndBytes ( md5Digest , strListMember ) ; } } else if ( attrValue . getBinaryListValues ( ) . size ( ) > 0 ) { md5Digest . update ( BINARY_LIST_TYPE_FIELD_INDEX ) ; for ( ByteBuffer byteListMember : attrValue . getBinaryListValues ( ) ) { updateLengthAndBytes ( md5Digest , byteListMember ) ; } } } } catch ( Exception e ) { throw new AmazonClientException ( "Unable to calculate the MD5 hash of the message attributes. " + e . getMessage ( ) , e ) ; } String expectedMd5Hex = BinaryUtils . toHex ( md5Digest . digest ( ) ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Expected MD5 of message attributes: " + expectedMd5Hex ) ; } return expectedMd5Hex ; }
Returns the hex - encoded MD5 hash String of the given message attributes .
31,058
public InstructionFileId instructionFileId ( String suffix ) { String ifileKey = key + DOT ; ifileKey += ( suffix == null || suffix . trim ( ) . length ( ) == 0 ) ? DEFAULT_INSTRUCTION_FILE_SUFFIX : suffix ; return new InstructionFileId ( bucket , ifileKey , versionId ) ; }
Returns the instruction file id of an instruction file with the given suffix .
31,059
public Waiter < GetPasswordDataRequest > passwordDataAvailable ( ) { return new WaiterBuilder < GetPasswordDataRequest , GetPasswordDataResult > ( ) . withSdkFunction ( new GetPasswordDataFunction ( client ) ) . withAcceptors ( new PasswordDataAvailable . IsTrueMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a PasswordDataAvailable waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,060
public Waiter < DescribeVolumesRequest > volumeInUse ( ) { return new WaiterBuilder < DescribeVolumesRequest , DescribeVolumesResult > ( ) . withSdkFunction ( new DescribeVolumesFunction ( client ) ) . withAcceptors ( new VolumeInUse . IsInuseMatcher ( ) , new VolumeInUse . IsDeletedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a VolumeInUse waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,061
public Waiter < DescribeImagesRequest > imageAvailable ( ) { return new WaiterBuilder < DescribeImagesRequest , DescribeImagesResult > ( ) . withSdkFunction ( new DescribeImagesFunction ( client ) ) . withAcceptors ( new ImageAvailable . IsAvailableMatcher ( ) , new ImageAvailable . IsFailedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a ImageAvailable waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,062
public Waiter < DescribeNetworkInterfacesRequest > networkInterfaceAvailable ( ) { return new WaiterBuilder < DescribeNetworkInterfacesRequest , DescribeNetworkInterfacesResult > ( ) . withSdkFunction ( new DescribeNetworkInterfacesFunction ( client ) ) . withAcceptors ( new NetworkInterfaceAvailable . IsAvailableMatcher ( ) , new NetworkInterfaceAvailable . IsInvalidNetworkInterfaceIDNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 10 ) , new FixedDelayStrategy ( 20 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a NetworkInterfaceAvailable waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,063
public Waiter < DescribeInstanceStatusRequest > systemStatusOk ( ) { return new WaiterBuilder < DescribeInstanceStatusRequest , DescribeInstanceStatusResult > ( ) . withSdkFunction ( new DescribeInstanceStatusFunction ( client ) ) . withAcceptors ( new SystemStatusOk . IsOkMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a SystemStatusOk waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,064
public Waiter < DescribeVpcPeeringConnectionsRequest > vpcPeeringConnectionExists ( ) { return new WaiterBuilder < DescribeVpcPeeringConnectionsRequest , DescribeVpcPeeringConnectionsResult > ( ) . withSdkFunction ( new DescribeVpcPeeringConnectionsFunction ( client ) ) . withAcceptors ( new HttpSuccessStatusAcceptor ( WaiterState . SUCCESS ) , new VpcPeeringConnectionExists . IsInvalidVpcPeeringConnectionIDNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a VpcPeeringConnectionExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,065
public Waiter < DescribeVolumesRequest > volumeAvailable ( ) { return new WaiterBuilder < DescribeVolumesRequest , DescribeVolumesResult > ( ) . withSdkFunction ( new DescribeVolumesFunction ( client ) ) . withAcceptors ( new VolumeAvailable . IsAvailableMatcher ( ) , new VolumeAvailable . IsDeletedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a VolumeAvailable waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,066
public Waiter < DescribeInstanceStatusRequest > instanceStatusOk ( ) { return new WaiterBuilder < DescribeInstanceStatusRequest , DescribeInstanceStatusResult > ( ) . withSdkFunction ( new DescribeInstanceStatusFunction ( client ) ) . withAcceptors ( new InstanceStatusOk . IsOkMatcher ( ) , new InstanceStatusOk . IsInvalidInstanceIDNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a InstanceStatusOk waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,067
public Waiter < DescribeVolumesRequest > volumeDeleted ( ) { return new WaiterBuilder < DescribeVolumesRequest , DescribeVolumesResult > ( ) . withSdkFunction ( new DescribeVolumesFunction ( client ) ) . withAcceptors ( new VolumeDeleted . IsDeletedMatcher ( ) , new VolumeDeleted . IsInvalidVolumeNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a VolumeDeleted waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,068
public Waiter < DescribeCustomerGatewaysRequest > customerGatewayAvailable ( ) { return new WaiterBuilder < DescribeCustomerGatewaysRequest , DescribeCustomerGatewaysResult > ( ) . withSdkFunction ( new DescribeCustomerGatewaysFunction ( client ) ) . withAcceptors ( new CustomerGatewayAvailable . IsAvailableMatcher ( ) , new CustomerGatewayAvailable . IsDeletedMatcher ( ) , new CustomerGatewayAvailable . IsDeletingMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a CustomerGatewayAvailable waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,069
public Waiter < DescribeNatGatewaysRequest > natGatewayAvailable ( ) { return new WaiterBuilder < DescribeNatGatewaysRequest , DescribeNatGatewaysResult > ( ) . withSdkFunction ( new DescribeNatGatewaysFunction ( client ) ) . withAcceptors ( new NatGatewayAvailable . IsAvailableMatcher ( ) , new NatGatewayAvailable . IsFailedMatcher ( ) , new NatGatewayAvailable . IsDeletingMatcher ( ) , new NatGatewayAvailable . IsDeletedMatcher ( ) , new NatGatewayAvailable . IsNatGatewayNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a NatGatewayAvailable waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,070
public Waiter < DescribeVpcsRequest > vpcExists ( ) { return new WaiterBuilder < DescribeVpcsRequest , DescribeVpcsResult > ( ) . withSdkFunction ( new DescribeVpcsFunction ( client ) ) . withAcceptors ( new HttpSuccessStatusAcceptor ( WaiterState . SUCCESS ) , new VpcExists . IsInvalidVpcIDNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 5 ) , new FixedDelayStrategy ( 1 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a VpcExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,071
public Waiter < DescribeConversionTasksRequest > conversionTaskDeleted ( ) { return new WaiterBuilder < DescribeConversionTasksRequest , DescribeConversionTasksResult > ( ) . withSdkFunction ( new DescribeConversionTasksFunction ( client ) ) . withAcceptors ( new ConversionTaskDeleted . IsDeletedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a ConversionTaskDeleted waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,072
public Waiter < DescribeImagesRequest > imageExists ( ) { return new WaiterBuilder < DescribeImagesRequest , DescribeImagesResult > ( ) . withSdkFunction ( new DescribeImagesFunction ( client ) ) . withAcceptors ( new ImageExists . IsTrueMatcher ( ) , new ImageExists . IsInvalidAMIIDNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a ImageExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,073
public Waiter < DescribeVpcsRequest > vpcAvailable ( ) { return new WaiterBuilder < DescribeVpcsRequest , DescribeVpcsResult > ( ) . withSdkFunction ( new DescribeVpcsFunction ( client ) ) . withAcceptors ( new VpcAvailable . IsAvailableMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a VpcAvailable waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,074
public Waiter < DescribeVpcPeeringConnectionsRequest > vpcPeeringConnectionDeleted ( ) { return new WaiterBuilder < DescribeVpcPeeringConnectionsRequest , DescribeVpcPeeringConnectionsResult > ( ) . withSdkFunction ( new DescribeVpcPeeringConnectionsFunction ( client ) ) . withAcceptors ( new VpcPeeringConnectionDeleted . IsDeletedMatcher ( ) , new VpcPeeringConnectionDeleted . IsInvalidVpcPeeringConnectionIDNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a VpcPeeringConnectionDeleted waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,075
public Waiter < DescribeConversionTasksRequest > conversionTaskCancelled ( ) { return new WaiterBuilder < DescribeConversionTasksRequest , DescribeConversionTasksResult > ( ) . withSdkFunction ( new DescribeConversionTasksFunction ( client ) ) . withAcceptors ( new ConversionTaskCancelled . IsCancelledMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a ConversionTaskCancelled waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,076
public Waiter < DescribeInstancesRequest > instanceExists ( ) { return new WaiterBuilder < DescribeInstancesRequest , DescribeInstancesResult > ( ) . withSdkFunction ( new DescribeInstancesFunction ( client ) ) . withAcceptors ( new InstanceExists . IsTrueMatcher ( ) , new InstanceExists . IsInvalidInstanceIDNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 5 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a InstanceExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,077
public Waiter < DescribeConversionTasksRequest > conversionTaskCompleted ( ) { return new WaiterBuilder < DescribeConversionTasksRequest , DescribeConversionTasksResult > ( ) . withSdkFunction ( new DescribeConversionTasksFunction ( client ) ) . withAcceptors ( new ConversionTaskCompleted . IsCompletedMatcher ( ) , new ConversionTaskCompleted . IsCancelledMatcher ( ) , new ConversionTaskCompleted . IsCancellingMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a ConversionTaskCompleted waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,078
public Waiter < DescribeKeyPairsRequest > keyPairExists ( ) { return new WaiterBuilder < DescribeKeyPairsRequest , DescribeKeyPairsResult > ( ) . withSdkFunction ( new DescribeKeyPairsFunction ( client ) ) . withAcceptors ( new KeyPairExists . IsTrueMatcher ( ) , new KeyPairExists . IsInvalidKeyPairNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 6 ) , new FixedDelayStrategy ( 5 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a KeyPairExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,079
public Waiter < DescribeSpotInstanceRequestsRequest > spotInstanceRequestFulfilled ( ) { return new WaiterBuilder < DescribeSpotInstanceRequestsRequest , DescribeSpotInstanceRequestsResult > ( ) . withSdkFunction ( new DescribeSpotInstanceRequestsFunction ( client ) ) . withAcceptors ( new SpotInstanceRequestFulfilled . IsFulfilledMatcher ( ) , new SpotInstanceRequestFulfilled . IsRequestcanceledandinstancerunningMatcher ( ) , new SpotInstanceRequestFulfilled . IsScheduleexpiredMatcher ( ) , new SpotInstanceRequestFulfilled . IsCanceledbeforefulfillmentMatcher ( ) , new SpotInstanceRequestFulfilled . IsBadparametersMatcher ( ) , new SpotInstanceRequestFulfilled . IsSystemerrorMatcher ( ) , new SpotInstanceRequestFulfilled . IsInvalidSpotInstanceRequestIDNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a SpotInstanceRequestFulfilled waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,080
public Waiter < DescribeBundleTasksRequest > bundleTaskComplete ( ) { return new WaiterBuilder < DescribeBundleTasksRequest , DescribeBundleTasksResult > ( ) . withSdkFunction ( new DescribeBundleTasksFunction ( client ) ) . withAcceptors ( new BundleTaskComplete . IsCompleteMatcher ( ) , new BundleTaskComplete . IsFailedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a BundleTaskComplete waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,081
public Waiter < DescribeInstancesRequest > instanceRunning ( ) { return new WaiterBuilder < DescribeInstancesRequest , DescribeInstancesResult > ( ) . withSdkFunction ( new DescribeInstancesFunction ( client ) ) . withAcceptors ( new InstanceRunning . IsRunningMatcher ( ) , new InstanceRunning . IsShuttingdownMatcher ( ) , new InstanceRunning . IsTerminatedMatcher ( ) , new InstanceRunning . IsStoppingMatcher ( ) , new InstanceRunning . IsInvalidInstanceIDNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a InstanceRunning waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,082
public Waiter < DescribeExportTasksRequest > exportTaskCompleted ( ) { return new WaiterBuilder < DescribeExportTasksRequest , DescribeExportTasksResult > ( ) . withSdkFunction ( new DescribeExportTasksFunction ( client ) ) . withAcceptors ( new ExportTaskCompleted . IsCompletedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a ExportTaskCompleted waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,083
public Waiter < DescribeSnapshotsRequest > snapshotCompleted ( ) { return new WaiterBuilder < DescribeSnapshotsRequest , DescribeSnapshotsResult > ( ) . withSdkFunction ( new DescribeSnapshotsFunction ( client ) ) . withAcceptors ( new SnapshotCompleted . IsCompletedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a SnapshotCompleted waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,084
public Waiter < DescribeExportTasksRequest > exportTaskCancelled ( ) { return new WaiterBuilder < DescribeExportTasksRequest , DescribeExportTasksResult > ( ) . withSdkFunction ( new DescribeExportTasksFunction ( client ) ) . withAcceptors ( new ExportTaskCancelled . IsCancelledMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a ExportTaskCancelled waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,085
public Waiter < DescribeVpnConnectionsRequest > vpnConnectionDeleted ( ) { return new WaiterBuilder < DescribeVpnConnectionsRequest , DescribeVpnConnectionsResult > ( ) . withSdkFunction ( new DescribeVpnConnectionsFunction ( client ) ) . withAcceptors ( new VpnConnectionDeleted . IsDeletedMatcher ( ) , new VpnConnectionDeleted . IsPendingMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a VpnConnectionDeleted waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,086
public Waiter < DescribeVpnConnectionsRequest > vpnConnectionAvailable ( ) { return new WaiterBuilder < DescribeVpnConnectionsRequest , DescribeVpnConnectionsResult > ( ) . withSdkFunction ( new DescribeVpnConnectionsFunction ( client ) ) . withAcceptors ( new VpnConnectionAvailable . IsAvailableMatcher ( ) , new VpnConnectionAvailable . IsDeletingMatcher ( ) , new VpnConnectionAvailable . IsDeletedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a VpnConnectionAvailable waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,087
public Waiter < DescribeSubnetsRequest > subnetAvailable ( ) { return new WaiterBuilder < DescribeSubnetsRequest , DescribeSubnetsResult > ( ) . withSdkFunction ( new DescribeSubnetsFunction ( client ) ) . withAcceptors ( new SubnetAvailable . IsAvailableMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a SubnetAvailable waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
31,088
String buildUpdateExpression ( SubstitutionContext context ) { StringBuilder sb = new StringBuilder ( ) ; for ( Map . Entry < String , List < UpdateAction > > e : updates . entrySet ( ) ) { boolean firstOfUpdateType = true ; for ( UpdateAction expr : e . getValue ( ) ) { if ( firstOfUpdateType ) { firstOfUpdateType = false ; final String operator = e . getKey ( ) ; if ( sb . length ( ) > 0 ) sb . append ( " " ) ; sb . append ( operator ) . append ( " " ) ; } else { sb . append ( ", " ) ; } sb . append ( expr . asSubstituted ( context ) ) ; } } return sb . toString ( ) ; }
Builds and returns the update expression to be used in a dynamodb request ; or null if there is none .
31,089
String buildProjectionExpression ( SubstitutionContext context ) { if ( projections . size ( ) == 0 ) return null ; StringBuilder sb = new StringBuilder ( ) ; for ( PathOperand projection : projections ) { if ( sb . length ( ) > 0 ) sb . append ( ", " ) ; sb . append ( projection . asSubstituted ( context ) ) ; } return sb . toString ( ) ; }
Builds and returns the projection expression to be used in a dynamodb GetItem request ; or null if there is none .
31,090
String buildConditionExpression ( SubstitutionContext context ) { return condition == null ? null : condition . asSubstituted ( context ) ; }
Builds and returns the condition expression to be used in a dynamodb request ; or null if there is none .
31,091
String buildKeyConditionExpression ( SubstitutionContext context ) { return keyCondition == null ? null : keyCondition . asSubstituted ( context ) ; }
Builds and returns the key condition expression to be used in a dynamodb query request ; or null if there is none .
31,092
public static String urlDecode ( final String value ) { if ( value == null ) { return null ; } try { return URLDecoder . decode ( value , DEFAULT_ENCODING ) ; } catch ( UnsupportedEncodingException ex ) { throw new RuntimeException ( ex ) ; } }
Decode a string for use in the path of a URL ; uses URLDecoder . decode which decodes a string for use in the query portion of a URL .
31,093
public static String encodeParameters ( SignableRequest < ? > request ) { final Map < String , List < String > > requestParams = request . getParameters ( ) ; if ( requestParams . isEmpty ( ) ) return null ; final List < NameValuePair > nameValuePairs = new ArrayList < NameValuePair > ( ) ; for ( Entry < String , List < String > > entry : requestParams . entrySet ( ) ) { String parameterName = entry . getKey ( ) ; for ( String value : entry . getValue ( ) ) { nameValuePairs . add ( new BasicNameValuePair ( parameterName , value ) ) ; } } return URLEncodedUtils . format ( nameValuePairs , DEFAULT_ENCODING ) ; }
Creates an encoded query string from all the parameters in the specified request .
31,094
public static String appendUri ( String baseUri , String path ) { return appendUri ( baseUri , path , false ) ; }
Append the given path to the given baseUri . By default all slash characters in path will not be url - encoded .
31,095
public void setBrokerEngineTypes ( java . util . Collection < BrokerEngineType > brokerEngineTypes ) { if ( brokerEngineTypes == null ) { this . brokerEngineTypes = null ; return ; } this . brokerEngineTypes = new java . util . ArrayList < BrokerEngineType > ( brokerEngineTypes ) ; }
List of available engine types and versions .
31,096
public void setBrokerInstanceOptions ( java . util . Collection < BrokerInstanceOption > brokerInstanceOptions ) { if ( brokerInstanceOptions == null ) { this . brokerInstanceOptions = null ; return ; } this . brokerInstanceOptions = new java . util . ArrayList < BrokerInstanceOption > ( brokerInstanceOptions ) ; }
List of available broker instance options .
31,097
public ServerSideEncryptionByDefault withSSEAlgorithm ( SSEAlgorithm sseAlgorithm ) { setSSEAlgorithm ( sseAlgorithm == null ? null : sseAlgorithm . toString ( ) ) ; return this ; }
Sets the server - side encryption algorithm to use for the default encryption .
31,098
public void setInsertableImages ( java . util . Collection < InsertableImage > insertableImages ) { if ( insertableImages == null ) { this . insertableImages = null ; return ; } this . insertableImages = new java . util . ArrayList < InsertableImage > ( insertableImages ) ; }
Specify the images that you want to overlay on your video . The images must be PNG or TGA files .
31,099
public static String addStaticQueryParamtersToRequest ( final Request < ? > request , final String uriResourcePath ) { if ( request == null || uriResourcePath == null ) { return null ; } String resourcePath = uriResourcePath ; int index = resourcePath . indexOf ( "?" ) ; if ( index != - 1 ) { String queryString = resourcePath . substring ( index + 1 ) ; resourcePath = resourcePath . substring ( 0 , index ) ; for ( String s : queryString . split ( "[;&]" ) ) { index = s . indexOf ( "=" ) ; if ( index != - 1 ) { request . addParameter ( s . substring ( 0 , index ) , s . substring ( index + 1 ) ) ; } else { request . addParameter ( s , ( String ) null ) ; } } } return resourcePath ; }
Identifies the static query parameters in Uri resource path for and adds it to request .