idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
30,500 | public java . util . concurrent . Future < SwapEnvironmentCNAMEsResult > swapEnvironmentCNAMEsAsync ( com . amazonaws . handlers . AsyncHandler < SwapEnvironmentCNAMEsRequest , SwapEnvironmentCNAMEsResult > asyncHandler ) { return swapEnvironmentCNAMEsAsync ( new SwapEnvironmentCNAMEsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the SwapEnvironmentCNAMEs operation with an AsyncHandler . |
30,501 | public TableWriteItems withPrimaryKeysToDelete ( PrimaryKey ... primaryKeysToDelete ) { if ( primaryKeysToDelete == null ) this . primaryKeysToDelete = null ; else { Set < String > pkNameSet = null ; for ( PrimaryKey pk : primaryKeysToDelete ) { if ( pkNameSet == null ) pkNameSet = pk . getComponentNameSet ( ) ; else { if ( ! pkNameSet . equals ( pk . getComponentNameSet ( ) ) ) { throw new IllegalArgumentException ( "primary key attribute names must be consistent for the specified primary keys" ) ; } } } this . primaryKeysToDelete = new ArrayList < PrimaryKey > ( Arrays . asList ( primaryKeysToDelete ) ) ; } return this ; } | Used to specify multiple primary keys to be deleted from the current table . A primary key could consist of either a hash - key or both a hash - key and a range - key depending on the schema of the table . |
30,502 | public TableWriteItems withHashOnlyKeysToDelete ( String hashKeyName , Object ... hashKeyValues ) { if ( hashKeyName == null ) throw new IllegalArgumentException ( ) ; PrimaryKey [ ] primaryKeys = new PrimaryKey [ hashKeyValues . length ] ; for ( int i = 0 ; i < hashKeyValues . length ; i ++ ) primaryKeys [ i ] = new PrimaryKey ( hashKeyName , hashKeyValues [ i ] ) ; return withPrimaryKeysToDelete ( primaryKeys ) ; } | Used to specify multiple hash - only primary keys to be deleted from the current table . |
30,503 | public TableWriteItems withHashAndRangeKeysToDelete ( String hashKeyName , String rangeKeyName , Object ... alternatingHashAndRangeKeyValues ) { if ( hashKeyName == null ) throw new IllegalArgumentException ( "hash key name must be specified" ) ; if ( rangeKeyName == null ) throw new IllegalArgumentException ( "range key name must be specified" ) ; if ( alternatingHashAndRangeKeyValues . length % 2 != 0 ) throw new IllegalArgumentException ( "number of hash and range key values must be the same" ) ; final int len = alternatingHashAndRangeKeyValues . length / 2 ; PrimaryKey [ ] primaryKeys = new PrimaryKey [ len ] ; for ( int i = 0 ; i < alternatingHashAndRangeKeyValues . length ; i += 2 ) { primaryKeys [ i >> 1 ] = new PrimaryKey ( hashKeyName , alternatingHashAndRangeKeyValues [ i ] , rangeKeyName , alternatingHashAndRangeKeyValues [ i + 1 ] ) ; } return withPrimaryKeysToDelete ( primaryKeys ) ; } | Used to specify multiple hash - and - range primary keys to be deleted from the current table . |
30,504 | public TableWriteItems addPrimaryKeyToDelete ( PrimaryKey primaryKey ) { if ( primaryKey != null ) { if ( primaryKeysToDelete == null ) primaryKeysToDelete = new ArrayList < PrimaryKey > ( ) ; checkConsistency ( primaryKey ) ; this . primaryKeysToDelete . add ( primaryKey ) ; } return this ; } | Adds a primary key to be deleted in a batch write - item operation . A primary key could consist of either a hash - key or both a hash - key and a range - key depending on the schema of the table . |
30,505 | public TableWriteItems addHashOnlyPrimaryKeyToDelete ( String hashKeyName , Object hashKeyValue ) { this . addPrimaryKeyToDelete ( new PrimaryKey ( hashKeyName , hashKeyValue ) ) ; return this ; } | Adds a hash - only primary key to be deleted in a batch write operation . |
30,506 | public TableWriteItems addHashOnlyPrimaryKeysToDelete ( String hashKeyName , Object ... hashKeyValues ) { for ( Object hashKeyValue : hashKeyValues ) { this . addPrimaryKeyToDelete ( new PrimaryKey ( hashKeyName , hashKeyValue ) ) ; } return this ; } | Adds multiple hash - only primary keys to be deleted in a batch write operation . |
30,507 | public TableWriteItems addHashAndRangePrimaryKeysToDelete ( String hashKeyName , String rangeKeyName , Object ... alternatingHashRangeKeyValues ) { if ( alternatingHashRangeKeyValues . length % 2 != 0 ) { throw new IllegalArgumentException ( "The multiple hash and range key values must alternate" ) ; } for ( int i = 0 ; i < alternatingHashRangeKeyValues . length ; i += 2 ) { Object hashKeyValue = alternatingHashRangeKeyValues [ i ] ; Object rangeKeyValue = alternatingHashRangeKeyValues [ i + 1 ] ; this . addPrimaryKeyToDelete ( new PrimaryKey ( ) . addComponent ( hashKeyName , hashKeyValue ) . addComponent ( rangeKeyName , rangeKeyValue ) ) ; } return this ; } | Adds multiple hash - and - range primary keys to be deleted in a batch write operation . |
30,508 | public TableWriteItems withItemsToPut ( Item ... itemsToPut ) { if ( itemsToPut == null ) this . itemsToPut = null ; else this . itemsToPut = new ArrayList < Item > ( Arrays . asList ( itemsToPut ) ) ; return this ; } | Used to specify the items to be put in the current table in a batch write operation . |
30,509 | public TableWriteItems withItemsToPut ( Collection < Item > itemsToPut ) { if ( itemsToPut == null ) this . itemsToPut = null ; else this . itemsToPut = new ArrayList < Item > ( itemsToPut ) ; return this ; } | Used to specify the collection of items to be put in the current table in a batch write operation . |
30,510 | public TableWriteItems addItemToPut ( Item item ) { if ( item != null ) { if ( itemsToPut == null ) itemsToPut = new ArrayList < Item > ( ) ; this . itemsToPut . add ( item ) ; } return this ; } | Adds an item to be put to the current table in a batch write operation . |
30,511 | public void setEq ( java . util . Collection < String > eq ) { if ( eq == null ) { this . eq = null ; return ; } this . eq = new java . util . ArrayList < String > ( eq ) ; } | Represents the equal condition to be applied to a single field when querying for findings . |
30,512 | public void setNeq ( java . util . Collection < String > neq ) { if ( neq == null ) { this . neq = null ; return ; } this . neq = new java . util . ArrayList < String > ( neq ) ; } | Represents the not equal condition to be applied to a single field when querying for findings . |
30,513 | public void waitForCompletion ( ) throws AmazonClientException , AmazonServiceException , InterruptedException { try { Object result = null ; while ( ! monitor . isDone ( ) || result == null ) { Future < ? > f = monitor . getFuture ( ) ; result = f . get ( ) ; } } catch ( ExecutionException e ) { rethrowExecutionException ( e ) ; } } | Waits for this transfer to complete . This is a blocking call ; the current thread is suspended until this transfer completes . |
30,514 | public void setState ( TransferState state ) { synchronized ( this ) { this . state = state ; } for ( TransferStateChangeListener listener : stateChangeListeners ) { listener . transferStateChanged ( this , state ) ; } } | Sets the current state of this transfer . |
30,515 | protected AmazonClientException unwrapExecutionException ( ExecutionException e ) { Throwable t = e ; while ( t . getCause ( ) != null && t instanceof ExecutionException ) { t = t . getCause ( ) ; } if ( t instanceof AmazonClientException ) { return ( AmazonClientException ) t ; } return new AmazonClientException ( "Unable to complete transfer: " + t . getMessage ( ) , t ) ; } | Unwraps the root exception that caused the specified ExecutionException and returns it . If it was not an instance of AmazonClientException it is wrapped as an AmazonClientException . |
30,516 | public String getDecodedOutput ( ) { byte [ ] bytes = com . amazonaws . util . BinaryUtils . fromBase64 ( output ) ; return new String ( bytes , com . amazonaws . util . StringUtils . UTF8 ) ; } | The decoded console output . |
30,517 | public CreateApplicationRequest withTags ( java . util . Map < String , String > tags ) { setTags ( tags ) ; return this ; } | The Tags for the app . |
30,518 | private static void decodeAckEvent ( ByteBuf in , List < Object > decodedOut ) throws IOException { int readerIndex = in . readerIndex ( ) ; int writerIndex = in . writerIndex ( ) ; for ( ; readerIndex < writerIndex ; ++ readerIndex ) { byte c = in . getByte ( readerIndex ) ; if ( NEW_LINE == c ) { ByteBuf json = extractObject ( in , in . readerIndex ( ) , readerIndex - in . readerIndex ( ) ) ; if ( json != null ) { decodedOut . add ( unmarshall ( json ) ) ; } in . readerIndex ( readerIndex + 1 ) ; in . discardReadBytes ( ) ; readerIndex = in . readerIndex ( ) ; writerIndex = in . writerIndex ( ) ; ReferenceCountUtil . release ( json ) ; } } } | Decode ByteBuf to AckEvent objects . |
30,519 | public AddFlowOutputsResult addFlowOutputs ( AddFlowOutputsRequest request ) { request = beforeClientExecution ( request ) ; return executeAddFlowOutputs ( request ) ; } | Adds outputs to an existing flow . You can create up to 20 outputs per flow . |
30,520 | public DeleteFlowResult deleteFlow ( DeleteFlowRequest request ) { request = beforeClientExecution ( request ) ; return executeDeleteFlow ( request ) ; } | Deletes a flow . Before you can delete a flow you must stop the flow . |
30,521 | public DescribeFlowResult describeFlow ( DescribeFlowRequest request ) { request = beforeClientExecution ( request ) ; return executeDescribeFlow ( request ) ; } | Displays the details of a flow . The response includes the flow ARN name and Availability Zone as well as details about the source outputs and entitlements . |
30,522 | public GrantFlowEntitlementsResult grantFlowEntitlements ( GrantFlowEntitlementsRequest request ) { request = beforeClientExecution ( request ) ; return executeGrantFlowEntitlements ( request ) ; } | Grants entitlements to an existing flow . |
30,523 | public ListEntitlementsResult listEntitlements ( ListEntitlementsRequest request ) { request = beforeClientExecution ( request ) ; return executeListEntitlements ( request ) ; } | Displays a list of all entitlements that have been granted to this account . This request returns 20 results per page . |
30,524 | public ListFlowsResult listFlows ( ListFlowsRequest request ) { request = beforeClientExecution ( request ) ; return executeListFlows ( request ) ; } | Displays a list of flows that are associated with this account . This request returns a paginated result . |
30,525 | public RemoveFlowOutputResult removeFlowOutput ( RemoveFlowOutputRequest request ) { request = beforeClientExecution ( request ) ; return executeRemoveFlowOutput ( request ) ; } | Removes an output from an existing flow . This request can be made only on an output that does not have an entitlement associated with it . If the output has an entitlement you must revoke the entitlement instead . When an entitlement is revoked from a flow the service automatically removes the associated output . |
30,526 | public RevokeFlowEntitlementResult revokeFlowEntitlement ( RevokeFlowEntitlementRequest request ) { request = beforeClientExecution ( request ) ; return executeRevokeFlowEntitlement ( request ) ; } | Revokes an entitlement from a flow . Once an entitlement is revoked the content becomes unavailable to the subscriber and the associated output is removed . |
30,527 | public StartFlowResult startFlow ( StartFlowRequest request ) { request = beforeClientExecution ( request ) ; return executeStartFlow ( request ) ; } | Starts a flow . |
30,528 | public StopFlowResult stopFlow ( StopFlowRequest request ) { request = beforeClientExecution ( request ) ; return executeStopFlow ( request ) ; } | Stops a flow . |
30,529 | public UpdateFlowEntitlementResult updateFlowEntitlement ( UpdateFlowEntitlementRequest request ) { request = beforeClientExecution ( request ) ; return executeUpdateFlowEntitlement ( request ) ; } | You can change an entitlement s description subscribers and encryption . If you change the subscribers the service will remove the outputs that are are used by the subscribers that are removed . |
30,530 | public UpdateFlowOutputResult updateFlowOutput ( UpdateFlowOutputRequest request ) { request = beforeClientExecution ( request ) ; return executeUpdateFlowOutput ( request ) ; } | Updates an existing flow output . |
30,531 | public UpdateFlowSourceResult updateFlowSource ( UpdateFlowSourceRequest request ) { request = beforeClientExecution ( request ) ; return executeUpdateFlowSource ( request ) ; } | Updates the source of a flow . |
30,532 | private static void speedUpDTMManager ( ) throws Exception { if ( System . getProperty ( DTM_MANAGER_DEFAULT_PROP_NAME ) == null ) { Class < ? > XPathContextClass = Class . forName ( XPATH_CONTEXT_CLASS_NAME ) ; Method getDTMManager = XPathContextClass . getMethod ( "getDTMManager" ) ; Object XPathContext = XPathContextClass . newInstance ( ) ; Object dtmManager = getDTMManager . invoke ( XPathContext ) ; if ( DTM_MANAGER_IMPL_CLASS_NAME . equals ( dtmManager . getClass ( ) . getName ( ) ) ) { System . setProperty ( DTM_MANAGER_DEFAULT_PROP_NAME , DTM_MANAGER_IMPL_CLASS_NAME ) ; } } } | Used to optimize performance by avoiding expensive file access every time a DTMManager is constructed as a result of constructing a Xalan xpath context! |
30,533 | private static void speedUpDcoumentBuilderFactory ( ) { if ( System . getProperty ( DOCUMENT_BUILDER_FACTORY_PROP_NAME ) == null ) { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; if ( DOCUMENT_BUILDER_FACTORY_IMPL_CLASS_NAME . equals ( factory . getClass ( ) . getName ( ) ) ) { System . setProperty ( DOCUMENT_BUILDER_FACTORY_PROP_NAME , DOCUMENT_BUILDER_FACTORY_IMPL_CLASS_NAME ) ; } } } | Used to optimize performance by avoiding expensive file access every time a DocumentBuilderFactory is constructed as a result of constructing a Xalan document factory . |
30,534 | public static Document documentFrom ( InputStream is ) throws SAXException , IOException , ParserConfigurationException { is = new NamespaceRemovingInputStream ( is ) ; DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; builder . setErrorHandler ( ERROR_HANDLER ) ; Document doc = builder . parse ( is ) ; is . close ( ) ; return doc ; } | This method closes the given input stream upon completion . |
30,535 | public static Node asNode ( String nodeName , Node node ) throws XPathExpressionException { return asNode ( nodeName , node , xpath ( ) ) ; } | Evaluates the specified XPath expression and returns the result as a Node . |
30,536 | private static String evaluateAsString ( String expression , Node node , XPath xpath ) throws XPathExpressionException { if ( isEmpty ( node ) ) return null ; if ( ! expression . equals ( "." ) ) { if ( asNode ( expression , node , xpath ) == null ) return null ; } String s = xpath . evaluate ( expression , node ) ; return s . trim ( ) ; } | Evaluates the specified expression on the specified node and returns the result as a String . |
30,537 | final boolean hasEncryptionInfo ( ) { ObjectMetadata metadata = s3obj . getObjectMetadata ( ) ; Map < String , String > userMeta = metadata . getUserMetadata ( ) ; return userMeta != null && userMeta . containsKey ( Headers . CRYPTO_IV ) && ( userMeta . containsKey ( Headers . CRYPTO_KEY_V2 ) || userMeta . containsKey ( Headers . CRYPTO_KEY ) ) ; } | Returns true if this S3 object has the encryption information stored as user meta data ; false otherwise . |
30,538 | String toJsonString ( ) { try { return from ( s3obj . getObjectContent ( ) ) ; } catch ( Exception e ) { throw new SdkClientException ( "Error parsing JSON: " + e . getMessage ( ) ) ; } } | Converts and return the underlying S3 object as a json string . |
30,539 | ContentCryptoScheme encryptionSchemeOf ( Map < String , String > instructionFile ) { if ( instructionFile != null ) { String cekAlgo = instructionFile . get ( Headers . CRYPTO_CEK_ALGORITHM ) ; return ContentCryptoScheme . fromCEKAlgo ( cekAlgo ) ; } ObjectMetadata meta = s3obj . getObjectMetadata ( ) ; Map < String , String > userMeta = meta . getUserMetadata ( ) ; String cekAlgo = userMeta . get ( Headers . CRYPTO_CEK_ALGORITHM ) ; return ContentCryptoScheme . fromCEKAlgo ( cekAlgo ) ; } | Returns the original crypto scheme used for encryption which may differ from the crypto scheme used for decryption during for example a range - get operation . |
30,540 | public void setCaptionLanguageMappings ( java . util . Collection < HlsCaptionLanguageMapping > captionLanguageMappings ) { if ( captionLanguageMappings == null ) { this . captionLanguageMappings = null ; return ; } this . captionLanguageMappings = new java . util . ArrayList < HlsCaptionLanguageMapping > ( captionLanguageMappings ) ; } | Language to be used on Caption outputs |
30,541 | public Waiter < GetDistributionRequest > distributionDeployed ( ) { return new WaiterBuilder < GetDistributionRequest , GetDistributionResult > ( ) . withSdkFunction ( new GetDistributionFunction ( client ) ) . withAcceptors ( new DistributionDeployed . IsDeployedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 25 ) , new FixedDelayStrategy ( 60 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a DistributionDeployed 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 . |
30,542 | public Waiter < GetStreamingDistributionRequest > streamingDistributionDeployed ( ) { return new WaiterBuilder < GetStreamingDistributionRequest , GetStreamingDistributionResult > ( ) . withSdkFunction ( new GetStreamingDistributionFunction ( client ) ) . withAcceptors ( new StreamingDistributionDeployed . IsDeployedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 25 ) , new FixedDelayStrategy ( 60 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a StreamingDistributionDeployed 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 . |
30,543 | public Waiter < GetInvalidationRequest > invalidationCompleted ( ) { return new WaiterBuilder < GetInvalidationRequest , GetInvalidationResult > ( ) . withSdkFunction ( new GetInvalidationFunction ( client ) ) . withAcceptors ( new InvalidationCompleted . IsCompletedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 30 ) , new FixedDelayStrategy ( 20 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a InvalidationCompleted 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 . |
30,544 | public void setMediaConnectFlows ( java . util . Collection < MediaConnectFlow > mediaConnectFlows ) { if ( mediaConnectFlows == null ) { this . mediaConnectFlows = null ; return ; } this . mediaConnectFlows = new java . util . ArrayList < MediaConnectFlow > ( mediaConnectFlows ) ; } | A list of MediaConnect Flows for this input . |
30,545 | public void setSecurityGroups ( java . util . Collection < String > securityGroups ) { if ( securityGroups == null ) { this . securityGroups = null ; return ; } this . securityGroups = new java . util . ArrayList < String > ( securityGroups ) ; } | A list of IDs for all the Input Security Groups attached to the input . |
30,546 | public String visit ( final JmesPathSubExpression subExpression , final Void aVoid ) throws InvalidTypeException { final String prefix = "new JmesPathSubExpression( " ; return subExpression . getExpressions ( ) . stream ( ) . map ( a -> a . accept ( this , aVoid ) ) . collect ( Collectors . joining ( "," , prefix , ")" ) ) ; } | Generates the code for a new JmesPathSubExpression . |
30,547 | public String visit ( final JmesPathProjection jmesPathProjection , final Void aVoid ) throws InvalidTypeException { return "new JmesPathProjection( " + jmesPathProjection . getLhsExpr ( ) . accept ( this , aVoid ) + ", " + jmesPathProjection . getProjectionExpr ( ) . accept ( this , aVoid ) + ")" ; } | Generates the code for a new JmesPathProjection . |
30,548 | public String visit ( final JmesPathFlatten flatten , final Void aVoid ) throws InvalidTypeException { return "new JmesPathFlatten( " + flatten . getFlattenExpr ( ) . accept ( this , aVoid ) + ")" ; } | Generates the code for a new JmesPathFlatten . |
30,549 | public String visit ( final JmesPathValueProjection valueProjection , final Void aVoid ) throws InvalidTypeException { return "new JmesPathValueProjection( " + valueProjection . getLhsExpr ( ) . accept ( this , aVoid ) + ", " + valueProjection . getRhsExpr ( ) . accept ( this , aVoid ) + ")" ; } | Generates the code for a new JmesPathValueProjection . |
30,550 | public String visit ( final JmesPathLiteral literal , final Void aVoid ) { return "new JmesPathLiteral(\"" + StringEscapeUtils . escapeJava ( literal . getValue ( ) . toString ( ) ) + "\")" ; } | Generates the code for a new JmesPathLiteral . |
30,551 | public String visit ( final JmesPathFilter filter , final Void aVoid ) throws InvalidTypeException { return "new JmesPathFilter( " + filter . getLhsExpr ( ) . accept ( this , aVoid ) + ", " + filter . getRhsExpr ( ) . accept ( this , aVoid ) + ", " + filter . getComparator ( ) . accept ( this , aVoid ) + ")" ; } | Generates the code for a new JmesPathFilter . |
30,552 | public String visit ( final JmesPathFunction function , final Void aVoid ) throws InvalidTypeException { final String prefix = "new " + function . getClass ( ) . getSimpleName ( ) + "( " ; return function . getExpressions ( ) . stream ( ) . map ( a -> a . accept ( this , aVoid ) ) . collect ( Collectors . joining ( "," , prefix , ")" ) ) ; } | Generates the code for a new JmesPathFunction . |
30,553 | public String visit ( final Comparator op , final Void aVoid ) throws InvalidTypeException { String lhs = op . getLhsExpr ( ) . accept ( this , aVoid ) ; String rhs = op . getRhsExpr ( ) . accept ( this , aVoid ) ; return String . format ( "new %s(%s, %s)" , op . getClass ( ) . getSimpleName ( ) , lhs , rhs ) ; } | Generates the code for a new Comparator . |
30,554 | public String visit ( final JmesPathNotExpression notExpression , final Void aVoid ) throws InvalidTypeException { return "new JmesPathNotExpression( " + notExpression . getExpr ( ) . accept ( this , aVoid ) + " )" ; } | Generates the code for a new JmesPathNotExpression . |
30,555 | public String visit ( final JmesPathAndExpression andExpression , final Void aVoid ) throws InvalidTypeException { return "new JmesPathAndExpression( " + andExpression . getLhsExpr ( ) . accept ( this , aVoid ) + ", " + andExpression . getRhsExpr ( ) . accept ( this , aVoid ) + " )" ; } | Generates the code for a new JmesPathAndExpression . |
30,556 | public String visit ( final JmesPathMultiSelectList multiSelectList , final Void aVoid ) throws InvalidTypeException { final String prefix = "new JmesPathMultiSelectList( " ; return multiSelectList . getExpressions ( ) . stream ( ) . map ( a -> a . accept ( this , aVoid ) ) . collect ( Collectors . joining ( "," , prefix , ")" ) ) ; } | Generates the code for a new JmesPathMultiSelectList . |
30,557 | public static String localHostName ( ) { try { InetAddress localhost = InetAddress . getLocalHost ( ) ; return localhost . getHostName ( ) ; } catch ( Exception e ) { InternalLogFactory . getLog ( AwsHostNameUtils . class ) . debug ( "Failed to determine the local hostname; fall back to " + "use \"localhost\"." , e ) ; return "localhost" ; } } | Returns the host name for the local host . If the operation is not allowed by the security check the textual representation of the IP address of the local host is returned instead . If the ip address of the local host cannot be resolved or if there is any other failure localhost is returned as a fallback . |
30,558 | public DynamoDBQueryExpression < T > withExpressionAttributeValues ( java . util . Map < String , AttributeValue > expressionAttributeValues ) { setExpressionAttributeValues ( expressionAttributeValues ) ; return this ; } | One or more values that can be substituted in an expression . |
30,559 | public MessageResponse withEndpointResult ( java . util . Map < String , EndpointMessageResult > endpointResult ) { setEndpointResult ( endpointResult ) ; return this ; } | A map containing a multi part response for each address with the endpointId as the key and the result as the value . |
30,560 | public Map < String , String > mergeInto ( Map < String , String > core ) { if ( extra . size ( ) == 0 ) return core ; if ( core == null || core . size ( ) == 0 ) return extra ; switch ( resolve ) { case FAIL_FAST : { final int total = core . size ( ) + extra . size ( ) ; Map < String , String > merged = new HashMap < String , String > ( core ) ; merged . putAll ( extra ) ; if ( total != merged . size ( ) ) { throw new IllegalArgumentException ( "The supplemental material descriptions contains conflicting entries" ) ; } return Collections . unmodifiableMap ( merged ) ; } case OVERRIDDEN : { Map < String , String > merged = new HashMap < String , String > ( extra ) ; merged . putAll ( core ) ; return Collections . unmodifiableMap ( merged ) ; } case OVERRIDE : { Map < String , String > merged = new HashMap < String , String > ( core ) ; merged . putAll ( extra ) ; return Collections . unmodifiableMap ( merged ) ; } default : throw new UnsupportedOperationException ( ) ; } } | Combine this supplemental material descriptions with those specified in the core parameter . This method has no side effect . |
30,561 | public CreateBrokerRequest withTags ( java . util . Map < String , String > tags ) { setTags ( tags ) ; return this ; } | Create tags when creating the broker . |
30,562 | private Request < CopySnapshotRequest > generateRequestForPresigning ( String sourceSnapshotId , String sourceRegion , String destinationRegion ) { CopySnapshotRequest copySnapshotRequest = new CopySnapshotRequest ( ) . withSourceSnapshotId ( sourceSnapshotId ) . withSourceRegion ( sourceRegion ) . withDestinationRegion ( destinationRegion ) ; return new CopySnapshotRequestMarshaller ( ) . marshall ( copySnapshotRequest ) ; } | Generates a Request object for the pre - signed URL . |
30,563 | private URI toURI ( String endpoint ) throws IllegalArgumentException { if ( endpoint . contains ( "://" ) == false ) { endpoint = Protocol . HTTPS + "://" + endpoint ; } try { return new URI ( endpoint ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( e ) ; } } | Returns the endpoint as a URI . |
30,564 | public void setMaterialsDescription ( Map < String , String > materialsDescription ) { this . materialsDescription = materialsDescription == null ? null : Collections . unmodifiableMap ( new HashMap < String , String > ( materialsDescription ) ) ; } | sets the materials description for the encryption materials to be used with the current PutObjectRequest . |
30,565 | public java . util . concurrent . Future < DescribeClusterParameterGroupsResult > describeClusterParameterGroupsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeClusterParameterGroupsRequest , DescribeClusterParameterGroupsResult > asyncHandler ) { return describeClusterParameterGroupsAsync ( new DescribeClusterParameterGroupsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeClusterParameterGroups operation with an AsyncHandler . |
30,566 | public java . util . concurrent . Future < DescribeReservedNodeOfferingsResult > describeReservedNodeOfferingsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeReservedNodeOfferingsRequest , DescribeReservedNodeOfferingsResult > asyncHandler ) { return describeReservedNodeOfferingsAsync ( new DescribeReservedNodeOfferingsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeReservedNodeOfferings operation with an AsyncHandler . |
30,567 | private boolean metadataInvolvesSse ( ObjectMetadata metadata ) { if ( metadata == null ) { return false ; } return containsNonNull ( metadata . getSSECustomerAlgorithm ( ) , metadata . getSSECustomerKeyMd5 ( ) , metadata . getSSEAwsKmsKeyId ( ) ) ; } | If SSE - C or SSE - KMS is involved then the Etag will be the MD5 of the ciphertext not the plaintext so we can t validate it client side . Plain SSE with S3 managed keys will return an Etag that does match the MD5 of the plaintext so it s still eligible for client side validation . |
30,568 | private static boolean containsNonNull ( Object ... items ) { for ( Object item : items ) { if ( item != null ) { return true ; } } return false ; } | Helper method to avoid long chains of non null checks |
30,569 | public DescribeBrokerResult describeBroker ( DescribeBrokerRequest request ) { request = beforeClientExecution ( request ) ; return executeDescribeBroker ( request ) ; } | Returns information about the specified broker . |
30,570 | public DescribeBrokerEngineTypesResult describeBrokerEngineTypes ( DescribeBrokerEngineTypesRequest request ) { request = beforeClientExecution ( request ) ; return executeDescribeBrokerEngineTypes ( request ) ; } | Describe available engine types and versions . |
30,571 | public DescribeBrokerInstanceOptionsResult describeBrokerInstanceOptions ( DescribeBrokerInstanceOptionsRequest request ) { request = beforeClientExecution ( request ) ; return executeDescribeBrokerInstanceOptions ( request ) ; } | Describe available broker instance options . |
30,572 | public DescribeConfigurationResult describeConfiguration ( DescribeConfigurationRequest request ) { request = beforeClientExecution ( request ) ; return executeDescribeConfiguration ( request ) ; } | Returns information about the specified configuration . |
30,573 | public DescribeConfigurationRevisionResult describeConfigurationRevision ( DescribeConfigurationRevisionRequest request ) { request = beforeClientExecution ( request ) ; return executeDescribeConfigurationRevision ( request ) ; } | Returns the specified configuration revision for the specified configuration . |
30,574 | public ListBrokersResult listBrokers ( ListBrokersRequest request ) { request = beforeClientExecution ( request ) ; return executeListBrokers ( request ) ; } | Returns a list of all brokers . |
30,575 | public ListConfigurationRevisionsResult listConfigurationRevisions ( ListConfigurationRevisionsRequest request ) { request = beforeClientExecution ( request ) ; return executeListConfigurationRevisions ( request ) ; } | Returns a list of all revisions for the specified configuration . |
30,576 | public UpdateBrokerResult updateBroker ( UpdateBrokerRequest request ) { request = beforeClientExecution ( request ) ; return executeUpdateBroker ( request ) ; } | Adds a pending configuration change to a broker . |
30,577 | public UpdateConfigurationResult updateConfiguration ( UpdateConfigurationRequest request ) { request = beforeClientExecution ( request ) ; return executeUpdateConfiguration ( request ) ; } | Updates the specified configuration . |
30,578 | protected static void initClients ( ) throws Exception { ProfileCredentialsProvider credentialsProvider = new ProfileCredentialsProvider ( ) ; try { credentialsProvider . getCredentials ( ) ; } catch ( Exception e ) { throw new AmazonClientException ( "Cannot load the credentials from the credential profiles file. " + "Please make sure that your credentials file is at the correct " + "location (~/.aws/credentials), and is in valid format." , e ) ; } s3Client = AmazonS3ClientBuilder . standard ( ) . withCredentials ( credentialsProvider ) . withRegion ( s3RegionName ) . build ( ) ; firehoseClient = AmazonKinesisFirehoseClientBuilder . standard ( ) . withCredentials ( credentialsProvider ) . withRegion ( firehoseRegion ) . build ( ) ; iamClient = AmazonIdentityManagementClientBuilder . standard ( ) . withCredentials ( credentialsProvider ) . withRegion ( iamRegion ) . build ( ) ; } | Method to initialize the clients using the specified AWSCredentials . |
30,579 | protected static void createS3Bucket ( ) throws Exception { if ( StringUtils . isNullOrEmpty ( s3BucketName . trim ( ) ) ) { throw new IllegalArgumentException ( "Bucket name is empty. Please enter a bucket name " + "in firehosetos3sample.properties file" ) ; } if ( createS3Bucket ) { s3Client . createBucket ( s3BucketName ) ; LOG . info ( "Created bucket " + s3BucketName + " in S3 to deliver Firehose records" ) ; } } | Method to create the S3 bucket in specified region . |
30,580 | protected static void printDeliveryStreams ( ) { List < String > deliveryStreamNames = listDeliveryStreams ( ) ; LOG . info ( "Printing my list of DeliveryStreams : " ) ; if ( deliveryStreamNames . isEmpty ( ) ) { LOG . info ( "There are no DeliveryStreams for account: " + accountId ) ; } else { LOG . info ( "List of my DeliveryStreams: " ) ; } for ( int i = 0 ; i < deliveryStreamNames . size ( ) ; i ++ ) { LOG . info ( deliveryStreamNames . get ( i ) ) ; } } | Method to print all the delivery streams in the customer account . |
30,581 | protected static List < String > listDeliveryStreams ( ) { ListDeliveryStreamsRequest listDeliveryStreamsRequest = new ListDeliveryStreamsRequest ( ) ; ListDeliveryStreamsResult listDeliveryStreamsResult = firehoseClient . listDeliveryStreams ( listDeliveryStreamsRequest ) ; List < String > deliveryStreamNames = listDeliveryStreamsResult . getDeliveryStreamNames ( ) ; while ( listDeliveryStreamsResult . isHasMoreDeliveryStreams ( ) ) { if ( deliveryStreamNames . size ( ) > 0 ) { listDeliveryStreamsRequest . setExclusiveStartDeliveryStreamName ( deliveryStreamNames . get ( deliveryStreamNames . size ( ) - 1 ) ) ; } listDeliveryStreamsResult = firehoseClient . listDeliveryStreams ( listDeliveryStreamsRequest ) ; deliveryStreamNames . addAll ( listDeliveryStreamsResult . getDeliveryStreamNames ( ) ) ; } return deliveryStreamNames ; } | Method to list all the delivery streams in the customer account . |
30,582 | protected static void putRecordIntoDeliveryStream ( ) throws IOException { try ( InputStream inputStream = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( PUT_RECORD_STREAM_SOURCE ) ) { if ( inputStream == null ) { throw new FileNotFoundException ( "Could not find file " + PUT_RECORD_STREAM_SOURCE ) ; } try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { PutRecordRequest putRecordRequest = new PutRecordRequest ( ) ; putRecordRequest . setDeliveryStreamName ( deliveryStreamName ) ; String data = line + "\n" ; Record record = createRecord ( data ) ; putRecordRequest . setRecord ( record ) ; firehoseClient . putRecord ( putRecordRequest ) ; } } } } | Method to put records in the specified delivery stream by reading contents from sample input file using PutRecord API . |
30,583 | protected static void putRecordBatchIntoDeliveryStream ( ) throws IOException { try ( InputStream inputStream = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( BATCH_PUT_STREAM_SOURCE ) ) { if ( inputStream == null ) { throw new FileNotFoundException ( "Could not find file " + BATCH_PUT_STREAM_SOURCE ) ; } List < Record > recordList = new ArrayList < Record > ( ) ; int batchSize = 0 ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { String data = line + "\n" ; Record record = createRecord ( data ) ; recordList . add ( record ) ; batchSize ++ ; if ( batchSize == BATCH_PUT_MAX_SIZE ) { putRecordBatch ( recordList ) ; recordList . clear ( ) ; batchSize = 0 ; } } if ( batchSize > 0 ) { putRecordBatch ( recordList ) ; } } } } | Method to put records in the specified delivery stream by reading contents from sample input file using PutRecordBatch API . |
30,584 | protected static String createIamRole ( String s3Prefix ) throws InterruptedException { try { iamClient . createRole ( new CreateRoleRequest ( ) . withRoleName ( iamRoleName ) . withAssumeRolePolicyDocument ( getTrustPolicy ( ) ) ) ; } catch ( EntityAlreadyExistsException e ) { LOG . info ( "IAM role with name " + iamRoleName + " already exists" ) ; } catch ( MalformedPolicyDocumentException policyDocumentException ) { LOG . error ( String . format ( "Please check the trust policy document for malformation: %s" , IAM_ROLE_TRUST_POLICY_DOCUMENT ) ) ; throw policyDocumentException ; } putRolePolicy ( s3Prefix ) ; String roleARN = iamClient . getRole ( new GetRoleRequest ( ) . withRoleName ( iamRoleName ) ) . getRole ( ) . getArn ( ) ; Thread . sleep ( 5000 ) ; return roleARN ; } | Method to create the IAM role . |
30,585 | protected static void waitForDeliveryStreamToBecomeAvailable ( String deliveryStreamName ) throws Exception { LOG . info ( "Waiting for " + deliveryStreamName + " to become ACTIVE..." ) ; long startTime = System . currentTimeMillis ( ) ; long endTime = startTime + ( 10 * 60 * 1000 ) ; while ( System . currentTimeMillis ( ) < endTime ) { try { Thread . sleep ( 1000 * 20 ) ; } catch ( InterruptedException e ) { } DeliveryStreamDescription deliveryStreamDescription = describeDeliveryStream ( deliveryStreamName ) ; String deliveryStreamStatus = deliveryStreamDescription . getDeliveryStreamStatus ( ) ; LOG . info ( " - current state: " + deliveryStreamStatus ) ; if ( deliveryStreamStatus . equals ( "ACTIVE" ) ) { return ; } } throw new AmazonServiceException ( "DeliveryStream " + deliveryStreamName + " never went active" ) ; } | Method to wait until the delivery stream becomes active . |
30,586 | protected static DeliveryStreamDescription describeDeliveryStream ( String deliveryStreamName ) { DescribeDeliveryStreamRequest describeDeliveryStreamRequest = new DescribeDeliveryStreamRequest ( ) ; describeDeliveryStreamRequest . withDeliveryStreamName ( deliveryStreamName ) ; DescribeDeliveryStreamResult describeDeliveryStreamResponse = firehoseClient . describeDeliveryStream ( describeDeliveryStreamRequest ) ; return describeDeliveryStreamResponse . getDeliveryStreamDescription ( ) ; } | Method to describe the delivery stream . |
30,587 | protected static void waitForDataDelivery ( int waitTimeSecs ) throws InterruptedException { LOG . info ( "Since the Buffering Hints IntervalInSeconds parameter is specified as: " + waitTimeSecs + " seconds. Waiting for " + waitTimeSecs + " seconds for the data to be written to S3 bucket" ) ; TimeUnit . SECONDS . sleep ( waitTimeSecs ) ; LOG . info ( "Data delivery to S3 bucket " + s3BucketName + " is complete" ) ; } | Method to wait for the specified buffering interval seconds so that data will be delivered to corresponding destination . |
30,588 | protected static String getBucketARN ( String bucketName ) throws IllegalArgumentException { return new StringBuilder ( ) . append ( S3_ARN_PREFIX ) . append ( bucketName ) . toString ( ) ; } | Method to return the bucket ARN . |
30,589 | private static PutRecordBatchResult putRecordBatch ( List < Record > recordList ) { PutRecordBatchRequest putRecordBatchRequest = new PutRecordBatchRequest ( ) ; putRecordBatchRequest . setDeliveryStreamName ( deliveryStreamName ) ; putRecordBatchRequest . setRecords ( recordList ) ; return firehoseClient . putRecordBatch ( putRecordBatchRequest ) ; } | Method to perform PutRecordBatch operation with the given record list . |
30,590 | protected static void putRolePolicy ( String s3Prefix ) { try { String permissionsPolicyDocument = containsKMSKeyARN ( ) ? getPermissionsPolicyWithKMSResources ( s3Prefix ) : getPermissionsPolicyWithoutKMSResources ( ) ; iamClient . putRolePolicy ( new PutRolePolicyRequest ( ) . withRoleName ( iamRoleName ) . withPolicyName ( FIREHOSE_ROLE_POLICY_NAME ) . withPolicyDocument ( permissionsPolicyDocument ) ) ; } catch ( MalformedPolicyDocumentException policyDocumentException ) { LOG . error ( String . format ( "Please check the permissions policy document for malformation: %s" , containsKMSKeyARN ( ) ? IAM_ROLE_PERMISSIONS_POLICY_WITH_KMS_RESOURCES_DOCUMENT : IAM_ROLE_PERMISSIONS_POLICY_WITHOUT_KMS_RESOURCES_DOCUMENT ) ) ; throw policyDocumentException ; } } | Method to put the role policy with permissions document . Permission document would change based on KMS Key ARN specified in properties file . If KMS Key ARN is specified permissions document will contain KMS resource . |
30,591 | private static String getPermissionsPolicyWithKMSResources ( String s3Prefix ) { return readResource ( IAM_ROLE_PERMISSIONS_POLICY_WITH_KMS_RESOURCES_DOCUMENT ) . replace ( "{{S3_BUCKET_NAME}}" , s3BucketName ) . replace ( "{{KMS_KEY_ARN}}" , s3DestinationAWSKMSKeyId ) . replace ( "{{S3_REGION}}" , s3RegionName ) . replace ( "{{S3_PREFIX}}" , s3Prefix ) ; } | Method to return the permissions policy document with KMS resource . |
30,592 | private static String readResource ( String name ) { try { return IOUtils . toString ( AmazonKinesisFirehoseToRedshiftSample . class . getResourceAsStream ( name ) ) ; } catch ( IOException e ) { throw new RuntimeException ( "Failed to read document resource: " + name , e ) ; } } | Method to read the resource for the given filename . |
30,593 | private static Record createRecord ( String data ) { return new Record ( ) . withData ( ByteBuffer . wrap ( data . getBytes ( ) ) ) ; } | Method to create the record object for given data . |
30,594 | public static Future < ? > publishTransferPersistable ( final ProgressListener listener , final PersistableTransfer persistableTransfer ) { if ( persistableTransfer == null || ! ( listener instanceof S3ProgressListener ) ) { return null ; } final S3ProgressListener s3listener = ( S3ProgressListener ) listener ; return deliverEvent ( s3listener , persistableTransfer ) ; } | Used to deliver a persistable transfer to the given s3 listener . |
30,595 | public Waiter < DescribeBatchPredictionsRequest > batchPredictionAvailable ( ) { return new WaiterBuilder < DescribeBatchPredictionsRequest , DescribeBatchPredictionsResult > ( ) . withSdkFunction ( new DescribeBatchPredictionsFunction ( client ) ) . withAcceptors ( new BatchPredictionAvailable . IsCOMPLETEDMatcher ( ) , new BatchPredictionAvailable . IsFAILEDMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 60 ) , new FixedDelayStrategy ( 30 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a BatchPredictionAvailable 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 . |
30,596 | public Waiter < DescribeMLModelsRequest > mLModelAvailable ( ) { return new WaiterBuilder < DescribeMLModelsRequest , DescribeMLModelsResult > ( ) . withSdkFunction ( new DescribeMLModelsFunction ( client ) ) . withAcceptors ( new MLModelAvailable . IsCOMPLETEDMatcher ( ) , new MLModelAvailable . IsFAILEDMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 60 ) , new FixedDelayStrategy ( 30 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a MLModelAvailable 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 . |
30,597 | public Waiter < DescribeDataSourcesRequest > dataSourceAvailable ( ) { return new WaiterBuilder < DescribeDataSourcesRequest , DescribeDataSourcesResult > ( ) . withSdkFunction ( new DescribeDataSourcesFunction ( client ) ) . withAcceptors ( new DataSourceAvailable . IsCOMPLETEDMatcher ( ) , new DataSourceAvailable . IsFAILEDMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 60 ) , new FixedDelayStrategy ( 30 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a DataSourceAvailable 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 . |
30,598 | public Waiter < DescribeEvaluationsRequest > evaluationAvailable ( ) { return new WaiterBuilder < DescribeEvaluationsRequest , DescribeEvaluationsResult > ( ) . withSdkFunction ( new DescribeEvaluationsFunction ( client ) ) . withAcceptors ( new EvaluationAvailable . IsCOMPLETEDMatcher ( ) , new EvaluationAvailable . IsFAILEDMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 60 ) , new FixedDelayStrategy ( 30 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a EvaluationAvailable 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 . |
30,599 | public static S3Versions withPrefix ( AmazonS3 s3 , String bucketName , String prefix ) { S3Versions versions = new S3Versions ( s3 , bucketName ) ; versions . prefix = prefix ; return versions ; } | Constructs an iterable that covers the versions in an Amazon S3 bucket where the object key begins with the given prefix . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.