idx
int64 0
165k
| question
stringlengths 73
4.15k
| target
stringlengths 5
918
| len_question
int64 21
890
| len_target
int64 3
255
|
|---|---|---|---|---|
152,300
|
public Datapoint addLongValue ( long time , long value ) { initialValues ( ) ; checkType ( TsdbConstants . TYPE_LONG ) ; values . add ( Lists . < JsonNode > newArrayList ( new LongNode ( time ) , new LongNode ( value ) ) ) ; return this ; }
|
Add datapoint of long type value .
| 69
| 9
|
152,301
|
public Datapoint addDoubleValue ( long time , double value ) { initialValues ( ) ; checkType ( TsdbConstants . TYPE_DOUBLE ) ; values . add ( Lists . < JsonNode > newArrayList ( new LongNode ( time ) , new DoubleNode ( value ) ) ) ; return this ; }
|
Add datapoint of double type value .
| 70
| 9
|
152,302
|
public Datapoint addStringValue ( long time , String value ) { initialValues ( ) ; checkType ( TsdbConstants . TYPE_STRING ) ; values . add ( Lists . < JsonNode > newArrayList ( new LongNode ( time ) , new TextNode ( value ) ) ) ; return this ; }
|
Add datapoint of String type value .
| 69
| 9
|
152,303
|
public Datapoint addTag ( String tagKey , String tagValue ) { initialTags ( ) ; tags . put ( tagKey , tagValue ) ; return this ; }
|
Add tag for the datapoint .
| 36
| 8
|
152,304
|
public static String hmacSha256 ( String input , String secretKey ) { if ( input == null ) { throw new NullPointerException ( "input" ) ; } else if ( secretKey == null ) { throw new NullPointerException ( "secretKey" ) ; } return hmacSha256 ( input . getBytes ( CHARSET_UTF8 ) , secretKey . getBytes ( CHARSET_UTF8 ) ) ; }
|
Encodes the input String using the UTF8 charset and calls hmacSha256 ;
| 96
| 19
|
152,305
|
public String getEndpoint ( ) { String url = this . endpoint ; // if the set endpoint does not contain a protocol, append protocol to head of it if ( this . endpoint != null && this . endpoint . length ( ) > 0 && endpoint . indexOf ( "://" ) < 0 ) { url = protocol . toString ( ) . toLowerCase ( ) + "://" + endpoint ; } return url ; }
|
Returns the service endpoint URL to which the client will connect .
| 89
| 12
|
152,306
|
@ Override public void sign ( InternalRequest request , BceCredentials credentials , SignOptions options ) { checkNotNull ( request , "request should not be null." ) ; if ( credentials == null ) { return ; } if ( options == null ) { if ( request . getSignOptions ( ) != null ) { options = request . getSignOptions ( ) ; } else { options = SignOptions . DEFAULT ; } } String accessKeyId = credentials . getAccessKeyId ( ) ; String secretAccessKey = credentials . getSecretKey ( ) ; request . addHeader ( Headers . HOST , HttpUtils . generateHostHeader ( request . getUri ( ) ) ) ; if ( credentials instanceof BceSessionCredentials ) { request . addHeader ( Headers . BCE_SECURITY_TOKEN , ( ( BceSessionCredentials ) credentials ) . getSessionToken ( ) ) ; } Date timestamp = options . getTimestamp ( ) ; if ( timestamp == null ) { timestamp = new Date ( ) ; } String authString = BceV1Signer . BCE_AUTH_VERSION + "/" + accessKeyId + "/" + DateUtils . formatAlternateIso8601Date ( timestamp ) + "/" + options . getExpirationInSeconds ( ) ; String signingKey = this . sha256Hex ( secretAccessKey , authString ) ; // Formatting the URL with signing protocol. String canonicalURI = this . getCanonicalURIPath ( request . getUri ( ) . getPath ( ) ) ; // Formatting the query string with signing protocol. String canonicalQueryString = HttpUtils . getCanonicalQueryString ( request . getParameters ( ) , true ) ; // Sorted the headers should be signed from the request. SortedMap < String , String > headersToSign = this . getHeadersToSign ( request . getHeaders ( ) , options . getHeadersToSign ( ) ) ; // Formatting the headers from the request based on signing protocol. String canonicalHeader = this . getCanonicalHeaders ( headersToSign ) ; String signedHeaders = "" ; if ( options . getHeadersToSign ( ) != null ) { signedHeaders = BceV1Signer . signedHeaderStringJoiner . join ( headersToSign . keySet ( ) ) ; signedHeaders = signedHeaders . trim ( ) . toLowerCase ( ) ; } String canonicalRequest = request . getHttpMethod ( ) + "\n" + canonicalURI + "\n" + canonicalQueryString + "\n" + canonicalHeader ; // Signing the canonical request using key with sha-256 algorithm. String signature = this . sha256Hex ( signingKey , canonicalRequest ) ; String authorizationHeader = authString + "/" + signedHeaders + "/" + signature ; logger . debug ( "CanonicalRequest:{}\tAuthorization:{}" , canonicalRequest . replace ( "\n" , "[\\n]" ) , authorizationHeader ) ; request . addHeader ( Headers . AUTHORIZATION , authorizationHeader ) ; }
|
Sign the given request with the given set of credentials . Modifies the passed - in request to apply the signature .
| 667
| 23
|
152,307
|
public void deleteRouteRule ( DeleteRouteRequest deleteRouteRequest ) { checkNotNull ( deleteRouteRequest , "request should not be null." ) ; checkNotNull ( deleteRouteRequest . getRouteRuleId ( ) , "request routeRuleId should not be null." ) ; if ( Strings . isNullOrEmpty ( deleteRouteRequest . getClientToken ( ) ) ) { deleteRouteRequest . setClientToken ( this . generateClientToken ( ) ) ; } InternalRequest internalRequest = this . createRequest ( deleteRouteRequest , HttpMethodName . DELETE , ROUTE_PREFIX , ROUTE_RULE , deleteRouteRequest . getRouteRuleId ( ) ) ; internalRequest . addParameter ( "clientToken" , deleteRouteRequest . getClientToken ( ) ) ; this . invokeHttpClient ( internalRequest , AbstractBceResponse . class ) ; }
|
Delete the specific route rule
| 188
| 5
|
152,308
|
public void setResponses ( Map < String , List < Map < String , AttributeValue > > > responses ) { this . responses = responses ; }
|
Set the processed items content for this BatchGetItem request .
| 33
| 13
|
152,309
|
public CreateTranscodingJobResponse createTranscodingJob ( String pipelineName , String sourceKey , String targetKey , String presetName , String watermarkId , DelogoArea delogoArea ) { CreateTranscodingJobRequest request = new CreateTranscodingJobRequest ( ) ; request . setPipelineName ( pipelineName ) ; Source source = new Source ( ) ; source . setSourceKey ( sourceKey ) ; request . setSource ( source ) ; Target target = new Target ( ) ; target . setTargetKey ( targetKey ) ; target . setPresetName ( presetName ) ; if ( ! Strings . isNullOrEmpty ( watermarkId ) ) { List < String > watermarkIds = Collections . singletonList ( watermarkId ) ; target . setWatermarkIds ( watermarkIds ) ; } if ( delogoArea != null ) { target . setDelogoArea ( delogoArea ) ; } request . setTarget ( target ) ; return createTranscodingJob ( request ) ; }
|
Creates a new transcoder job which converts media files in BOS buckets with specified preset watermarkId and delogoArea .
| 220
| 26
|
152,310
|
public ListPipelinesResponse listPipelines ( ListPipelinesRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , PIPELINE ) ; return invokeHttpClient ( internalRequest , ListPipelinesResponse . class ) ; }
|
List all your pipelines .
| 77
| 5
|
152,311
|
public void deletePipeline ( DeletePipelineRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getPipelineName ( ) , "The parameter pipelineName should NOT be null or empty string." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . DELETE , request , PIPELINE , request . getPipelineName ( ) ) ; invokeHttpClient ( internalRequest , CreatePipelineResponse . class ) ; }
|
Deletes a pipeline with the specified pipeline name .
| 114
| 10
|
152,312
|
public CreatePresetResponse createPreset ( String presetName , String container ) { return createPreset ( presetName , null , container , true , null , null , null , null , null ) ; }
|
Create a preset which only convert source media file to a different container format without changing the file contents .
| 43
| 20
|
152,313
|
public ListPresetsResponse listPresets ( ListPresetsRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , PRESET ) ; return invokeHttpClient ( internalRequest , ListPresetsResponse . class ) ; }
|
List all system and user s preset .
| 71
| 8
|
152,314
|
public CreateWaterMarkResponse createWaterMark ( CreateWaterMarkRequest request ) { checkStringNotEmpty ( request . getBucket ( ) , "The parameter bucket should NOT be null or empty string." ) ; checkStringNotEmpty ( request . getKey ( ) , "The parameter key should NOT be null or empty string." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . POST , request , WATER_MARK ) ; return invokeHttpClient ( internalRequest , CreateWaterMarkResponse . class ) ; }
|
Creates a water mark and return water mark ID
| 110
| 10
|
152,315
|
public ListWaterMarkResponse listWaterMark ( ListWaterMarkRequest request ) { InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , WATER_MARK ) ; return invokeHttpClient ( internalRequest , ListWaterMarkResponse . class ) ; }
|
List all water mark .
| 57
| 5
|
152,316
|
public ModifyInstanceGroupsRequest withInstanceGroup ( ModifyInstanceGroupConfig instanceGroup ) { if ( this . instanceGroups == null ) { this . instanceGroups = new ArrayList < ModifyInstanceGroupConfig > ( ) ; } this . instanceGroups . add ( instanceGroup ) ; return this ; }
|
Configure the instance group to be modified .
| 67
| 9
|
152,317
|
public CreateClusterRequest withInstanceGroup ( InstanceGroupConfig instanceGroup ) { if ( this . instanceGroups == null ) { this . instanceGroups = new ArrayList < InstanceGroupConfig > ( ) ; } this . instanceGroups . add ( instanceGroup ) ; return this ; }
|
Configure the instance group for the cluster .
| 63
| 9
|
152,318
|
public CreateClusterRequest withStep ( StepConfig step ) { if ( this . steps == null ) { this . steps = new ArrayList < StepConfig > ( ) ; } this . steps . add ( step ) ; return this ; }
|
Configure optional step for the cluster . The step will be scheduled and executed after the cluster is ACTIVE . And the step also can be added to the cluster by sending AddStepsRequest .
| 50
| 39
|
152,319
|
public Filters addField ( String field , String value ) { initialFields ( ) ; fields . add ( new FieldFilter ( field , value ) ) ; return this ; }
|
Add field filter to fields which just append not replace .
| 37
| 11
|
152,320
|
public Filters addTag ( String tagKey , List < String > tagValues ) { addTags ( tagKey , tagValues ) ; return this ; }
|
Add tag to tags which just append not replace .
| 32
| 10
|
152,321
|
public static ValueFilter createValueFilter ( String operation , String value ) { checkArgument ( STRING_SUPPORTED_OPERATION . contains ( operation ) , "String value only support operations in " + STRING_SUPPORTED_OPERATION . toString ( ) ) ; ValueFilter valueFilter = new ValueFilter ( operation , SINGLE_QUOTATION + value + SINGLE_QUOTATION ) ; return valueFilter ; }
|
Create value filter for String type .
| 94
| 7
|
152,322
|
public static ValueFilter createValueFilter ( String operation , Double value ) { checkArgument ( LONG_DOUBLE_SUPPORTED_OPERATION . contains ( operation ) , "Double value only support operations in " + LONG_DOUBLE_SUPPORTED_OPERATION . toString ( ) ) ; ValueFilter valueFilter = new ValueFilter ( operation , String . valueOf ( value ) ) ; return valueFilter ; }
|
Create value filter for Double type .
| 90
| 7
|
152,323
|
public static ValueFilter createValueFilterOfTag ( String operation , String tagKey ) { checkArgument ( TAG_SUPPORTED_OPERATION . contains ( operation ) , "Value of tag key only support operations in " + TAG_SUPPORTED_OPERATION . toString ( ) ) ; ValueFilter valueFilter = new ValueFilter ( operation , tagKey ) ; return valueFilter ; }
|
Create value filter for comparing with the value of tag key .
| 82
| 12
|
152,324
|
public ListSubnetsResponse listSubnets ( ListSubnetsRequest request ) { checkNotNull ( request , "request should not be null." ) ; InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , SUBNET_PREFIX ) ; if ( request . getMarker ( ) != null ) { internalRequest . addParameter ( "marker" , request . getMarker ( ) ) ; } if ( request . getMaxKeys ( ) > 0 ) { internalRequest . addParameter ( "maxKeys" , String . valueOf ( request . getMaxKeys ( ) ) ) ; } return invokeHttpClient ( internalRequest , ListSubnetsResponse . class ) ; }
|
Return a list of subnet owned by the authenticated user .
| 149
| 12
|
152,325
|
public GetSubnetResponse getSubnet ( GetSubnetRequest getSubnetRequest ) { checkNotNull ( getSubnetRequest , "request should not be null." ) ; checkNotNull ( getSubnetRequest . getSubnetId ( ) , "request vpcId should not be null." ) ; InternalRequest internalRequest = this . createRequest ( getSubnetRequest , HttpMethodName . GET , SUBNET_PREFIX , getSubnetRequest . getSubnetId ( ) ) ; return this . invokeHttpClient ( internalRequest , GetSubnetResponse . class ) ; }
|
Get the detail information of specified subnet .
| 126
| 9
|
152,326
|
public void modifySubnetAttributes ( String subnetId , String name ) { ModifySubnetAttributesRequest request = new ModifySubnetAttributesRequest ( ) ; modifySubnetAttributes ( request . withName ( name ) . withSubnetId ( subnetId ) ) ; }
|
Modifying the special attribute to new value of the subnet owned by the user .
| 59
| 17
|
152,327
|
public void verifyEmail ( VerifyEmailRequest request ) { checkNotNull ( request , "object request should not be null." ) ; assertStringNotNullOrEmpty ( request . getEmailAddress ( ) , "object emailAddress should not be null or empty" ) ; InternalRequest internalRequest = this . createRequest ( "verifiedEmail" , request , HttpMethodName . PUT , request . getEmailAddress ( ) ) ; this . invokeHttpClient ( internalRequest , SesResponse . class ) ; }
|
Verify email address
| 106
| 4
|
152,328
|
public ListVerifiedEmailResponse listVerifiedEmail ( SesRequest request ) { InternalRequest internalRequest = this . createRequest ( "verifiedEmail" , request , HttpMethodName . GET ) ; return this . invokeHttpClient ( internalRequest , ListVerifiedEmailResponse . class ) ; }
|
Get the list of verified email address
| 62
| 7
|
152,329
|
public GetVerifiedEmailResponse getVerifiedEmail ( GetVerifiedEmailRequest request ) { checkNotNull ( request , "object request should not be null." ) ; assertStringNotNullOrEmpty ( request . getEmailAddress ( ) , "object emailAddress should not be null or empty" ) ; checkIsEmail ( request . getEmailAddress ( ) ) ; InternalRequest internalRequest = this . createRequest ( "verifiedEmail" , request , HttpMethodName . GET , request . getEmailAddress ( ) ) ; return this . invokeHttpClient ( internalRequest , GetVerifiedEmailResponse . class ) ; }
|
Get the detail of verified email address
| 129
| 7
|
152,330
|
public void deleteVerifiedEmail ( DeleteVerifiedEmailRequest request ) { checkNotNull ( request , "object request should not be null." ) ; assertStringNotNullOrEmpty ( request . getEmailAddress ( ) , "object emailAddress should not be null or empty" ) ; checkIsEmail ( request . getEmailAddress ( ) ) ; InternalRequest internalRequest = this . createRequest ( "verifiedEmail" , request , HttpMethodName . DELETE , request . getEmailAddress ( ) ) ; this . invokeHttpClient ( internalRequest , SesResponse . class ) ; }
|
Delete verified email address
| 124
| 4
|
152,331
|
public ListVerifiedDomainResponse listVerifiedDomain ( SesRequest request ) { InternalRequest internalRequest = this . createRequest ( "verifiedDomain" , request , HttpMethodName . GET ) ; return this . invokeHttpClient ( internalRequest , ListVerifiedDomainResponse . class ) ; }
|
Get the list of verified domain
| 62
| 6
|
152,332
|
public GetVerifiedDomainResponse getVerifiedDomain ( GetVerifiedDomainRequest request ) { checkNotNull ( request , "object request should not be null." ) ; assertStringNotNullOrEmpty ( request . getDomainName ( ) , "object domainName should not be null or empty" ) ; InternalRequest internalRequest = this . createRequest ( "verifiedDomain" , request , HttpMethodName . GET , request . getDomainName ( ) ) ; return this . invokeHttpClient ( internalRequest , GetVerifiedDomainResponse . class ) ; }
|
Get the detail of specifical verified domain
| 116
| 9
|
152,333
|
public void deleteVerifiedDomain ( DeleteVerifiedDomainRequest request ) { checkNotNull ( request , "object request should not be null." ) ; assertStringNotNullOrEmpty ( request . getDomainName ( ) , "object domainName should not be null or empty" ) ; InternalRequest internalRequest = this . createRequest ( "verifiedDomain" , request , HttpMethodName . DELETE , request . getDomainName ( ) ) ; this . invokeHttpClient ( internalRequest , SesResponse . class ) ; }
|
Delete the domain
| 111
| 3
|
152,334
|
public ListRecipientBlacklistResponse listRecipientBlacklist ( SesRequest request ) { InternalRequest internalRequest = this . createRequest ( "recipientBlacklist" , request , HttpMethodName . GET ) ; return this . invokeHttpClient ( internalRequest , ListRecipientBlacklistResponse . class ) ; }
|
Get the list of blacklist
| 67
| 5
|
152,335
|
public IsInRecipientBlacklistResponse isInRecipientBlacklist ( IsInRecipientBlacklistRequest request ) { checkNotNull ( request , "object request should not be null." ) ; assertStringNotNullOrEmpty ( request . getEmailAddress ( ) , "object emailAddress should not be null or empty" ) ; InternalRequest internalRequest = this . createRequest ( "recipientBlacklist" , request , HttpMethodName . GET , request . getEmailAddress ( ) ) ; return this . invokeHttpClient ( internalRequest , IsInRecipientBlacklistResponse . class ) ; }
|
Query the special receiver is in blacklist or not
| 126
| 9
|
152,336
|
public GetFailedReasonResponse getFailedReason ( SesRequest request ) { InternalRequest internalRequest = this . createRequest ( "failedReason" , request , HttpMethodName . GET ) ; return this . invokeHttpClient ( internalRequest , GetFailedReasonResponse . class ) ; }
|
Query the failed reason
| 62
| 4
|
152,337
|
private void attachRequestToBody ( AbstractBceRequest request , InternalRequest httpRequest ) { byte [ ] content ; try { content = JsonUtils . toJsonString ( request ) . getBytes ( "utf-8" ) ; } catch ( UnsupportedEncodingException e ) { throw new BceClientException ( "utf-8 encoding not supported!" , e ) ; } httpRequest . addHeader ( Headers . CONTENT_LENGTH , String . valueOf ( content . length ) ) ; httpRequest . addHeader ( Headers . CONTENT_TYPE , "application/json; charset=utf-8" ) ; httpRequest . setContent ( RestartableInputStream . wrap ( content ) ) ; }
|
put json object into http content for put or post request .
| 155
| 12
|
152,338
|
public static < T > T fromJsonString ( String json , Class < T > clazz ) { if ( json == null ) { return null ; } try { return JsonUtils . objectMapper . readValue ( json , clazz ) ; } catch ( Exception e ) { throw new BceClientException ( "Unable to parse Json String." , e ) ; } }
|
Returns the deserialized object from the given json string and target class ; or null if the given json string is null .
| 83
| 25
|
152,339
|
public QueryMessageDetailResponse queryMessageDetail ( QueryMessageDetailRequest request ) { checkNotNull ( request , "object request should not be null." ) ; assertStringNotNullOrEmpty ( request . getMessageId ( ) , "object messageId should not be null or empty." ) ; InternalRequest internalRequest = this . createRequest ( "message" , request , HttpMethodName . GET , request . getMessageId ( ) ) ; return this . invokeHttpClient ( internalRequest , QueryMessageDetailResponse . class ) ; }
|
Query message detail
| 115
| 3
|
152,340
|
public void deleteTemplate ( DeleteTemplateRequest request ) { checkNotNull ( request , "object request should not be null." ) ; assertStringNotNullOrEmpty ( request . getTemplateId ( ) , "object templateId should not be null or empty." ) ; InternalRequest internalRequest = this . createRequest ( "template" , request , HttpMethodName . DELETE , request . getTemplateId ( ) ) ; this . invokeHttpClient ( internalRequest , SmsResponse . class ) ; }
|
Delete message template
| 106
| 3
|
152,341
|
public GetTemplateDetailResponse getTemplateDetail ( GetTemplateDetailRequest request ) { checkNotNull ( request , "object request should not be null." ) ; assertStringNotNullOrEmpty ( request . getTemplateId ( ) , "object templateId should not be null or empty." ) ; InternalRequest internalRequest = this . createRequest ( "template" , request , HttpMethodName . GET , request . getTemplateId ( ) ) ; return this . invokeHttpClient ( internalRequest , GetTemplateDetailResponse . class ) ; }
|
Get the detail of message template
| 115
| 6
|
152,342
|
public ListTemplateResponse listTemplate ( SmsRequest request ) { checkNotNull ( request , "object request should not be null." ) ; InternalRequest internalRequest = this . createRequest ( "template" , request , HttpMethodName . GET ) ; return this . invokeHttpClient ( internalRequest , ListTemplateResponse . class ) ; }
|
Get the list of message template
| 71
| 6
|
152,343
|
public QueryQuotaResponse queryQuota ( SmsRequest request ) { checkNotNull ( request , "object request should not be null." ) ; InternalRequest internalRequest = this . createRequest ( "quota" , request , HttpMethodName . GET ) ; return this . invokeHttpClient ( internalRequest , QueryQuotaResponse . class ) ; }
|
Query the sending quota
| 75
| 4
|
152,344
|
public StatReceiverResponse statReceiver ( StatReceiverRequest request ) { checkNotNull ( request , "object request should not be null." ) ; assertStringNotNullOrEmpty ( request . getPhoneNumber ( ) , "object phoneNumber should not be null or empty." ) ; InternalRequest internalRequest = this . createRequest ( "receiver" , request , HttpMethodName . GET , request . getPhoneNumber ( ) ) ; return this . invokeHttpClient ( internalRequest , StatReceiverResponse . class ) ; }
|
Get the statistics about receiving message
| 112
| 6
|
152,345
|
public CreateDomainResponse createDomain ( CreateDomainRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( request , HttpMethodName . PUT , DOMAIN , request . getDomain ( ) ) ; this . attachRequestToBody ( request , internalRequest ) ; return invokeHttpClient ( internalRequest , CreateDomainResponse . class ) ; }
|
Create a new domain acceleration .
| 88
| 6
|
152,346
|
public EnableDomainResponse enableDomain ( EnableDomainRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( request , HttpMethodName . POST , DOMAIN , request . getDomain ( ) ) ; internalRequest . addParameter ( "enable" , "" ) ; return invokeHttpClient ( internalRequest , EnableDomainResponse . class ) ; }
|
Enable an existing domain acceleration .
| 87
| 6
|
152,347
|
public DisableDomainResponse disableDomain ( DisableDomainRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( request , HttpMethodName . POST , DOMAIN , request . getDomain ( ) ) ; internalRequest . addParameter ( "disable" , "" ) ; return invokeHttpClient ( internalRequest , DisableDomainResponse . class ) ; }
|
Disable an existing domain acceleration .
| 87
| 6
|
152,348
|
public DeleteDomainResponse deleteDomain ( DeleteDomainRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( request , HttpMethodName . DELETE , DOMAIN , request . getDomain ( ) ) ; return invokeHttpClient ( internalRequest , DeleteDomainResponse . class ) ; }
|
Delete an existing domain acceleration
| 76
| 5
|
152,349
|
public ListDomainsResponse listDomains ( ListDomainsRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( request , HttpMethodName . GET , DOMAIN ) ; return invokeHttpClient ( internalRequest , ListDomainsResponse . class ) ; }
|
Returns a list of all CDN domains that the authenticated sender of the request owns .
| 71
| 17
|
152,350
|
public GetDomainConfigResponse getDomainConfig ( GetDomainConfigRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( request , HttpMethodName . GET , DOMAIN , request . getDomain ( ) , "config" ) ; return invokeHttpClient ( internalRequest , GetDomainConfigResponse . class ) ; }
|
Get detailed information of a domain .
| 82
| 7
|
152,351
|
public SetDomainCacheTTLResponse setDomainCacheTTL ( SetDomainCacheTTLRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( request , HttpMethodName . PUT , DOMAIN , request . getDomain ( ) , "config" ) ; internalRequest . addParameter ( "cacheTTL" , "" ) ; this . attachRequestToBody ( request , internalRequest ) ; return invokeHttpClient ( internalRequest , SetDomainCacheTTLResponse . class ) ; }
|
Update cache policies of specified domain acceleration .
| 119
| 8
|
152,352
|
public SetDomainRefererACLResponse setDomainRefererACL ( SetDomainRefererACLRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( request , HttpMethodName . PUT , DOMAIN , request . getDomain ( ) , "config" ) ; internalRequest . addParameter ( "refererACL" , "" ) ; this . attachRequestToBody ( request , internalRequest ) ; return invokeHttpClient ( internalRequest , SetDomainRefererACLResponse . class ) ; }
|
Update RefererACL rules of specified domain acceleration .
| 124
| 11
|
152,353
|
public SetDomainIpACLResponse setDomainIpACL ( SetDomainIpACLRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( request , HttpMethodName . PUT , DOMAIN , request . getDomain ( ) , "config" ) ; internalRequest . addParameter ( "ipACL" , "" ) ; this . attachRequestToBody ( request , internalRequest ) ; return invokeHttpClient ( internalRequest , SetDomainIpACLResponse . class ) ; }
|
Update IpACL rules of specified domain acceleration .
| 123
| 11
|
152,354
|
public GetPurgeStatusResponse getPurgeStatus ( GetPurgeStatusRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , CACHE , "purge" ) ; if ( request . getId ( ) != null ) { internalRequest . addParameter ( "id" , request . getId ( ) ) ; } if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } if ( request . getMarker ( ) != null ) { internalRequest . addParameter ( "marker" , request . getMarker ( ) ) ; } if ( request . getUrl ( ) != null ) { internalRequest . addParameter ( "url" , request . getUrl ( ) ) ; } return this . invokeHttpClient ( internalRequest , GetPurgeStatusResponse . class ) ; }
|
Get purge status with specified attributes .
| 260
| 7
|
152,355
|
public GetPrefetchStatusResponse getPrefetchStatus ( GetPrefetchStatusRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , CACHE , "prefetch" ) ; if ( request . getId ( ) != null ) { internalRequest . addParameter ( "id" , request . getId ( ) ) ; } if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } if ( request . getMarker ( ) != null ) { internalRequest . addParameter ( "marker" , request . getMarker ( ) ) ; } if ( request . getUrl ( ) != null ) { internalRequest . addParameter ( "url" , request . getUrl ( ) ) ; } return this . invokeHttpClient ( internalRequest , GetPrefetchStatusResponse . class ) ; }
|
Get prefetch status with specified attributes .
| 261
| 8
|
152,356
|
public GetStatPvResponse getStatPv ( GetStatPvRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , STAT , "pv" ) ; if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } if ( request . getDomain ( ) != null ) { internalRequest . addParameter ( "domain" , request . getDomain ( ) ) ; } if ( request . getPeriod ( ) != null ) { internalRequest . addParameter ( "period" , String . valueOf ( request . getPeriod ( ) ) ) ; } if ( request . isWithRegion ( ) ) { internalRequest . addParameter ( "withRegion" , "" ) ; } return this . invokeHttpClient ( internalRequest , GetStatPvResponse . class ) ; }
|
Get pv statistics with specified attributes .
| 258
| 8
|
152,357
|
public GetStatFlowResponse getStatFlow ( GetStatFlowRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , STAT , "flow" ) ; if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } if ( request . getDomain ( ) != null ) { internalRequest . addParameter ( "domain" , request . getDomain ( ) ) ; } if ( request . getPeriod ( ) != null ) { internalRequest . addParameter ( "period" , String . valueOf ( request . getPeriod ( ) ) ) ; } if ( request . isWithRegion ( ) ) { internalRequest . addParameter ( "withRegion" , "" ) ; } return this . invokeHttpClient ( internalRequest , GetStatFlowResponse . class ) ; }
|
Get flow statistics with specified attributes .
| 253
| 7
|
152,358
|
public GetStatSrcFlowResponse getStatSrcFlow ( GetStatSrcFlowRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , STAT , "srcflow" ) ; if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } if ( request . getDomain ( ) != null ) { internalRequest . addParameter ( "domain" , request . getDomain ( ) ) ; } if ( request . getPeriod ( ) != null ) { internalRequest . addParameter ( "period" , String . valueOf ( request . getPeriod ( ) ) ) ; } return this . invokeHttpClient ( internalRequest , GetStatSrcFlowResponse . class ) ; }
|
Get origin flow statistics with specified attributes .
| 236
| 8
|
152,359
|
public GetStatHitRateResponse getStatHitRate ( GetStatHitRateRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , STAT , "hitrate" ) ; if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } if ( request . getDomain ( ) != null ) { internalRequest . addParameter ( "domain" , request . getDomain ( ) ) ; } if ( request . getPeriod ( ) != null ) { internalRequest . addParameter ( "period" , String . valueOf ( request . getPeriod ( ) ) ) ; } return this . invokeHttpClient ( internalRequest , GetStatHitRateResponse . class ) ; }
|
Get hit rate statistics with specified attributes .
| 232
| 8
|
152,360
|
public GetStatHttpCodeResponse getStatHttpCode ( GetStatHttpCodeRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , STAT , "httpcode" ) ; if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } if ( request . getDomain ( ) != null ) { internalRequest . addParameter ( "domain" , request . getDomain ( ) ) ; } if ( request . getPeriod ( ) != null ) { internalRequest . addParameter ( "period" , String . valueOf ( request . getPeriod ( ) ) ) ; } if ( request . isWithRegion ( ) ) { internalRequest . addParameter ( "withRegion" , "" ) ; } return this . invokeHttpClient ( internalRequest , GetStatHttpCodeResponse . class ) ; }
|
Get http code statistics with specified attributes .
| 258
| 8
|
152,361
|
public GetStatTopUrlResponse getStatTopUrl ( GetStatTopUrlRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , STAT , "topn" , "url" ) ; if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } if ( request . getDomain ( ) != null ) { internalRequest . addParameter ( "domain" , request . getDomain ( ) ) ; } if ( request . getPeriod ( ) != null ) { internalRequest . addParameter ( "period" , String . valueOf ( request . getPeriod ( ) ) ) ; } return this . invokeHttpClient ( internalRequest , GetStatTopUrlResponse . class ) ; }
|
Get top url statistics with specified attributes .
| 236
| 8
|
152,362
|
public GetStatTopRefererResponse getStatTopReferer ( GetStatTopRefererRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , STAT , "topn" , "referer" ) ; if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } if ( request . getDomain ( ) != null ) { internalRequest . addParameter ( "domain" , request . getDomain ( ) ) ; } if ( request . getPeriod ( ) != null ) { internalRequest . addParameter ( "period" , String . valueOf ( request . getPeriod ( ) ) ) ; } return this . invokeHttpClient ( internalRequest , GetStatTopRefererResponse . class ) ; }
|
Get top http referer statistics with specified attributes .
| 241
| 10
|
152,363
|
public GetStatUvResponse getStatUv ( GetStatUvRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , STAT , "uv" ) ; if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } if ( request . getDomain ( ) != null ) { internalRequest . addParameter ( "domain" , request . getDomain ( ) ) ; } if ( request . getPeriod ( ) != null ) { internalRequest . addParameter ( "period" , String . valueOf ( request . getPeriod ( ) ) ) ; } return this . invokeHttpClient ( internalRequest , GetStatUvResponse . class ) ; }
|
Get uv statistics with specified attributes .
| 231
| 8
|
152,364
|
public GetStatAvgSpeedResponse getStatAvgSpeed ( GetStatAvgSpeedRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , STAT , "avgspeed" ) ; if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } if ( request . getDomain ( ) != null ) { internalRequest . addParameter ( "domain" , request . getDomain ( ) ) ; } if ( request . getPeriod ( ) != null ) { internalRequest . addParameter ( "period" , String . valueOf ( request . getPeriod ( ) ) ) ; } return this . invokeHttpClient ( internalRequest , GetStatAvgSpeedResponse . class ) ; }
|
Get average speed statistics with specified attributes .
| 233
| 8
|
152,365
|
public GetCacheQuotaResponse getCacheQuota ( GetCacheQuotaRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , CACHE , "quota" ) ; return this . invokeHttpClient ( internalRequest , GetCacheQuotaResponse . class ) ; }
|
Get cache operation quota .
| 68
| 5
|
152,366
|
public GetDomainLogResponse getDomainLog ( GetDomainLogRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , LOG , request . getDomain ( ) , "log" ) ; if ( request . getStartTime ( ) != null ) { internalRequest . addParameter ( "startTime" , DateUtils . formatAlternateIso8601Date ( request . getStartTime ( ) ) ) ; } if ( request . getEndTime ( ) != null ) { internalRequest . addParameter ( "endTime" , DateUtils . formatAlternateIso8601Date ( request . getEndTime ( ) ) ) ; } return this . invokeHttpClient ( internalRequest , GetDomainLogResponse . class ) ; }
|
Get URLs of log files
| 164
| 5
|
152,367
|
public CreateEipResponse createEip ( CreateEipRequest request ) { checkNotNull ( request . getBandwidthInMbps ( ) , "bandwidthInMbps should not be null" ) ; if ( Strings . isNullOrEmpty ( request . getClientToken ( ) ) ) { request . setClientToken ( generateDefaultClientToken ( ) ) ; } if ( null == request . getBilling ( ) ) { request . setBilling ( generateDefaultBilling ( ) ) ; } checkNotNull ( request . getBandwidthInMbps ( ) , "bandwidthInMbps should not be null" ) ; InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . POST , null ) ; internalRequest . addParameter ( CLIENT_TOKEN_IDENTIFY , request . getClientToken ( ) ) ; fillPayload ( internalRequest , request ) ; return invokeHttpClient ( internalRequest , CreateEipResponse . class ) ; }
|
Create an eip with the specified options . This is an asynchronous interface
| 204
| 14
|
152,368
|
public void resizeEip ( ResizeEipRequest request ) { checkNotNull ( request . getNewBandwidthInMbps ( ) , "newBandwidthInMbps should not be null" ) ; checkStringNotEmpty ( request . getEip ( ) , "eip should not be empty" ) ; if ( Strings . isNullOrEmpty ( request . getClientToken ( ) ) ) { request . setClientToken ( generateDefaultClientToken ( ) ) ; } InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . PUT , request . getEip ( ) ) ; internalRequest . addParameter ( "resize" , null ) ; internalRequest . addParameter ( CLIENT_TOKEN_IDENTIFY , request . getClientToken ( ) ) ; fillPayload ( internalRequest , request ) ; invokeHttpClient ( internalRequest , AbstractBceResponse . class ) ; }
|
Resizing eip The Prepaid eip can not be downgrade . This is an asynchronous interface .
| 193
| 20
|
152,369
|
public void purchaseReservedEipInMonth ( String eip , int reservationLength ) { Billing billing = new Billing ( ) ; billing . setReservation ( new Billing . Reservation ( ) . withReservationLength ( reservationLength ) ) ; this . purchaseReservedEip ( new PurchaseReservedEipRequest ( ) . withEip ( eip ) . withBilling ( billing ) ) ; }
|
PurchaseReserved eip with specified duration in month
| 89
| 10
|
152,370
|
public void purchaseReservedEip ( PurchaseReservedEipRequest request ) { checkStringNotEmpty ( request . getEip ( ) , "eip should not be empty" ) ; if ( Strings . isNullOrEmpty ( request . getClientToken ( ) ) ) { request . setClientToken ( generateDefaultClientToken ( ) ) ; } if ( null == request . getBilling ( ) ) { request . setBilling ( generateDefaultReservation ( ) ) ; } InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . PUT , request . getEip ( ) ) ; internalRequest . addParameter ( "purchaseReserved" , null ) ; internalRequest . addParameter ( CLIENT_TOKEN_IDENTIFY , request . getClientToken ( ) ) ; fillPayload ( internalRequest , request ) ; invokeHttpClient ( internalRequest , AbstractBceResponse . class ) ; }
|
PurchaseReserved eip with fixed duration only Prepaid eip can do this
| 198
| 16
|
152,371
|
public void unbindEip ( UnbindEipRequest request ) { checkStringNotEmpty ( request . getEip ( ) , "eip should not be empty" ) ; if ( Strings . isNullOrEmpty ( request . getClientToken ( ) ) ) { request . setClientToken ( generateDefaultClientToken ( ) ) ; } InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . PUT , request . getEip ( ) ) ; internalRequest . addParameter ( "unbind" , null ) ; internalRequest . addParameter ( CLIENT_TOKEN_IDENTIFY , request . getClientToken ( ) ) ; internalRequest . addHeader ( Headers . CONTENT_LENGTH , "0" ) ; internalRequest . addHeader ( Headers . CONTENT_TYPE , DEFAULT_CONTENT_TYPE ) ; invokeHttpClient ( internalRequest , AbstractBceResponse . class ) ; }
|
unbind the eip from a specified instance
| 199
| 9
|
152,372
|
public ListEipsResponse listEips ( ListEipsRequest request ) { InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , null ) ; if ( ! Strings . isNullOrEmpty ( request . getMarker ( ) ) ) { internalRequest . addParameter ( "marker" , request . getMarker ( ) ) ; } if ( request . getMaxKeys ( ) >= 0 ) { internalRequest . addParameter ( "maxKeys" , String . valueOf ( request . getMaxKeys ( ) ) ) ; } if ( ! Strings . isNullOrEmpty ( request . getEip ( ) ) ) { internalRequest . addParameter ( "eip" , request . getEip ( ) ) ; } if ( ! Strings . isNullOrEmpty ( request . getInstanceId ( ) ) ) { internalRequest . addParameter ( "instanceId" , request . getInstanceId ( ) ) ; if ( Strings . isNullOrEmpty ( request . getInstanceType ( ) ) ) { throw new IllegalArgumentException ( "there is not instanceType" ) ; } } if ( ! Strings . isNullOrEmpty ( request . getInstanceType ( ) ) ) { internalRequest . addParameter ( "instanceType" , request . getInstanceType ( ) ) ; } return invokeHttpClient ( internalRequest , ListEipsResponse . class ) ; }
|
get a list of eips owned by the authenticated user and specified conditions
| 300
| 14
|
152,373
|
private Billing generateDefaultBilling ( ) { Billing billing = new Billing ( ) ; billing . setPaymentTiming ( "Postpaid" ) ; billing . setBillingMethod ( "ByBandwidth" ) ; return billing ; }
|
The method to generate a default Billing which is Postpaid .
| 52
| 13
|
152,374
|
protected long getDelayBeforeNextRetryInMillis ( HttpRequestBase method , BceClientException exception , int attempt , RetryPolicy retryPolicy ) { int retries = attempt - 1 ; int maxErrorRetry = retryPolicy . getMaxErrorRetry ( ) ; // Immediately fails when it has exceeds the max retry count. if ( retries >= maxErrorRetry ) { return - 1 ; } // Never retry on requests containing non-repeatable entity if ( method instanceof HttpEntityEnclosingRequest ) { HttpEntity entity = ( ( HttpEntityEnclosingRequest ) method ) . getEntity ( ) ; if ( entity != null && ! entity . isRepeatable ( ) ) { logger . debug ( "Entity not repeatable, stop retrying" ) ; return - 1 ; } } return Math . min ( retryPolicy . getMaxDelayInMillis ( ) , retryPolicy . getDelayBeforeNextRetryInMillis ( exception , retries ) ) ; }
|
Get delay time before next retry .
| 220
| 8
|
152,375
|
private HttpClientConnectionManager createHttpClientConnectionManager ( ) { ConnectionSocketFactory socketFactory = PlainConnectionSocketFactory . getSocketFactory ( ) ; LayeredConnectionSocketFactory sslSocketFactory ; try { sslSocketFactory = new SSLConnectionSocketFactory ( SSLContext . getDefault ( ) , SSLConnectionSocketFactory . STRICT_HOSTNAME_VERIFIER ) ; } catch ( NoSuchAlgorithmException e ) { throw new BceClientException ( "Fail to create SSLConnectionSocketFactory" , e ) ; } Registry < ConnectionSocketFactory > registry = RegistryBuilder . < ConnectionSocketFactory > create ( ) . register ( Protocol . HTTP . toString ( ) , socketFactory ) . register ( Protocol . HTTPS . toString ( ) , sslSocketFactory ) . build ( ) ; PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager ( registry ) ; connectionManager . setDefaultMaxPerRoute ( this . config . getMaxConnections ( ) ) ; connectionManager . setDefaultSocketConfig ( SocketConfig . custom ( ) . setSoTimeout ( this . config . getSocketTimeoutInMillis ( ) ) . setTcpNoDelay ( true ) . build ( ) ) ; connectionManager . setMaxTotal ( this . config . getMaxConnections ( ) ) ; return connectionManager ; }
|
Create connection manager for http client .
| 280
| 7
|
152,376
|
protected NHttpClientConnectionManager createNHttpClientConnectionManager ( ) throws IOReactorException { ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor ( IOReactorConfig . custom ( ) . setSoTimeout ( this . config . getSocketTimeoutInMillis ( ) ) . setTcpNoDelay ( true ) . build ( ) ) ; PoolingNHttpClientConnectionManager connectionManager = new PoolingNHttpClientConnectionManager ( ioReactor ) ; connectionManager . setDefaultMaxPerRoute ( this . config . getMaxConnections ( ) ) ; connectionManager . setMaxTotal ( this . config . getMaxConnections ( ) ) ; return connectionManager ; }
|
Create connection manager for asynchronous http client .
| 150
| 8
|
152,377
|
private CloseableHttpClient createHttpClient ( HttpClientConnectionManager connectionManager ) { HttpClientBuilder builder = HttpClients . custom ( ) . setConnectionManager ( connectionManager ) . disableAutomaticRetries ( ) ; int socketBufferSizeInBytes = this . config . getSocketBufferSizeInBytes ( ) ; if ( socketBufferSizeInBytes > 0 ) { builder . setDefaultConnectionConfig ( ConnectionConfig . custom ( ) . setBufferSize ( socketBufferSizeInBytes ) . build ( ) ) ; } return builder . build ( ) ; }
|
Create http client based on connection manager .
| 119
| 8
|
152,378
|
protected CloseableHttpAsyncClient createHttpAsyncClient ( NHttpClientConnectionManager connectionManager ) { HttpAsyncClientBuilder builder = HttpAsyncClients . custom ( ) . setConnectionManager ( connectionManager ) ; int socketBufferSizeInBytes = this . config . getSocketBufferSizeInBytes ( ) ; if ( socketBufferSizeInBytes > 0 ) { builder . setDefaultConnectionConfig ( ConnectionConfig . custom ( ) . setBufferSize ( socketBufferSizeInBytes ) . build ( ) ) ; } return builder . build ( ) ; }
|
Create asynchronous http client based on connection manager .
| 115
| 9
|
152,379
|
protected HttpRequestBase createHttpRequest ( InternalRequest request ) { String uri = request . getUri ( ) . toASCIIString ( ) ; String encodedParams = HttpUtils . getCanonicalQueryString ( request . getParameters ( ) , false ) ; if ( encodedParams . length ( ) > 0 ) { uri += "?" + encodedParams ; } HttpRequestBase httpRequest ; long contentLength = - 1 ; String contentLengthString = request . getHeaders ( ) . get ( Headers . CONTENT_LENGTH ) ; if ( contentLengthString != null ) { contentLength = Long . parseLong ( contentLengthString ) ; } if ( request . getHttpMethod ( ) == HttpMethodName . GET ) { httpRequest = new HttpGet ( uri ) ; } else if ( request . getHttpMethod ( ) == HttpMethodName . PUT ) { HttpPut putMethod = new HttpPut ( uri ) ; httpRequest = putMethod ; if ( request . getContent ( ) != null ) { putMethod . setEntity ( new InputStreamEntity ( request . getContent ( ) , contentLength ) ) ; } } else if ( request . getHttpMethod ( ) == HttpMethodName . POST ) { HttpPost postMethod = new HttpPost ( uri ) ; httpRequest = postMethod ; if ( request . getContent ( ) != null ) { postMethod . setEntity ( new InputStreamEntity ( request . getContent ( ) , contentLength ) ) ; } } else if ( request . getHttpMethod ( ) == HttpMethodName . DELETE ) { httpRequest = new HttpDelete ( uri ) ; } else if ( request . getHttpMethod ( ) == HttpMethodName . HEAD ) { httpRequest = new HttpHead ( uri ) ; } else { throw new BceClientException ( "Unknown HTTP method name: " + request . getHttpMethod ( ) ) ; } httpRequest . addHeader ( Headers . HOST , HttpUtils . generateHostHeader ( request . getUri ( ) ) ) ; // Copy over any other headers already in our request for ( Entry < String , String > entry : request . getHeaders ( ) . entrySet ( ) ) { /* * HttpClient4 fills in the Content-Length header and complains if it's already present, so we skip it here. * We also skip the Host header to avoid sending it twice, which will interfere with some signing schemes. */ if ( entry . getKey ( ) . equalsIgnoreCase ( Headers . CONTENT_LENGTH ) || entry . getKey ( ) . equalsIgnoreCase ( Headers . HOST ) ) { continue ; } httpRequest . addHeader ( entry . getKey ( ) , entry . getValue ( ) ) ; } checkNotNull ( httpRequest . getFirstHeader ( Headers . CONTENT_TYPE ) , Headers . CONTENT_TYPE + " not set" ) ; return httpRequest ; }
|
Creates HttpClient method object based on the specified request and populates any parameters headers etc . from the internal request .
| 647
| 25
|
152,380
|
protected HttpClientContext createHttpContext ( InternalRequest request ) { HttpClientContext context = HttpClientContext . create ( ) ; context . setRequestConfig ( this . requestConfigBuilder . setExpectContinueEnabled ( request . isExpectContinueEnabled ( ) ) . build ( ) ) ; if ( this . credentialsProvider != null ) { context . setCredentialsProvider ( this . credentialsProvider ) ; } if ( this . config . isProxyPreemptiveAuthenticationEnabled ( ) ) { AuthCache authCache = new BasicAuthCache ( ) ; authCache . put ( this . proxyHttpHost , new BasicScheme ( ) ) ; context . setAuthCache ( authCache ) ; } return context ; }
|
Creates HttpClient Context object based on the internal request .
| 152
| 13
|
152,381
|
public User getBosAccountOwner ( GetBosAccountOwnerRequest request ) { checkNotNull ( request , "request should not be null." ) ; return this . invokeHttpClient ( this . createRequest ( request , HttpMethodName . GET ) , ListBucketsResponse . class ) . getOwner ( ) ; }
|
Gets the current owner of the Bos account that the authenticated sender of the request is using .
| 69
| 19
|
152,382
|
public ListBucketsResponse listBuckets ( ListBucketsRequest request ) { checkNotNull ( request , "request should not be null." ) ; return this . invokeHttpClient ( this . createRequest ( request , HttpMethodName . GET ) , ListBucketsResponse . class ) ; }
|
Returns a list of all Bos buckets that the authenticated sender of the request owns .
| 66
| 16
|
152,383
|
public CreateBucketResponse createBucket ( CreateBucketRequest request ) { checkNotNull ( request , "request should not be null." ) ; InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . PUT ) ; this . setZeroContentLength ( internalRequest ) ; BosResponse response = this . invokeHttpClient ( internalRequest , BosResponse . class ) ; CreateBucketResponse result = new CreateBucketResponse ( ) ; result . setName ( request . getBucketName ( ) ) ; result . setLocation ( response . getMetadata ( ) . getLocation ( ) ) ; return result ; }
|
Creates a new Bos bucket with the specified name .
| 134
| 11
|
152,384
|
public boolean doesBucketExist ( DoesBucketExistRequest request ) { checkNotNull ( request , "request should not be null." ) ; try { this . invokeHttpClient ( this . createRequest ( request , HttpMethodName . HEAD ) , BosResponse . class ) ; return true ; } catch ( BceServiceException e ) { // Forbidden means that the bucket exists. if ( e . getStatusCode ( ) == StatusCodes . FORBIDDEN ) { return true ; } if ( e . getStatusCode ( ) == StatusCodes . NOT_FOUND ) { return false ; } throw e ; } }
|
Checks if the specified bucket exists . Bos buckets are named in a global namespace ; use this method to determine if a specified bucket name already exists and therefore can t be used to create a new bucket .
| 135
| 41
|
152,385
|
public GetBucketAclResponse getBucketAcl ( GetBucketAclRequest request ) { checkNotNull ( request , "request should not be null." ) ; InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET ) ; internalRequest . addParameter ( "acl" , null ) ; GetBucketAclResponse response = this . invokeHttpClient ( internalRequest , GetBucketAclResponse . class ) ; if ( response . getVersion ( ) > response . MAX_SUPPORTED_ACL_VERSION ) { throw new BceClientException ( "Unsupported acl version." ) ; } return response ; }
|
Gets the ACL for the specified Bos bucket .
| 141
| 10
|
152,386
|
public GetBucketLocationResponse getBucketLocation ( GetBucketLocationRequest request ) { checkNotNull ( request , "request should not be null." ) ; InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET ) ; internalRequest . addParameter ( "location" , null ) ; GetBucketLocationResponse response = this . invokeHttpClient ( internalRequest , GetBucketLocationResponse . class ) ; return response ; }
|
Gets the Location for the specified Bos bucket .
| 96
| 10
|
152,387
|
public void setBucketAcl ( SetBucketAclRequest request ) { checkNotNull ( request , "request should not be null." ) ; InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . PUT ) ; internalRequest . addParameter ( "acl" , null ) ; if ( request . getCannedAcl ( ) != null ) { internalRequest . addHeader ( Headers . BCE_ACL , request . getCannedAcl ( ) . toString ( ) ) ; this . setZeroContentLength ( internalRequest ) ; } else if ( request . getAccessControlList ( ) != null ) { byte [ ] json = null ; List < Grant > grants = request . getAccessControlList ( ) ; StringWriter writer = new StringWriter ( ) ; try { JsonGenerator jsonGenerator = JsonUtils . jsonGeneratorOf ( writer ) ; jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeArrayFieldStart ( "accessControlList" ) ; for ( Grant grant : grants ) { jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeArrayFieldStart ( "grantee" ) ; for ( Grantee grantee : grant . getGrantee ( ) ) { jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeStringField ( "id" , grantee . getId ( ) ) ; jsonGenerator . writeEndObject ( ) ; } jsonGenerator . writeEndArray ( ) ; jsonGenerator . writeArrayFieldStart ( "permission" ) ; for ( Permission permission : grant . getPermission ( ) ) { jsonGenerator . writeString ( permission . toString ( ) ) ; } jsonGenerator . writeEndArray ( ) ; jsonGenerator . writeEndObject ( ) ; } jsonGenerator . writeEndArray ( ) ; jsonGenerator . writeEndObject ( ) ; jsonGenerator . close ( ) ; } catch ( IOException e ) { throw new BceClientException ( "Fail to generate json" , e ) ; } try { json = writer . toString ( ) . getBytes ( DEFAULT_ENCODING ) ; } catch ( UnsupportedEncodingException e ) { throw new BceClientException ( "Fail to get UTF-8 bytes" , e ) ; } internalRequest . addHeader ( Headers . CONTENT_LENGTH , String . valueOf ( json . length ) ) ; internalRequest . addHeader ( Headers . CONTENT_TYPE , "application/json" ) ; internalRequest . setContent ( RestartableInputStream . wrap ( json ) ) ; } else if ( request . getJsonAcl ( ) != null ) { byte [ ] json = null ; try { json = request . getJsonAcl ( ) . getBytes ( DEFAULT_ENCODING ) ; } catch ( UnsupportedEncodingException e ) { throw new BceClientException ( "Fail to get UTF-8 bytes" , e ) ; } internalRequest . addHeader ( Headers . CONTENT_LENGTH , String . valueOf ( json . length ) ) ; internalRequest . addHeader ( Headers . CONTENT_TYPE , "application/json" ) ; internalRequest . setContent ( RestartableInputStream . wrap ( json ) ) ; } else { checkNotNull ( null , "request.acl should not be null." ) ; } this . invokeHttpClient ( internalRequest , BosResponse . class ) ; }
|
Sets the Acl for the specified Bos bucket .
| 744
| 11
|
152,388
|
public void deleteBucket ( DeleteBucketRequest request ) { checkNotNull ( request , "request should not be null." ) ; this . invokeHttpClient ( this . createRequest ( request , HttpMethodName . DELETE ) , BosResponse . class ) ; }
|
Deletes the specified bucket . All objects in the bucket must be deleted before the bucket itself can be deleted .
| 58
| 22
|
152,389
|
public ListObjectsResponse listNextBatchOfObjects ( ListObjectsResponse previousResponse ) { checkNotNull ( previousResponse , "previousResponse should not be null." ) ; if ( ! previousResponse . isTruncated ( ) ) { ListObjectsResponse emptyResponse = new ListObjectsResponse ( ) ; emptyResponse . setBucketName ( previousResponse . getBucketName ( ) ) ; emptyResponse . setDelimiter ( previousResponse . getDelimiter ( ) ) ; emptyResponse . setMarker ( previousResponse . getNextMarker ( ) ) ; emptyResponse . setMaxKeys ( previousResponse . getMaxKeys ( ) ) ; emptyResponse . setPrefix ( previousResponse . getPrefix ( ) ) ; emptyResponse . setTruncated ( false ) ; return emptyResponse ; } return this . listObjects ( new ListObjectsRequest ( previousResponse . getBucketName ( ) ) . withPrefix ( previousResponse . getPrefix ( ) ) . withMarker ( previousResponse . getNextMarker ( ) ) . withDelimiter ( previousResponse . getDelimiter ( ) ) . withMaxKeys ( previousResponse . getMaxKeys ( ) ) ) ; }
|
Provides an easy way to continue a truncated object listing and retrieve the next page of results .
| 259
| 20
|
152,390
|
public byte [ ] getObjectContent ( GetObjectRequest request ) { BosObjectInputStream content = this . getObject ( request ) . getObjectContent ( ) ; try { return IOUtils . toByteArray ( content ) ; } catch ( IOException e ) { try { content . close ( ) ; } catch ( IOException e1 ) { // ignore, throw e not e1. } throw new BceClientException ( "Fail read object content" , e ) ; } finally { try { content . close ( ) ; } catch ( IOException e ) { // ignore } } }
|
Gets the object content stored in Bos under the specified bucket and key .
| 125
| 15
|
152,391
|
public PutObjectResponse putObject ( String bucketName , String key , File file , ObjectMetadata metadata ) { return this . putObject ( new PutObjectRequest ( bucketName , key , file , metadata ) ) ; }
|
Uploads the specified file and object metadata to Bos under the specified bucket and key name .
| 46
| 18
|
152,392
|
public PutObjectResponse putObject ( String bucketName , String key , String value ) { try { return this . putObject ( bucketName , key , value . getBytes ( DEFAULT_ENCODING ) , new ObjectMetadata ( ) ) ; } catch ( UnsupportedEncodingException e ) { throw new BceClientException ( "Fail to get bytes." , e ) ; } }
|
Uploads the specified string to Bos under the specified bucket and key name .
| 82
| 15
|
152,393
|
public PutObjectResponse putObject ( String bucketName , String key , byte [ ] value , ObjectMetadata metadata ) { if ( metadata . getContentLength ( ) == - 1 ) { metadata . setContentLength ( value . length ) ; } return this . putObject ( new PutObjectRequest ( bucketName , key , RestartableInputStream . wrap ( value ) , metadata ) ) ; }
|
Uploads the specified bytes and object metadata to Bos under the specified bucket and key name .
| 83
| 18
|
152,394
|
public PutObjectResponse putObject ( String bucketName , String key , InputStream input ) { return this . putObject ( new PutObjectRequest ( bucketName , key , input ) ) ; }
|
Uploads the specified input stream to Bos under the specified bucket and key name .
| 40
| 16
|
152,395
|
public void deleteObject ( DeleteObjectRequest request ) { checkNotNull ( request , "request should not be null." ) ; assertStringNotNullOrEmpty ( request . getKey ( ) , "object key should not be null or empty" ) ; this . invokeHttpClient ( this . createRequest ( request , HttpMethodName . DELETE ) , BosResponse . class ) ; }
|
Deletes the specified object in the specified bucket .
| 82
| 10
|
152,396
|
public UploadPartResponse uploadPart ( UploadPartRequest request ) { checkNotNull ( request , "request should not be null." ) ; checkNotNull ( request . getPartSize ( ) , "partSize should not be null" ) ; checkNotNull ( request . getPartNumber ( ) , "partNumber should not be null" ) ; if ( request . getPartSize ( ) > 5 * 1024 * 1024 * 1024L ) { throw new BceClientException ( "PartNumber " + request . getPartNumber ( ) + " : Part Size should not be more than 5GB." ) ; } InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . PUT ) ; internalRequest . addParameter ( "uploadId" , request . getUploadId ( ) ) ; internalRequest . addParameter ( "partNumber" , String . valueOf ( request . getPartNumber ( ) ) ) ; internalRequest . addHeader ( Headers . CONTENT_LENGTH , String . valueOf ( request . getPartSize ( ) ) ) ; InputStream input = request . getInputStream ( ) ; MD5DigestCalculatingInputStream md5DigestStream = null ; if ( request . getMd5Digest ( ) == null ) { try { md5DigestStream = new MD5DigestCalculatingInputStream ( input ) ; input = md5DigestStream ; } catch ( NoSuchAlgorithmException e ) { logger . warn ( "Unable to verify data integrity." , e ) ; } } try { internalRequest . setContent ( this . wrapRestartableInputStream ( input ) ) ; BosResponse response = this . invokeHttpClient ( internalRequest , BosResponse . class ) ; if ( md5DigestStream != null ) { byte [ ] clientSideHash = md5DigestStream . getMd5Digest ( ) ; byte [ ] serverSideHash ; try { serverSideHash = Hex . decodeHex ( response . getMetadata ( ) . getETag ( ) . toCharArray ( ) ) ; } catch ( Exception e ) { throw new BceClientException ( "Unable to verify integrity of data upload." , e ) ; } if ( ! Arrays . equals ( clientSideHash , serverSideHash ) ) { throw new BceClientException ( "Unable to verify integrity of data upload. " + "Client calculated content hash didn't match hash calculated by " + "BOS. " + "You may need to delete the data stored in BOS." ) ; } } UploadPartResponse result = new UploadPartResponse ( ) ; result . setETag ( response . getMetadata ( ) . getETag ( ) ) ; result . setPartNumber ( request . getPartNumber ( ) ) ; return result ; } finally { if ( input != null ) { try { input . close ( ) ; } catch ( Exception e ) { } } } }
|
Uploads a part in a multipart upload . You must initiate a multipart upload before you can upload any part .
| 623
| 24
|
152,397
|
public ListMultipartUploadsResponse listMultipartUploads ( ListMultipartUploadsRequest request ) { checkNotNull ( request , "request should not be null." ) ; InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET ) ; internalRequest . addParameter ( "uploads" , null ) ; String keyMarker = request . getKeyMarker ( ) ; if ( keyMarker != null ) { internalRequest . addParameter ( "keyMarker" , keyMarker ) ; } int maxUploads = request . getMaxUploads ( ) ; if ( maxUploads >= 0 ) { internalRequest . addParameter ( "maxUploads" , String . valueOf ( maxUploads ) ) ; } String delimiter = request . getDelimiter ( ) ; if ( delimiter != null ) { internalRequest . addParameter ( "delimiter" , delimiter ) ; } String prefix = request . getPrefix ( ) ; if ( prefix != null ) { internalRequest . addParameter ( "prefix" , prefix ) ; } ListMultipartUploadsResponse response = this . invokeHttpClient ( internalRequest , ListMultipartUploadsResponse . class ) ; response . setBucketName ( request . getBucketName ( ) ) ; return response ; }
|
Lists in - progress multipart uploads . An in - progress multipart upload is a multipart upload that has been initiated using the InitiateMultipartUpload request but has not yet been completed or aborted .
| 281
| 44
|
152,398
|
private static void populateRequestMetadata ( InternalRequest request , ObjectMetadata metadata ) { if ( metadata . getContentType ( ) != null ) { request . addHeader ( Headers . CONTENT_TYPE , metadata . getContentType ( ) ) ; } if ( metadata . getContentMd5 ( ) != null ) { request . addHeader ( Headers . CONTENT_MD5 , metadata . getContentMd5 ( ) ) ; } if ( metadata . getContentEncoding ( ) != null ) { request . addHeader ( Headers . CONTENT_ENCODING , metadata . getContentEncoding ( ) ) ; } if ( metadata . getBceContentSha256 ( ) != null ) { request . addHeader ( Headers . BCE_CONTENT_SHA256 , metadata . getBceContentSha256 ( ) ) ; } if ( metadata . getContentDisposition ( ) != null ) { request . addHeader ( Headers . CONTENT_DISPOSITION , metadata . getContentDisposition ( ) ) ; } if ( metadata . getETag ( ) != null ) { request . addHeader ( Headers . ETAG , metadata . getETag ( ) ) ; } if ( metadata . getExpires ( ) != null ) { request . addHeader ( Headers . EXPIRES , metadata . getExpires ( ) ) ; } if ( metadata . getCacheControl ( ) != null ) { request . addHeader ( Headers . CACHE_CONTROL , metadata . getCacheControl ( ) ) ; } if ( metadata . getStorageClass ( ) != null ) { request . addHeader ( Headers . BCE_STORAGE_CLASS , metadata . getStorageClass ( ) ) ; } Map < String , String > userMetadata = metadata . getUserMetadata ( ) ; if ( userMetadata != null ) { for ( Entry < String , String > entry : userMetadata . entrySet ( ) ) { String key = entry . getKey ( ) ; if ( key == null ) { continue ; } String value = entry . getValue ( ) ; if ( value == null ) { value = "" ; } if ( key . length ( ) + value . length ( ) > 1024 * 32 ) { throw new BceClientException ( "MetadataTooLarge" ) ; } request . addHeader ( Headers . BCE_USER_METADATA_PREFIX + HttpUtils . normalize ( key . trim ( ) ) , HttpUtils . normalize ( value ) ) ; } } }
|
Populates the specified request object with the appropriate headers from the ObjectMetadata object .
| 544
| 17
|
152,399
|
private InternalRequest createRequest ( AbstractBceRequest bceRequest , HttpMethodName httpMethod ) { String bucketName = null ; String key = null ; // when custom_endpoint, bucketName should be null when set up InternalRequest. if ( bceRequest instanceof GenericBucketRequest && ! ( ( BosClientConfiguration ) this . config ) . isCnameEnabled ( ) ) { bucketName = ( ( GenericBucketRequest ) bceRequest ) . getBucketName ( ) ; } if ( bceRequest instanceof GenericObjectRequest ) { key = ( ( GenericObjectRequest ) bceRequest ) . getKey ( ) ; } InternalRequest request = new InternalRequest ( httpMethod , HttpUtils . appendUri ( this . getEndpoint ( ) , URL_PREFIX , bucketName , key ) ) ; request . setCredentials ( bceRequest . getRequestCredentials ( ) ) ; return request ; }
|
Creates and initializes a new request object for the specified Bos resource . This method is responsible for determining the right way to address resources .
| 202
| 28
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.