repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItemUpdate.java | BoxRequestItemUpdate.setDescription | public R setDescription(String description) {
mBodyMap.put(BoxItem.FIELD_DESCRIPTION, description);
return (R) this;
} | java | public R setDescription(String description) {
mBodyMap.put(BoxItem.FIELD_DESCRIPTION, description);
return (R) this;
} | [
"public",
"R",
"setDescription",
"(",
"String",
"description",
")",
"{",
"mBodyMap",
".",
"put",
"(",
"BoxItem",
".",
"FIELD_DESCRIPTION",
",",
"description",
")",
";",
"return",
"(",
"R",
")",
"this",
";",
"}"
] | Sets the new description for the item.
@param description description for the item.
@return request with the updated description. | [
"Sets",
"the",
"new",
"description",
"for",
"the",
"item",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItemUpdate.java#L84-L87 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItemUpdate.java | BoxRequestItemUpdate.getSharedLink | public BoxSharedLink getSharedLink() {
return mBodyMap.containsKey(BoxItem.FIELD_SHARED_LINK) ?
((BoxSharedLink) mBodyMap.get(BoxItem.FIELD_SHARED_LINK)) :
null;
} | java | public BoxSharedLink getSharedLink() {
return mBodyMap.containsKey(BoxItem.FIELD_SHARED_LINK) ?
((BoxSharedLink) mBodyMap.get(BoxItem.FIELD_SHARED_LINK)) :
null;
} | [
"public",
"BoxSharedLink",
"getSharedLink",
"(",
")",
"{",
"return",
"mBodyMap",
".",
"containsKey",
"(",
"BoxItem",
".",
"FIELD_SHARED_LINK",
")",
"?",
"(",
"(",
"BoxSharedLink",
")",
"mBodyMap",
".",
"get",
"(",
"BoxItem",
".",
"FIELD_SHARED_LINK",
")",
")",... | Returns the shared link currently set for the item.
@return shared link for the item, or null if not set. | [
"Returns",
"the",
"shared",
"link",
"currently",
"set",
"for",
"the",
"item",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItemUpdate.java#L117-L121 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItemUpdate.java | BoxRequestItemUpdate.setSharedLink | public R setSharedLink(BoxSharedLink sharedLink) {
mBodyMap.put(BoxItem.FIELD_SHARED_LINK, sharedLink);
return (R) this;
} | java | public R setSharedLink(BoxSharedLink sharedLink) {
mBodyMap.put(BoxItem.FIELD_SHARED_LINK, sharedLink);
return (R) this;
} | [
"public",
"R",
"setSharedLink",
"(",
"BoxSharedLink",
"sharedLink",
")",
"{",
"mBodyMap",
".",
"put",
"(",
"BoxItem",
".",
"FIELD_SHARED_LINK",
",",
"sharedLink",
")",
";",
"return",
"(",
"R",
")",
"this",
";",
"}"
] | Sets the new shared link for the item.
@param sharedLink new shared link for the item.
@return request with the updated shared link. | [
"Sets",
"the",
"new",
"shared",
"link",
"for",
"the",
"item",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItemUpdate.java#L129-L132 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItemUpdate.java | BoxRequestItemUpdate.getTags | public List<String> getTags() {
return mBodyMap.containsKey(BoxItem.FIELD_TAGS) ?
(List<String>) mBodyMap.get(BoxItem.FIELD_TAGS) :
null;
} | java | public List<String> getTags() {
return mBodyMap.containsKey(BoxItem.FIELD_TAGS) ?
(List<String>) mBodyMap.get(BoxItem.FIELD_TAGS) :
null;
} | [
"public",
"List",
"<",
"String",
">",
"getTags",
"(",
")",
"{",
"return",
"mBodyMap",
".",
"containsKey",
"(",
"BoxItem",
".",
"FIELD_TAGS",
")",
"?",
"(",
"List",
"<",
"String",
">",
")",
"mBodyMap",
".",
"get",
"(",
"BoxItem",
".",
"FIELD_TAGS",
")",... | Returns the tags currently set for the item.
@return tags for the item, or null if not set. | [
"Returns",
"the",
"tags",
"currently",
"set",
"for",
"the",
"item",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItemUpdate.java#L162-L166 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItemUpdate.java | BoxRequestItemUpdate.setTags | public R setTags(List<String> tags) {
JsonArray jsonArray = new JsonArray();
for (String s : tags) {
jsonArray.add(s);
}
mBodyMap.put(BoxItem.FIELD_TAGS, jsonArray);
return (R) this;
} | java | public R setTags(List<String> tags) {
JsonArray jsonArray = new JsonArray();
for (String s : tags) {
jsonArray.add(s);
}
mBodyMap.put(BoxItem.FIELD_TAGS, jsonArray);
return (R) this;
} | [
"public",
"R",
"setTags",
"(",
"List",
"<",
"String",
">",
"tags",
")",
"{",
"JsonArray",
"jsonArray",
"=",
"new",
"JsonArray",
"(",
")",
";",
"for",
"(",
"String",
"s",
":",
"tags",
")",
"{",
"jsonArray",
".",
"add",
"(",
"s",
")",
";",
"}",
"mB... | Sets the new tags for the item.
@param tags new tags for the item.
@return request with the updated tags. | [
"Sets",
"the",
"new",
"tags",
"for",
"the",
"item",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItemUpdate.java#L174-L181 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiComment.java | BoxApiComment.getInfoRequest | public BoxRequestsComment.GetCommentInfo getInfoRequest(String id) {
BoxRequestsComment.GetCommentInfo request = new BoxRequestsComment.GetCommentInfo(id, getCommentInfoUrl(id), mSession);
return request;
} | java | public BoxRequestsComment.GetCommentInfo getInfoRequest(String id) {
BoxRequestsComment.GetCommentInfo request = new BoxRequestsComment.GetCommentInfo(id, getCommentInfoUrl(id), mSession);
return request;
} | [
"public",
"BoxRequestsComment",
".",
"GetCommentInfo",
"getInfoRequest",
"(",
"String",
"id",
")",
"{",
"BoxRequestsComment",
".",
"GetCommentInfo",
"request",
"=",
"new",
"BoxRequestsComment",
".",
"GetCommentInfo",
"(",
"id",
",",
"getCommentInfoUrl",
"(",
"id",
"... | Gets a request that retrieves information on a comment
@param id id of comment to retrieve info on
@return request to get a comment's information | [
"Gets",
"a",
"request",
"that",
"retrieves",
"information",
"on",
"a",
"comment"
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiComment.java#L32-L35 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiComment.java | BoxApiComment.getAddCommentReplyRequest | public BoxRequestsComment.AddReplyComment getAddCommentReplyRequest(String commentId, String message) {
BoxRequestsComment.AddReplyComment request = new BoxRequestsComment.AddReplyComment(commentId, message, getCommentsUrl(), mSession);
return request;
} | java | public BoxRequestsComment.AddReplyComment getAddCommentReplyRequest(String commentId, String message) {
BoxRequestsComment.AddReplyComment request = new BoxRequestsComment.AddReplyComment(commentId, message, getCommentsUrl(), mSession);
return request;
} | [
"public",
"BoxRequestsComment",
".",
"AddReplyComment",
"getAddCommentReplyRequest",
"(",
"String",
"commentId",
",",
"String",
"message",
")",
"{",
"BoxRequestsComment",
".",
"AddReplyComment",
"request",
"=",
"new",
"BoxRequestsComment",
".",
"AddReplyComment",
"(",
"... | Gets a request that adds a reply comment to a comment
@param commentId id of the comment to reply to
@param message message for the comment that will be added
@return request to add a reply comment to a comment | [
"Gets",
"a",
"request",
"that",
"adds",
"a",
"reply",
"comment",
"to",
"a",
"comment"
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiComment.java#L44-L47 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiComment.java | BoxApiComment.getUpdateRequest | public BoxRequestsComment.UpdateComment getUpdateRequest(String id, String newMessage) {
BoxRequestsComment.UpdateComment request = new BoxRequestsComment.UpdateComment(id, newMessage, getCommentInfoUrl(id), mSession);
return request;
} | java | public BoxRequestsComment.UpdateComment getUpdateRequest(String id, String newMessage) {
BoxRequestsComment.UpdateComment request = new BoxRequestsComment.UpdateComment(id, newMessage, getCommentInfoUrl(id), mSession);
return request;
} | [
"public",
"BoxRequestsComment",
".",
"UpdateComment",
"getUpdateRequest",
"(",
"String",
"id",
",",
"String",
"newMessage",
")",
"{",
"BoxRequestsComment",
".",
"UpdateComment",
"request",
"=",
"new",
"BoxRequestsComment",
".",
"UpdateComment",
"(",
"id",
",",
"newM... | Gets a request that updates a comment's information
@param id id of comment to update information on
@param newMessage new message for the comment
@return request to update a comment's information | [
"Gets",
"a",
"request",
"that",
"updates",
"a",
"comment",
"s",
"information"
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiComment.java#L56-L59 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiComment.java | BoxApiComment.getDeleteRequest | public BoxRequestsComment.DeleteComment getDeleteRequest(String id) {
BoxRequestsComment.DeleteComment request = new BoxRequestsComment.DeleteComment(id, getCommentInfoUrl(id), mSession);
return request;
} | java | public BoxRequestsComment.DeleteComment getDeleteRequest(String id) {
BoxRequestsComment.DeleteComment request = new BoxRequestsComment.DeleteComment(id, getCommentInfoUrl(id), mSession);
return request;
} | [
"public",
"BoxRequestsComment",
".",
"DeleteComment",
"getDeleteRequest",
"(",
"String",
"id",
")",
"{",
"BoxRequestsComment",
".",
"DeleteComment",
"request",
"=",
"new",
"BoxRequestsComment",
".",
"DeleteComment",
"(",
"id",
",",
"getCommentInfoUrl",
"(",
"id",
")... | Gets a request that deletes a comment
@param id id of comment to delete
@return request to delete a comment | [
"Gets",
"a",
"request",
"that",
"deletes",
"a",
"comment"
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiComment.java#L67-L70 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxEntity.java | BoxEntity.getType | public String getType() {
String type = getPropertyAsString(FIELD_TYPE);
if (type == null){
return getPropertyAsString(FIELD_ITEM_TYPE);
}
return type;
} | java | public String getType() {
String type = getPropertyAsString(FIELD_TYPE);
if (type == null){
return getPropertyAsString(FIELD_ITEM_TYPE);
}
return type;
} | [
"public",
"String",
"getType",
"(",
")",
"{",
"String",
"type",
"=",
"getPropertyAsString",
"(",
"FIELD_TYPE",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"getPropertyAsString",
"(",
"FIELD_ITEM_TYPE",
")",
";",
"}",
"return",
"type",
";... | Gets the type of the entity.
@return the entity type. | [
"Gets",
"the",
"type",
"of",
"the",
"entity",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxEntity.java#L136-L142 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/ChooseAuthenticationFragment.java | ChooseAuthenticationFragment.createChooseAuthenticationFragment | public static ChooseAuthenticationFragment createChooseAuthenticationFragment(final Context context, final ArrayList<BoxAuthentication.BoxAuthenticationInfo> listOfAuthInfo){
ChooseAuthenticationFragment fragment = createAuthenticationActivity(context);
Bundle b = fragment.getArguments();
if (b == null){
b = new Bundle();
}
ArrayList<CharSequence> jsonSerialized = new ArrayList<CharSequence>(listOfAuthInfo.size());
for (BoxAuthentication.BoxAuthenticationInfo info : listOfAuthInfo){
jsonSerialized.add(info.toJson());
}
b.putCharSequenceArrayList(EXTRA_BOX_AUTHENTICATION_INFOS, jsonSerialized);
fragment.setArguments(b);
return fragment;
} | java | public static ChooseAuthenticationFragment createChooseAuthenticationFragment(final Context context, final ArrayList<BoxAuthentication.BoxAuthenticationInfo> listOfAuthInfo){
ChooseAuthenticationFragment fragment = createAuthenticationActivity(context);
Bundle b = fragment.getArguments();
if (b == null){
b = new Bundle();
}
ArrayList<CharSequence> jsonSerialized = new ArrayList<CharSequence>(listOfAuthInfo.size());
for (BoxAuthentication.BoxAuthenticationInfo info : listOfAuthInfo){
jsonSerialized.add(info.toJson());
}
b.putCharSequenceArrayList(EXTRA_BOX_AUTHENTICATION_INFOS, jsonSerialized);
fragment.setArguments(b);
return fragment;
} | [
"public",
"static",
"ChooseAuthenticationFragment",
"createChooseAuthenticationFragment",
"(",
"final",
"Context",
"context",
",",
"final",
"ArrayList",
"<",
"BoxAuthentication",
".",
"BoxAuthenticationInfo",
">",
"listOfAuthInfo",
")",
"{",
"ChooseAuthenticationFragment",
"f... | Create an instance of this fragment to display the given list of BoxAuthenticationInfos.
@param context current context
@param listOfAuthInfo a list of auth infos in the order to display to the user.
@return a fragment displaying list of authinfos provided above. | [
"Create",
"an",
"instance",
"of",
"this",
"fragment",
"to",
"display",
"the",
"given",
"list",
"of",
"BoxAuthenticationInfos",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/ChooseAuthenticationFragment.java#L103-L119 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxApiAuthentication.java | BoxApiAuthentication.refreshOAuth | BoxRefreshAuthRequest refreshOAuth(String refreshToken, String clientId, String clientSecret) {
BoxRefreshAuthRequest request = new BoxRefreshAuthRequest(mSession, getTokenUrl(), refreshToken, clientId, clientSecret);
return request;
} | java | BoxRefreshAuthRequest refreshOAuth(String refreshToken, String clientId, String clientSecret) {
BoxRefreshAuthRequest request = new BoxRefreshAuthRequest(mSession, getTokenUrl(), refreshToken, clientId, clientSecret);
return request;
} | [
"BoxRefreshAuthRequest",
"refreshOAuth",
"(",
"String",
"refreshToken",
",",
"String",
"clientId",
",",
"String",
"clientSecret",
")",
"{",
"BoxRefreshAuthRequest",
"request",
"=",
"new",
"BoxRefreshAuthRequest",
"(",
"mSession",
",",
"getTokenUrl",
"(",
")",
",",
"... | Refresh OAuth, to be called when OAuth expires. | [
"Refresh",
"OAuth",
"to",
"be",
"called",
"when",
"OAuth",
"expires",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxApiAuthentication.java#L50-L53 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxApiAuthentication.java | BoxApiAuthentication.createOAuth | BoxCreateAuthRequest createOAuth(String code, String clientId, String clientSecret) {
BoxCreateAuthRequest request = new BoxCreateAuthRequest(mSession, getTokenUrl(), code, clientId, clientSecret);
return request;
} | java | BoxCreateAuthRequest createOAuth(String code, String clientId, String clientSecret) {
BoxCreateAuthRequest request = new BoxCreateAuthRequest(mSession, getTokenUrl(), code, clientId, clientSecret);
return request;
} | [
"BoxCreateAuthRequest",
"createOAuth",
"(",
"String",
"code",
",",
"String",
"clientId",
",",
"String",
"clientSecret",
")",
"{",
"BoxCreateAuthRequest",
"request",
"=",
"new",
"BoxCreateAuthRequest",
"(",
"mSession",
",",
"getTokenUrl",
"(",
")",
",",
"code",
","... | Create OAuth, to be called the first time session tries to authenticate. | [
"Create",
"OAuth",
"to",
"be",
"called",
"the",
"first",
"time",
"session",
"tries",
"to",
"authenticate",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxApiAuthentication.java#L58-L61 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiShare.java | BoxApiShare.getSharedLinkRequest | public BoxRequestsShare.GetSharedLink getSharedLinkRequest(String sharedLink, String password) {
BoxSharedLinkSession session = null;
if (mSession instanceof BoxSharedLinkSession) {
session = (BoxSharedLinkSession)mSession;
} else {
session = new BoxSharedLinkSession(mSession);
}
session.setSharedLink(sharedLink);
session.setPassword(password);
BoxRequestsShare.GetSharedLink request = new BoxRequestsShare.GetSharedLink(getSharedItemsUrl(), session);
return request;
} | java | public BoxRequestsShare.GetSharedLink getSharedLinkRequest(String sharedLink, String password) {
BoxSharedLinkSession session = null;
if (mSession instanceof BoxSharedLinkSession) {
session = (BoxSharedLinkSession)mSession;
} else {
session = new BoxSharedLinkSession(mSession);
}
session.setSharedLink(sharedLink);
session.setPassword(password);
BoxRequestsShare.GetSharedLink request = new BoxRequestsShare.GetSharedLink(getSharedItemsUrl(), session);
return request;
} | [
"public",
"BoxRequestsShare",
".",
"GetSharedLink",
"getSharedLinkRequest",
"(",
"String",
"sharedLink",
",",
"String",
"password",
")",
"{",
"BoxSharedLinkSession",
"session",
"=",
"null",
";",
"if",
"(",
"mSession",
"instanceof",
"BoxSharedLinkSession",
")",
"{",
... | Returns a request to get a BoxItem from a shared link.
@param sharedLink shared link of the item to retrieve.
@param password password for shared link
@return request to get a BoxItem from a shared link. | [
"Returns",
"a",
"request",
"to",
"get",
"a",
"BoxItem",
"from",
"a",
"shared",
"link",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiShare.java#L43-L55 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/views/DefaultAvatarController.java | DefaultAvatarController.cleanOutOldAvatars | protected void cleanOutOldAvatars(File directory, int maxLifeInDays){
if (directory != null){
if (mCleanedDirectories.contains(directory.getAbsolutePath())){
return;
}
long oldestTimeAllowed = System.currentTimeMillis() - maxLifeInDays * TimeUnit.DAYS.toMillis(maxLifeInDays);
File[] files = directory.listFiles();
if (files != null){
for (File file : files){
if (file.getName().startsWith(DEFAULT_AVATAR_FILE_PREFIX) && file.lastModified() < oldestTimeAllowed){
file.delete();
}
}
}
}
} | java | protected void cleanOutOldAvatars(File directory, int maxLifeInDays){
if (directory != null){
if (mCleanedDirectories.contains(directory.getAbsolutePath())){
return;
}
long oldestTimeAllowed = System.currentTimeMillis() - maxLifeInDays * TimeUnit.DAYS.toMillis(maxLifeInDays);
File[] files = directory.listFiles();
if (files != null){
for (File file : files){
if (file.getName().startsWith(DEFAULT_AVATAR_FILE_PREFIX) && file.lastModified() < oldestTimeAllowed){
file.delete();
}
}
}
}
} | [
"protected",
"void",
"cleanOutOldAvatars",
"(",
"File",
"directory",
",",
"int",
"maxLifeInDays",
")",
"{",
"if",
"(",
"directory",
"!=",
"null",
")",
"{",
"if",
"(",
"mCleanedDirectories",
".",
"contains",
"(",
"directory",
".",
"getAbsolutePath",
"(",
")",
... | Delete all files for user that is older than maxLifeInDays
@param directory the directory where avatar files are being held.
@param maxLifeInDays the number of days avatar files are allowed to live for. | [
"Delete",
"all",
"files",
"for",
"user",
"that",
"is",
"older",
"than",
"maxLifeInDays"
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/views/DefaultAvatarController.java#L88-L103 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java | BoxRequestUpdateSharedItem.getAccess | public BoxSharedLink.Access getAccess() {
return mBodyMap.containsKey(BoxItem.FIELD_SHARED_LINK) ?
((BoxSharedLink) mBodyMap.get(BoxItem.FIELD_SHARED_LINK)).getAccess() :
null;
} | java | public BoxSharedLink.Access getAccess() {
return mBodyMap.containsKey(BoxItem.FIELD_SHARED_LINK) ?
((BoxSharedLink) mBodyMap.get(BoxItem.FIELD_SHARED_LINK)).getAccess() :
null;
} | [
"public",
"BoxSharedLink",
".",
"Access",
"getAccess",
"(",
")",
"{",
"return",
"mBodyMap",
".",
"containsKey",
"(",
"BoxItem",
".",
"FIELD_SHARED_LINK",
")",
"?",
"(",
"(",
"BoxSharedLink",
")",
"mBodyMap",
".",
"get",
"(",
"BoxItem",
".",
"FIELD_SHARED_LINK"... | Gets the shared link access currently set for the item in the request.
@return shared link access for the item, or null if not set. | [
"Gets",
"the",
"shared",
"link",
"access",
"currently",
"set",
"for",
"the",
"item",
"in",
"the",
"request",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java#L37-L41 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java | BoxRequestUpdateSharedItem.setAccess | public R setAccess(BoxSharedLink.Access access) {
JsonObject jsonObject = getSharedLinkJsonObject();
jsonObject.add(BoxSharedLink.FIELD_ACCESS, SdkUtils.getAsStringSafely(access));
BoxSharedLink sharedLink = new BoxSharedLink(jsonObject);
mBodyMap.put(BoxItem.FIELD_SHARED_LINK, sharedLink);
return (R) this;
} | java | public R setAccess(BoxSharedLink.Access access) {
JsonObject jsonObject = getSharedLinkJsonObject();
jsonObject.add(BoxSharedLink.FIELD_ACCESS, SdkUtils.getAsStringSafely(access));
BoxSharedLink sharedLink = new BoxSharedLink(jsonObject);
mBodyMap.put(BoxItem.FIELD_SHARED_LINK, sharedLink);
return (R) this;
} | [
"public",
"R",
"setAccess",
"(",
"BoxSharedLink",
".",
"Access",
"access",
")",
"{",
"JsonObject",
"jsonObject",
"=",
"getSharedLinkJsonObject",
"(",
")",
";",
"jsonObject",
".",
"add",
"(",
"BoxSharedLink",
".",
"FIELD_ACCESS",
",",
"SdkUtils",
".",
"getAsStrin... | Sets the shared link access for the item in the request.
@param access new shared link access for the item.
@return request with the updated shared link access. | [
"Sets",
"the",
"shared",
"link",
"access",
"for",
"the",
"item",
"in",
"the",
"request",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java#L49-L55 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java | BoxRequestUpdateSharedItem.getUnsharedAt | public Date getUnsharedAt() {
if(mBodyMap.containsKey(BoxItem.FIELD_SHARED_LINK)) {
return ((BoxSharedLink) mBodyMap.get(BoxItem.FIELD_SHARED_LINK)).getUnsharedDate();
}
return null;
} | java | public Date getUnsharedAt() {
if(mBodyMap.containsKey(BoxItem.FIELD_SHARED_LINK)) {
return ((BoxSharedLink) mBodyMap.get(BoxItem.FIELD_SHARED_LINK)).getUnsharedDate();
}
return null;
} | [
"public",
"Date",
"getUnsharedAt",
"(",
")",
"{",
"if",
"(",
"mBodyMap",
".",
"containsKey",
"(",
"BoxItem",
".",
"FIELD_SHARED_LINK",
")",
")",
"{",
"return",
"(",
"(",
"BoxSharedLink",
")",
"mBodyMap",
".",
"get",
"(",
"BoxItem",
".",
"FIELD_SHARED_LINK",
... | Returns the date the link will be disabled at currently set in the request.
@return date the shared link will be disabled at, or null if not set. | [
"Returns",
"the",
"date",
"the",
"link",
"will",
"be",
"disabled",
"at",
"currently",
"set",
"in",
"the",
"request",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java#L62-L67 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java | BoxRequestUpdateSharedItem.getPassword | public String getPassword(){
return mBodyMap.containsKey(BoxItem.FIELD_SHARED_LINK) ?
((BoxSharedLink) mBodyMap.get(BoxItem.FIELD_SHARED_LINK)).getPassword() :
null;
} | java | public String getPassword(){
return mBodyMap.containsKey(BoxItem.FIELD_SHARED_LINK) ?
((BoxSharedLink) mBodyMap.get(BoxItem.FIELD_SHARED_LINK)).getPassword() :
null;
} | [
"public",
"String",
"getPassword",
"(",
")",
"{",
"return",
"mBodyMap",
".",
"containsKey",
"(",
"BoxItem",
".",
"FIELD_SHARED_LINK",
")",
"?",
"(",
"(",
"BoxSharedLink",
")",
"mBodyMap",
".",
"get",
"(",
"BoxItem",
".",
"FIELD_SHARED_LINK",
")",
")",
".",
... | Returns the shared link password currently set in the request.
@return the password for the item's shared link, or null if not set. | [
"Returns",
"the",
"shared",
"link",
"password",
"currently",
"set",
"in",
"the",
"request",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java#L105-L109 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java | BoxRequestUpdateSharedItem.setPassword | public R setPassword(final String password){
JsonObject jsonObject = getSharedLinkJsonObject();
jsonObject.add(BoxSharedLink.FIELD_PASSWORD, password);
BoxSharedLink sharedLink = new BoxSharedLink(jsonObject);
mBodyMap.put(BoxItem.FIELD_SHARED_LINK, sharedLink);
return (R) this;
} | java | public R setPassword(final String password){
JsonObject jsonObject = getSharedLinkJsonObject();
jsonObject.add(BoxSharedLink.FIELD_PASSWORD, password);
BoxSharedLink sharedLink = new BoxSharedLink(jsonObject);
mBodyMap.put(BoxItem.FIELD_SHARED_LINK, sharedLink);
return (R) this;
} | [
"public",
"R",
"setPassword",
"(",
"final",
"String",
"password",
")",
"{",
"JsonObject",
"jsonObject",
"=",
"getSharedLinkJsonObject",
"(",
")",
";",
"jsonObject",
".",
"add",
"(",
"BoxSharedLink",
".",
"FIELD_PASSWORD",
",",
"password",
")",
";",
"BoxSharedLin... | Sets the shared link password in the request.
@param password new password for the shared link, or null to remove the password.
@return request with the updated shared link password. | [
"Sets",
"the",
"shared",
"link",
"password",
"in",
"the",
"request",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java#L117-L123 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java | BoxRequestUpdateSharedItem.getCanDownload | protected Boolean getCanDownload() {
return mBodyMap.containsKey(BoxItem.FIELD_SHARED_LINK) ?
((BoxSharedLink) mBodyMap.get(BoxItem.FIELD_SHARED_LINK)).getPermissions().getCanDownload() :
null;
} | java | protected Boolean getCanDownload() {
return mBodyMap.containsKey(BoxItem.FIELD_SHARED_LINK) ?
((BoxSharedLink) mBodyMap.get(BoxItem.FIELD_SHARED_LINK)).getPermissions().getCanDownload() :
null;
} | [
"protected",
"Boolean",
"getCanDownload",
"(",
")",
"{",
"return",
"mBodyMap",
".",
"containsKey",
"(",
"BoxItem",
".",
"FIELD_SHARED_LINK",
")",
"?",
"(",
"(",
"BoxSharedLink",
")",
"mBodyMap",
".",
"get",
"(",
"BoxItem",
".",
"FIELD_SHARED_LINK",
")",
")",
... | Returns the value for whether the shared link allows downloads currently set in the request.
@return Boolean for whether the shared link allows downloads, or null if not set. | [
"Returns",
"the",
"value",
"for",
"whether",
"the",
"shared",
"link",
"allows",
"downloads",
"currently",
"set",
"in",
"the",
"request",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java#L130-L134 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java | BoxRequestUpdateSharedItem.setCanDownload | protected R setCanDownload(boolean canDownload) {
JsonObject jsonPermissionsObject = getPermissionsJsonObject();
jsonPermissionsObject.add(BoxSharedLink.Permissions.FIELD_CAN_DOWNLOAD, canDownload);
BoxSharedLink.Permissions permissions = new BoxSharedLink.Permissions(jsonPermissionsObject);
JsonObject sharedLinkJsonObject = getSharedLinkJsonObject();
sharedLinkJsonObject.add(BoxSharedLink.FIELD_PERMISSIONS, permissions.toJsonObject());
BoxSharedLink sharedLink = new BoxSharedLink(sharedLinkJsonObject);
mBodyMap.put(BoxItem.FIELD_SHARED_LINK, sharedLink);
return (R) this;
} | java | protected R setCanDownload(boolean canDownload) {
JsonObject jsonPermissionsObject = getPermissionsJsonObject();
jsonPermissionsObject.add(BoxSharedLink.Permissions.FIELD_CAN_DOWNLOAD, canDownload);
BoxSharedLink.Permissions permissions = new BoxSharedLink.Permissions(jsonPermissionsObject);
JsonObject sharedLinkJsonObject = getSharedLinkJsonObject();
sharedLinkJsonObject.add(BoxSharedLink.FIELD_PERMISSIONS, permissions.toJsonObject());
BoxSharedLink sharedLink = new BoxSharedLink(sharedLinkJsonObject);
mBodyMap.put(BoxItem.FIELD_SHARED_LINK, sharedLink);
return (R) this;
} | [
"protected",
"R",
"setCanDownload",
"(",
"boolean",
"canDownload",
")",
"{",
"JsonObject",
"jsonPermissionsObject",
"=",
"getPermissionsJsonObject",
"(",
")",
";",
"jsonPermissionsObject",
".",
"add",
"(",
"BoxSharedLink",
".",
"Permissions",
".",
"FIELD_CAN_DOWNLOAD",
... | Sets whether the shared link allows downloads in the request.
@param canDownload new value for whether the shared link allows downloads.
@return request with the updated value for whether the shared link allows downloads. | [
"Sets",
"whether",
"the",
"shared",
"link",
"allows",
"downloads",
"in",
"the",
"request",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestUpdateSharedItem.java#L142-L152 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItem.java | BoxRequestItem.setFields | public R setFields(String... fields) {
if (fields.length == 1 && fields[0] == null){
mQueryMap.remove(QUERY_FIELDS);
return (R) this;
}
if (fields.length > 0) {
StringBuilder sb = new StringBuilder();
sb.append(fields[0]);
for (int i = 1; i < fields.length; ++i) {
sb.append(String.format(Locale.ENGLISH, ",%s", fields[i]));
}
mQueryMap.put(QUERY_FIELDS, sb.toString());
}
return (R) this;
} | java | public R setFields(String... fields) {
if (fields.length == 1 && fields[0] == null){
mQueryMap.remove(QUERY_FIELDS);
return (R) this;
}
if (fields.length > 0) {
StringBuilder sb = new StringBuilder();
sb.append(fields[0]);
for (int i = 1; i < fields.length; ++i) {
sb.append(String.format(Locale.ENGLISH, ",%s", fields[i]));
}
mQueryMap.put(QUERY_FIELDS, sb.toString());
}
return (R) this;
} | [
"public",
"R",
"setFields",
"(",
"String",
"...",
"fields",
")",
"{",
"if",
"(",
"fields",
".",
"length",
"==",
"1",
"&&",
"fields",
"[",
"0",
"]",
"==",
"null",
")",
"{",
"mQueryMap",
".",
"remove",
"(",
"QUERY_FIELDS",
")",
";",
"return",
"(",
"R... | Sets the fields to return in the response.
@param fields fields to return in the response.
@return request with the updated fields. | [
"Sets",
"the",
"fields",
"to",
"return",
"in",
"the",
"response",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItem.java#L50-L65 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItem.java | BoxRequestItem.addRepresentationHintGroup | public R addRepresentationHintGroup(String... hints) {
if(hints != null) {
mHintHeader.append("[");
mHintHeader.append(TextUtils.join(",", hints));
mHintHeader.append("]");
}
return (R) this;
} | java | public R addRepresentationHintGroup(String... hints) {
if(hints != null) {
mHintHeader.append("[");
mHintHeader.append(TextUtils.join(",", hints));
mHintHeader.append("]");
}
return (R) this;
} | [
"public",
"R",
"addRepresentationHintGroup",
"(",
"String",
"...",
"hints",
")",
"{",
"if",
"(",
"hints",
"!=",
"null",
")",
"{",
"mHintHeader",
".",
"append",
"(",
"\"[\"",
")",
";",
"mHintHeader",
".",
"append",
"(",
"TextUtils",
".",
"join",
"(",
"\",... | Include a representation hint group into this request.
Please refer to representation documentation for more details
@param hints string list with all the representation hints
@return request with updated hint group | [
"Include",
"a",
"representation",
"hint",
"group",
"into",
"this",
"request",
".",
"Please",
"refer",
"to",
"representation",
"documentation",
"for",
"more",
"details"
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestItem.java#L73-L80 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java | OAuthActivity.onReceivedAuthCode | public void onReceivedAuthCode(String code, String baseDomain) {
if (authType == AUTH_TYPE_WEBVIEW) {
oauthView.setVisibility(View.INVISIBLE);
}
startMakingOAuthAPICall(code, baseDomain);
} | java | public void onReceivedAuthCode(String code, String baseDomain) {
if (authType == AUTH_TYPE_WEBVIEW) {
oauthView.setVisibility(View.INVISIBLE);
}
startMakingOAuthAPICall(code, baseDomain);
} | [
"public",
"void",
"onReceivedAuthCode",
"(",
"String",
"code",
",",
"String",
"baseDomain",
")",
"{",
"if",
"(",
"authType",
"==",
"AUTH_TYPE_WEBVIEW",
")",
"{",
"oauthView",
".",
"setVisibility",
"(",
"View",
".",
"INVISIBLE",
")",
";",
"}",
"startMakingOAuth... | Callback method to be called when authentication code is received along with a base domain. The code will then be used to make an API call to create OAuth tokens. | [
"Callback",
"method",
"to",
"be",
"called",
"when",
"authentication",
"code",
"is",
"received",
"along",
"with",
"a",
"base",
"domain",
".",
"The",
"code",
"will",
"then",
"be",
"used",
"to",
"make",
"an",
"API",
"call",
"to",
"create",
"OAuth",
"tokens",
... | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java#L172-L177 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java | OAuthActivity.onAuthFailure | public boolean onAuthFailure(AuthFailure failure) {
if (failure.type == OAuthWebView.AuthFailure.TYPE_WEB_ERROR){
if (failure.mWebException.getErrorCode() == WebViewClient.ERROR_CONNECT || failure.mWebException.getErrorCode() == WebViewClient.ERROR_HOST_LOOKUP || failure.mWebException.getErrorCode() == WebViewClient.ERROR_TIMEOUT){
return false;
}
Resources resources = this.getResources();
Toast.makeText(
this,
String.format("%s\n%s: %s", resources.getString(com.box.sdk.android.R.string.boxsdk_Authentication_fail), resources.getString(com.box.sdk.android.R.string.boxsdk_details),
failure.mWebException.getErrorCode() + " " + failure.mWebException.getDescription()), Toast.LENGTH_LONG).show();
} else if (SdkUtils.isEmptyString(failure.message)) {
Toast.makeText(this, R.string.boxsdk_Authentication_fail, Toast.LENGTH_LONG).show();
} else {
switch (failure.type) {
case OAuthWebView.AuthFailure.TYPE_URL_MISMATCH:
Resources resources = this.getResources();
Toast.makeText(
this,
String.format("%s\n%s: %s", resources.getString(com.box.sdk.android.R.string.boxsdk_Authentication_fail), resources.getString(com.box.sdk.android.R.string.boxsdk_details),
resources.getString(com.box.sdk.android.R.string.boxsdk_Authentication_fail_url_mismatch)), Toast.LENGTH_LONG).show();
break;
case OAuthWebView.AuthFailure.TYPE_AUTHENTICATION_UNAUTHORIZED:
AlertDialog loginAlert = new AlertDialog.Builder(this)
.setTitle(com.box.sdk.android.R.string.boxsdk_Authentication_fail)
.setMessage(com.box.sdk.android.R.string.boxsdk_Authentication_fail_forbidden)
.setPositiveButton(com.box.sdk.android.R.string.boxsdk_button_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int whichButton) {
dialog.dismiss();
finish();
}
}).create();
loginAlert.show();
return true;
default:
Toast.makeText(this, com.box.sdk.android.R.string.boxsdk_Authentication_fail, Toast.LENGTH_LONG).show();
}
}
finish();
return true;
} | java | public boolean onAuthFailure(AuthFailure failure) {
if (failure.type == OAuthWebView.AuthFailure.TYPE_WEB_ERROR){
if (failure.mWebException.getErrorCode() == WebViewClient.ERROR_CONNECT || failure.mWebException.getErrorCode() == WebViewClient.ERROR_HOST_LOOKUP || failure.mWebException.getErrorCode() == WebViewClient.ERROR_TIMEOUT){
return false;
}
Resources resources = this.getResources();
Toast.makeText(
this,
String.format("%s\n%s: %s", resources.getString(com.box.sdk.android.R.string.boxsdk_Authentication_fail), resources.getString(com.box.sdk.android.R.string.boxsdk_details),
failure.mWebException.getErrorCode() + " " + failure.mWebException.getDescription()), Toast.LENGTH_LONG).show();
} else if (SdkUtils.isEmptyString(failure.message)) {
Toast.makeText(this, R.string.boxsdk_Authentication_fail, Toast.LENGTH_LONG).show();
} else {
switch (failure.type) {
case OAuthWebView.AuthFailure.TYPE_URL_MISMATCH:
Resources resources = this.getResources();
Toast.makeText(
this,
String.format("%s\n%s: %s", resources.getString(com.box.sdk.android.R.string.boxsdk_Authentication_fail), resources.getString(com.box.sdk.android.R.string.boxsdk_details),
resources.getString(com.box.sdk.android.R.string.boxsdk_Authentication_fail_url_mismatch)), Toast.LENGTH_LONG).show();
break;
case OAuthWebView.AuthFailure.TYPE_AUTHENTICATION_UNAUTHORIZED:
AlertDialog loginAlert = new AlertDialog.Builder(this)
.setTitle(com.box.sdk.android.R.string.boxsdk_Authentication_fail)
.setMessage(com.box.sdk.android.R.string.boxsdk_Authentication_fail_forbidden)
.setPositiveButton(com.box.sdk.android.R.string.boxsdk_button_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int whichButton) {
dialog.dismiss();
finish();
}
}).create();
loginAlert.show();
return true;
default:
Toast.makeText(this, com.box.sdk.android.R.string.boxsdk_Authentication_fail, Toast.LENGTH_LONG).show();
}
}
finish();
return true;
} | [
"public",
"boolean",
"onAuthFailure",
"(",
"AuthFailure",
"failure",
")",
"{",
"if",
"(",
"failure",
".",
"type",
"==",
"OAuthWebView",
".",
"AuthFailure",
".",
"TYPE_WEB_ERROR",
")",
"{",
"if",
"(",
"failure",
".",
"mWebException",
".",
"getErrorCode",
"(",
... | Callback method to be called when authentication failed. | [
"Callback",
"method",
"to",
"be",
"called",
"when",
"authentication",
"failed",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java#L196-L237 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java | OAuthActivity.startMakingOAuthAPICall | protected void startMakingOAuthAPICall(final String code, final String baseDomain) {
if (apiCallStarted.getAndSet(true)) {
return;
}
showSpinner();
if (baseDomain != null) {
mSession.getAuthInfo().setBaseDomain(baseDomain);
BoxLogUtils.nonFatalE("setting Base Domain", baseDomain, new RuntimeException("base domain being used"));
}
new Thread(){
public void run(){
try {
BoxAuthenticationInfo sessionAuth = BoxAuthentication.getInstance().create(mSession, code).get();
String restrictedUserId = getIntent().getStringExtra(EXTRA_USER_ID_RESTRICTION);
if (!SdkUtils.isEmptyString(restrictedUserId) && !sessionAuth.getUser().getId().equals(restrictedUserId)){
// the user logged in as does not match the user id this activity was restricted to, treat this as a failure.
throw new RuntimeException("Unexpected user logged in. Expected "+ restrictedUserId + " received " + sessionAuth.getUser().getId());
}
dismissSpinnerAndFinishAuthenticate(sessionAuth);
} catch (Exception e){
e.printStackTrace();
dismissSpinnerAndFailAuthenticate(e);
}
}
}.start();
} | java | protected void startMakingOAuthAPICall(final String code, final String baseDomain) {
if (apiCallStarted.getAndSet(true)) {
return;
}
showSpinner();
if (baseDomain != null) {
mSession.getAuthInfo().setBaseDomain(baseDomain);
BoxLogUtils.nonFatalE("setting Base Domain", baseDomain, new RuntimeException("base domain being used"));
}
new Thread(){
public void run(){
try {
BoxAuthenticationInfo sessionAuth = BoxAuthentication.getInstance().create(mSession, code).get();
String restrictedUserId = getIntent().getStringExtra(EXTRA_USER_ID_RESTRICTION);
if (!SdkUtils.isEmptyString(restrictedUserId) && !sessionAuth.getUser().getId().equals(restrictedUserId)){
// the user logged in as does not match the user id this activity was restricted to, treat this as a failure.
throw new RuntimeException("Unexpected user logged in. Expected "+ restrictedUserId + " received " + sessionAuth.getUser().getId());
}
dismissSpinnerAndFinishAuthenticate(sessionAuth);
} catch (Exception e){
e.printStackTrace();
dismissSpinnerAndFailAuthenticate(e);
}
}
}.start();
} | [
"protected",
"void",
"startMakingOAuthAPICall",
"(",
"final",
"String",
"code",
",",
"final",
"String",
"baseDomain",
")",
"{",
"if",
"(",
"apiCallStarted",
".",
"getAndSet",
"(",
"true",
")",
")",
"{",
"return",
";",
"}",
"showSpinner",
"(",
")",
";",
"if... | Start to create OAuth after getting the code.
@param code
OAuth 2 authorization code
@param baseDomain
base domain used for changing host if applicable. | [
"Start",
"to",
"create",
"OAuth",
"after",
"getting",
"the",
"code",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java#L376-L404 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java | OAuthActivity.showDialogWhileWaitingForAuthenticationAPICall | protected Dialog showDialogWhileWaitingForAuthenticationAPICall() {
return ProgressDialog.show(this, getText(R.string.boxsdk_Authenticating), getText(R.string.boxsdk_Please_wait));
} | java | protected Dialog showDialogWhileWaitingForAuthenticationAPICall() {
return ProgressDialog.show(this, getText(R.string.boxsdk_Authenticating), getText(R.string.boxsdk_Please_wait));
} | [
"protected",
"Dialog",
"showDialogWhileWaitingForAuthenticationAPICall",
"(",
")",
"{",
"return",
"ProgressDialog",
".",
"show",
"(",
"this",
",",
"getText",
"(",
"R",
".",
"string",
".",
"boxsdk_Authenticating",
")",
",",
"getText",
"(",
"R",
".",
"string",
"."... | If you don't need the dialog, just return null.
@return A dialog showing ui showing authentication is in progress | [
"If",
"you",
"don",
"t",
"need",
"the",
"dialog",
"just",
"return",
"null",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java#L458-L460 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java | OAuthActivity.createOAuthActivityIntent | public static Intent createOAuthActivityIntent(final Context context, BoxSession session, boolean loginViaBoxApp){
Intent intent = createOAuthActivityIntent(context, session.getClientId(), session.getClientSecret(), session.getRedirectUrl(), loginViaBoxApp);
intent.putExtra(EXTRA_SESSION, session);
if (!SdkUtils.isEmptyString(session.getUserId())) {
intent.putExtra(EXTRA_USER_ID_RESTRICTION, session.getUserId());
}
return intent;
} | java | public static Intent createOAuthActivityIntent(final Context context, BoxSession session, boolean loginViaBoxApp){
Intent intent = createOAuthActivityIntent(context, session.getClientId(), session.getClientSecret(), session.getRedirectUrl(), loginViaBoxApp);
intent.putExtra(EXTRA_SESSION, session);
if (!SdkUtils.isEmptyString(session.getUserId())) {
intent.putExtra(EXTRA_USER_ID_RESTRICTION, session.getUserId());
}
return intent;
} | [
"public",
"static",
"Intent",
"createOAuthActivityIntent",
"(",
"final",
"Context",
"context",
",",
"BoxSession",
"session",
",",
"boolean",
"loginViaBoxApp",
")",
"{",
"Intent",
"intent",
"=",
"createOAuthActivityIntent",
"(",
"context",
",",
"session",
".",
"getCl... | Create intent to launch OAuthActivity using information from the given session.
@param context
context
@param session the BoxSession to use to get parameters required to authenticate via this activity.
@param loginViaBoxApp Whether login should be handled by the installed box android app. Set this to true only when you are sure or want
to make sure user installed box android app and want to use box android app to login.
@return intent to launch OAuthActivity. | [
"Create",
"intent",
"to",
"launch",
"OAuthActivity",
"using",
"information",
"from",
"the",
"given",
"session",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java#L539-L546 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java | OAuthActivity.getAuthFailure | private OAuthWebView.AuthFailure getAuthFailure(Exception e) {
String error = getString(R.string.boxsdk_Authentication_fail);
if (e != null) {
// Get the proper exception
Throwable ex = e instanceof ExecutionException ?
((ExecutionException) e).getCause() :
e;
if (ex instanceof BoxException) {
BoxError boxError = ((BoxException) ex).getAsBoxError();
if (boxError != null){
if (((BoxException) ex).getResponseCode() == HttpURLConnection.HTTP_FORBIDDEN || ((BoxException) ex).getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED || boxError.getError().equals("unauthorized_device") ) {
error += ":" + getResources().getText(R.string.boxsdk_Authentication_fail_forbidden) + "\n";
} else {
error += ":";
}
error += boxError.getErrorDescription();
return new OAuthWebView.AuthFailure(OAuthWebView.AuthFailure.TYPE_AUTHENTICATION_UNAUTHORIZED, error);
}
}
error += ":" + ex;
}
return new OAuthWebView.AuthFailure(OAuthWebView.AuthFailure.TYPE_GENERIC, error);
} | java | private OAuthWebView.AuthFailure getAuthFailure(Exception e) {
String error = getString(R.string.boxsdk_Authentication_fail);
if (e != null) {
// Get the proper exception
Throwable ex = e instanceof ExecutionException ?
((ExecutionException) e).getCause() :
e;
if (ex instanceof BoxException) {
BoxError boxError = ((BoxException) ex).getAsBoxError();
if (boxError != null){
if (((BoxException) ex).getResponseCode() == HttpURLConnection.HTTP_FORBIDDEN || ((BoxException) ex).getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED || boxError.getError().equals("unauthorized_device") ) {
error += ":" + getResources().getText(R.string.boxsdk_Authentication_fail_forbidden) + "\n";
} else {
error += ":";
}
error += boxError.getErrorDescription();
return new OAuthWebView.AuthFailure(OAuthWebView.AuthFailure.TYPE_AUTHENTICATION_UNAUTHORIZED, error);
}
}
error += ":" + ex;
}
return new OAuthWebView.AuthFailure(OAuthWebView.AuthFailure.TYPE_GENERIC, error);
} | [
"private",
"OAuthWebView",
".",
"AuthFailure",
"getAuthFailure",
"(",
"Exception",
"e",
")",
"{",
"String",
"error",
"=",
"getString",
"(",
"R",
".",
"string",
".",
"boxsdk_Authentication_fail",
")",
";",
"if",
"(",
"e",
"!=",
"null",
")",
"{",
"// Get the p... | Takes an auth exception and converts it to an AuthFailure so it can be properly handled
@param e The auth exception
@return The typed AuthFailure | [
"Takes",
"an",
"auth",
"exception",
"and",
"converts",
"it",
"to",
"an",
"AuthFailure",
"so",
"it",
"can",
"be",
"properly",
"handled"
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java#L554-L576 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiSearch.java | BoxApiSearch.getSearchRequest | public BoxRequestsSearch.Search getSearchRequest(String query) {
BoxRequestsSearch.Search request = new BoxRequestsSearch.Search(query, getSearchUrl(), mSession);
return request;
} | java | public BoxRequestsSearch.Search getSearchRequest(String query) {
BoxRequestsSearch.Search request = new BoxRequestsSearch.Search(query, getSearchUrl(), mSession);
return request;
} | [
"public",
"BoxRequestsSearch",
".",
"Search",
"getSearchRequest",
"(",
"String",
"query",
")",
"{",
"BoxRequestsSearch",
".",
"Search",
"request",
"=",
"new",
"BoxRequestsSearch",
".",
"Search",
"(",
"query",
",",
"getSearchUrl",
"(",
")",
",",
"mSession",
")",
... | Gets a request to search
@param query query to use for search
@return request to search | [
"Gets",
"a",
"request",
"to",
"search"
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiSearch.java#L22-L25 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java | BoxRequest.importRequestContentMapsFrom | protected void importRequestContentMapsFrom(BoxRequest source) {
this.mQueryMap = new HashMap<String, String>(source.mQueryMap);
this.mBodyMap = new LinkedHashMap<String, Object>(source.mBodyMap);
} | java | protected void importRequestContentMapsFrom(BoxRequest source) {
this.mQueryMap = new HashMap<String, String>(source.mQueryMap);
this.mBodyMap = new LinkedHashMap<String, Object>(source.mBodyMap);
} | [
"protected",
"void",
"importRequestContentMapsFrom",
"(",
"BoxRequest",
"source",
")",
"{",
"this",
".",
"mQueryMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
"source",
".",
"mQueryMap",
")",
";",
"this",
".",
"mBodyMap",
"=",
"new",
... | Copies data from query and body maps into the current request.
@param source the request to copy data from. | [
"Copies",
"data",
"from",
"query",
"and",
"body",
"maps",
"into",
"the",
"current",
"request",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java#L121-L124 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java | BoxRequest.send | public final T send() throws BoxException {
Exception ex = null;
T result = null;
try {
result = onSend();
} catch (Exception e){
ex = e;
}
// We catch the exception so that onSendCompleted can be called in case additional actions need to be taken
onSendCompleted(new BoxResponse(result, ex, this));
if (ex != null) {
if (ex instanceof BoxException){
throw (BoxException)ex;
} else {
throw new BoxException("unexpected exception ",ex);
}
}
return result;
} | java | public final T send() throws BoxException {
Exception ex = null;
T result = null;
try {
result = onSend();
} catch (Exception e){
ex = e;
}
// We catch the exception so that onSendCompleted can be called in case additional actions need to be taken
onSendCompleted(new BoxResponse(result, ex, this));
if (ex != null) {
if (ex instanceof BoxException){
throw (BoxException)ex;
} else {
throw new BoxException("unexpected exception ",ex);
}
}
return result;
} | [
"public",
"final",
"T",
"send",
"(",
")",
"throws",
"BoxException",
"{",
"Exception",
"ex",
"=",
"null",
";",
"T",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"onSend",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"ex",
... | Synchronously make the request to Box and handle the response appropriately.
@return the expected BoxObject if the request is successful.
@throws BoxException thrown if there was a problem with handling the request. | [
"Synchronously",
"make",
"the",
"request",
"to",
"Box",
"and",
"handle",
"the",
"response",
"appropriately",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java#L189-L208 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java | BoxRequest.getStringBody | public String getStringBody() throws UnsupportedEncodingException {
if (mStringBody != null)
return mStringBody;
if (mContentType != null) {
switch (mContentType) {
case JSON:
JsonObject jsonBody = new JsonObject();
for (Map.Entry<String, Object> entry : mBodyMap.entrySet()) {
parseHashMapEntry(jsonBody, entry);
}
mStringBody = jsonBody.toString();
break;
case URL_ENCODED:
HashMap<String, String> stringMap = new HashMap<String, String>();
for (Map.Entry<String, Object> entry : mBodyMap.entrySet()) {
stringMap.put(entry.getKey(), (String) entry.getValue());
}
mStringBody = createQuery(stringMap);
break;
case JSON_PATCH:
mStringBody = ((BoxArray) mBodyMap.get(JSON_OBJECT)).toJson();
break;
}
}
return mStringBody;
} | java | public String getStringBody() throws UnsupportedEncodingException {
if (mStringBody != null)
return mStringBody;
if (mContentType != null) {
switch (mContentType) {
case JSON:
JsonObject jsonBody = new JsonObject();
for (Map.Entry<String, Object> entry : mBodyMap.entrySet()) {
parseHashMapEntry(jsonBody, entry);
}
mStringBody = jsonBody.toString();
break;
case URL_ENCODED:
HashMap<String, String> stringMap = new HashMap<String, String>();
for (Map.Entry<String, Object> entry : mBodyMap.entrySet()) {
stringMap.put(entry.getKey(), (String) entry.getValue());
}
mStringBody = createQuery(stringMap);
break;
case JSON_PATCH:
mStringBody = ((BoxArray) mBodyMap.get(JSON_OBJECT)).toJson();
break;
}
}
return mStringBody;
} | [
"public",
"String",
"getStringBody",
"(",
")",
"throws",
"UnsupportedEncodingException",
"{",
"if",
"(",
"mStringBody",
"!=",
"null",
")",
"return",
"mStringBody",
";",
"if",
"(",
"mContentType",
"!=",
"null",
")",
"{",
"switch",
"(",
"mContentType",
")",
"{",... | Gets the string body for the request.
@return the string body associated with this request.
@throws UnsupportedEncodingException thrown if there was a problem with the encoding of the body. | [
"Gets",
"the",
"string",
"body",
"for",
"the",
"request",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java#L411-L438 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java | BoxRequest.handleToTaskForCachedResult | protected <R extends BoxRequest & BoxCacheableRequest> BoxFutureTask<T> handleToTaskForCachedResult() throws BoxException {
BoxCache cache = BoxConfig.getCache();
if (cache == null) {
throw new BoxException.CacheImplementationNotFound();
}
return new BoxCacheFutureTask<T, R>(mClazz, (R) getCacheableRequest(), cache);
} | java | protected <R extends BoxRequest & BoxCacheableRequest> BoxFutureTask<T> handleToTaskForCachedResult() throws BoxException {
BoxCache cache = BoxConfig.getCache();
if (cache == null) {
throw new BoxException.CacheImplementationNotFound();
}
return new BoxCacheFutureTask<T, R>(mClazz, (R) getCacheableRequest(), cache);
} | [
"protected",
"<",
"R",
"extends",
"BoxRequest",
"&",
"BoxCacheableRequest",
">",
"BoxFutureTask",
"<",
"T",
">",
"handleToTaskForCachedResult",
"(",
")",
"throws",
"BoxException",
"{",
"BoxCache",
"cache",
"=",
"BoxConfig",
".",
"getCache",
"(",
")",
";",
"if",
... | Default implementation for getting a task to execute the request.
@param <R> A BoxRequest that implements BoxCaceableRequest
@return The task used to get data from cache implementation.
@throws BoxException thrown if there is no cache implementation set in BoxConfig. | [
"Default",
"implementation",
"for",
"getting",
"a",
"task",
"to",
"execute",
"the",
"request",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java#L542-L549 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java | BoxRequest.handleUpdateCache | protected void handleUpdateCache(BoxResponse<T> response) throws BoxException {
BoxCache cache = BoxConfig.getCache();
if (cache != null) {
cache.put(response);
}
} | java | protected void handleUpdateCache(BoxResponse<T> response) throws BoxException {
BoxCache cache = BoxConfig.getCache();
if (cache != null) {
cache.put(response);
}
} | [
"protected",
"void",
"handleUpdateCache",
"(",
"BoxResponse",
"<",
"T",
">",
"response",
")",
"throws",
"BoxException",
"{",
"BoxCache",
"cache",
"=",
"BoxConfig",
".",
"getCache",
"(",
")",
";",
"if",
"(",
"cache",
"!=",
"null",
")",
"{",
"cache",
".",
... | If available, makes a call to update the cache with the provided result
@param response the new result to update the cache with
@throws BoxException thrown if there was an issue updating cache for given response. | [
"If",
"available",
"makes",
"a",
"call",
"to",
"update",
"the",
"cache",
"with",
"the",
"provided",
"result"
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java#L558-L563 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java | BoxRequest.getSocket | protected Socket getSocket(){
if (mSocketFactoryRef != null && mSocketFactoryRef.get() != null) {
return ((SSLSocketFactoryWrapper)mSocketFactoryRef.get()).getSocket();
}
return null;
} | java | protected Socket getSocket(){
if (mSocketFactoryRef != null && mSocketFactoryRef.get() != null) {
return ((SSLSocketFactoryWrapper)mSocketFactoryRef.get()).getSocket();
}
return null;
} | [
"protected",
"Socket",
"getSocket",
"(",
")",
"{",
"if",
"(",
"mSocketFactoryRef",
"!=",
"null",
"&&",
"mSocketFactoryRef",
".",
"get",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"(",
"(",
"SSLSocketFactoryWrapper",
")",
"mSocketFactoryRef",
".",
"get",
"("... | This method requires mRequiresSocket to be set to true before connecting.
@return the socket that ran this request if one was created for it. | [
"This",
"method",
"requires",
"mRequiresSocket",
"to",
"be",
"set",
"to",
"true",
"before",
"connecting",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java#L894-L899 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.getAuthInfo | public BoxAuthenticationInfo getAuthInfo(String userId, Context context) {
return userId == null ? null : getAuthInfoMap(context).get(userId);
} | java | public BoxAuthenticationInfo getAuthInfo(String userId, Context context) {
return userId == null ? null : getAuthInfoMap(context).get(userId);
} | [
"public",
"BoxAuthenticationInfo",
"getAuthInfo",
"(",
"String",
"userId",
",",
"Context",
"context",
")",
"{",
"return",
"userId",
"==",
"null",
"?",
"null",
":",
"getAuthInfoMap",
"(",
"context",
")",
".",
"get",
"(",
"userId",
")",
";",
"}"
] | Get the BoxAuthenticationInfo for a given user.
@param userId the user id to get auth info for.
@param context current context used for accessing resource.
@return the BoxAuthenticationInfo for a given user. | [
"Get",
"the",
"BoxAuthenticationInfo",
"for",
"a",
"given",
"user",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L83-L85 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.onAuthenticated | public void onAuthenticated(BoxAuthenticationInfo infoOriginal, Context context) {
BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal);
if (!SdkUtils.isBlank(info.accessToken()) && (info.getUser() == null || SdkUtils.isBlank(info.getUser().getId()))){
// insufficient information so we need to fetch the user info first.
doUserRefresh(context, info);
return;
}
getAuthInfoMap(context).put(info.getUser().getId(), info.clone());
authStorage.storeLastAuthenticatedUserId(info.getUser().getId(), context);
authStorage.storeAuthInfoMap(mCurrentAccessInfo, context);
// if accessToken has not already been refreshed, issue refresh request and cache result
Set<AuthListener> listeners = getListeners();
for (AuthListener listener : listeners) {
listener.onAuthCreated(info);
}
} | java | public void onAuthenticated(BoxAuthenticationInfo infoOriginal, Context context) {
BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal);
if (!SdkUtils.isBlank(info.accessToken()) && (info.getUser() == null || SdkUtils.isBlank(info.getUser().getId()))){
// insufficient information so we need to fetch the user info first.
doUserRefresh(context, info);
return;
}
getAuthInfoMap(context).put(info.getUser().getId(), info.clone());
authStorage.storeLastAuthenticatedUserId(info.getUser().getId(), context);
authStorage.storeAuthInfoMap(mCurrentAccessInfo, context);
// if accessToken has not already been refreshed, issue refresh request and cache result
Set<AuthListener> listeners = getListeners();
for (AuthListener listener : listeners) {
listener.onAuthCreated(info);
}
} | [
"public",
"void",
"onAuthenticated",
"(",
"BoxAuthenticationInfo",
"infoOriginal",
",",
"Context",
"context",
")",
"{",
"BoxAuthenticationInfo",
"info",
"=",
"BoxAuthenticationInfo",
".",
"unmodifiableObject",
"(",
"infoOriginal",
")",
";",
"if",
"(",
"!",
"SdkUtils",... | Callback method to be called when authentication process finishes.
@param infoOriginal the authentication information that successfully authenticated.
@param context the current application context (that can be used to launch ui or access resources). | [
"Callback",
"method",
"to",
"be",
"called",
"when",
"authentication",
"process",
"finishes",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L158-L173 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.onAuthenticationFailure | public void onAuthenticationFailure(BoxAuthenticationInfo infoOriginal, Exception ex) {
String msg = "failure:";
if (getAuthStorage() != null) {
msg += "auth storage :" + getAuthStorage().toString();
}
BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal);
if (info != null) {
msg += info.getUser() == null ? "null user" : info.getUser().getId() == null ? "null user id" : info.getUser().getId().length();
}
BoxLogUtils.nonFatalE("BoxAuthfail", msg , ex);
Set<AuthListener> listeners = getListeners();
for (AuthListener listener : listeners) {
listener.onAuthFailure(info, ex);
}
} | java | public void onAuthenticationFailure(BoxAuthenticationInfo infoOriginal, Exception ex) {
String msg = "failure:";
if (getAuthStorage() != null) {
msg += "auth storage :" + getAuthStorage().toString();
}
BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal);
if (info != null) {
msg += info.getUser() == null ? "null user" : info.getUser().getId() == null ? "null user id" : info.getUser().getId().length();
}
BoxLogUtils.nonFatalE("BoxAuthfail", msg , ex);
Set<AuthListener> listeners = getListeners();
for (AuthListener listener : listeners) {
listener.onAuthFailure(info, ex);
}
} | [
"public",
"void",
"onAuthenticationFailure",
"(",
"BoxAuthenticationInfo",
"infoOriginal",
",",
"Exception",
"ex",
")",
"{",
"String",
"msg",
"=",
"\"failure:\"",
";",
"if",
"(",
"getAuthStorage",
"(",
")",
"!=",
"null",
")",
"{",
"msg",
"+=",
"\"auth storage :\... | Callback method to be called if authentication process fails.
@param infoOriginal the authentication information associated with the failed authentication.
@param ex the exception if appliable that caused the logout. | [
"Callback",
"method",
"to",
"be",
"called",
"if",
"authentication",
"process",
"fails",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L180-L195 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.onLoggedOut | public void onLoggedOut(BoxAuthenticationInfo infoOriginal, Exception ex) {
BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal);
Set<AuthListener> listeners = getListeners();
for (AuthListener listener : listeners) {
listener.onLoggedOut(info, ex);
}
} | java | public void onLoggedOut(BoxAuthenticationInfo infoOriginal, Exception ex) {
BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal);
Set<AuthListener> listeners = getListeners();
for (AuthListener listener : listeners) {
listener.onLoggedOut(info, ex);
}
} | [
"public",
"void",
"onLoggedOut",
"(",
"BoxAuthenticationInfo",
"infoOriginal",
",",
"Exception",
"ex",
")",
"{",
"BoxAuthenticationInfo",
"info",
"=",
"BoxAuthenticationInfo",
".",
"unmodifiableObject",
"(",
"infoOriginal",
")",
";",
"Set",
"<",
"AuthListener",
">",
... | Callback method to be called on logout.
@param infoOriginal the authentication information associated with the user that was logged out.
@param ex the exception if appliable that caused the logout. | [
"Callback",
"method",
"to",
"be",
"called",
"on",
"logout",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L202-L208 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.logout | public synchronized void logout(final BoxSession session) {
BoxUser user = session.getUser();
if (user == null) {
return;
}
session.clearCache();
Context context = session.getApplicationContext();
String userId = user.getId();
getAuthInfoMap(session.getApplicationContext());
BoxAuthenticationInfo info = mCurrentAccessInfo.get(userId);
Exception ex = null;
try {
BoxApiAuthentication api = new BoxApiAuthentication(session);
BoxApiAuthentication.BoxRevokeAuthRequest request = api.revokeOAuth(info.refreshToken(), session.getClientId(), session.getClientSecret());
request.send();
} catch (Exception e) {
ex = e;
BoxLogUtils.e(TAG, "logout", e);
// Do nothing as we want to continue wiping auth info
}
mCurrentAccessInfo.remove(userId);
String lastUserId = authStorage.getLastAuthentictedUserId(context);
if (lastUserId != null) {
authStorage.storeLastAuthenticatedUserId(null, context);
}
authStorage.storeAuthInfoMap(mCurrentAccessInfo, context);
onLoggedOut(info, ex);
info.wipeOutAuth();
} | java | public synchronized void logout(final BoxSession session) {
BoxUser user = session.getUser();
if (user == null) {
return;
}
session.clearCache();
Context context = session.getApplicationContext();
String userId = user.getId();
getAuthInfoMap(session.getApplicationContext());
BoxAuthenticationInfo info = mCurrentAccessInfo.get(userId);
Exception ex = null;
try {
BoxApiAuthentication api = new BoxApiAuthentication(session);
BoxApiAuthentication.BoxRevokeAuthRequest request = api.revokeOAuth(info.refreshToken(), session.getClientId(), session.getClientSecret());
request.send();
} catch (Exception e) {
ex = e;
BoxLogUtils.e(TAG, "logout", e);
// Do nothing as we want to continue wiping auth info
}
mCurrentAccessInfo.remove(userId);
String lastUserId = authStorage.getLastAuthentictedUserId(context);
if (lastUserId != null) {
authStorage.storeLastAuthenticatedUserId(null, context);
}
authStorage.storeAuthInfoMap(mCurrentAccessInfo, context);
onLoggedOut(info, ex);
info.wipeOutAuth();
} | [
"public",
"synchronized",
"void",
"logout",
"(",
"final",
"BoxSession",
"session",
")",
"{",
"BoxUser",
"user",
"=",
"session",
".",
"getUser",
"(",
")",
";",
"if",
"(",
"user",
"==",
"null",
")",
"{",
"return",
";",
"}",
"session",
".",
"clearCache",
... | Log out current BoxSession. After logging out, the authentication information related to the Box user in this session will be gone.
@param session session to logout user from | [
"Log",
"out",
"current",
"BoxSession",
".",
"After",
"logging",
"out",
"the",
"authentication",
"information",
"related",
"to",
"the",
"Box",
"user",
"in",
"this",
"session",
"will",
"be",
"gone",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L236-L269 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.logoutAllUsers | public synchronized void logoutAllUsers(Context context) {
getAuthInfoMap(context);
for (String userId : mCurrentAccessInfo.keySet()) {
BoxSession session = new BoxSession(context, userId);
logout(session);
}
authStorage.clearAuthInfoMap(context);
} | java | public synchronized void logoutAllUsers(Context context) {
getAuthInfoMap(context);
for (String userId : mCurrentAccessInfo.keySet()) {
BoxSession session = new BoxSession(context, userId);
logout(session);
}
authStorage.clearAuthInfoMap(context);
} | [
"public",
"synchronized",
"void",
"logoutAllUsers",
"(",
"Context",
"context",
")",
"{",
"getAuthInfoMap",
"(",
"context",
")",
";",
"for",
"(",
"String",
"userId",
":",
"mCurrentAccessInfo",
".",
"keySet",
"(",
")",
")",
"{",
"BoxSession",
"session",
"=",
"... | Log out all users. After logging out, all authentication information will be gone.
@param context current context | [
"Log",
"out",
"all",
"users",
".",
"After",
"logging",
"out",
"all",
"authentication",
"information",
"will",
"be",
"gone",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L275-L283 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.create | public synchronized FutureTask<BoxAuthenticationInfo> create(BoxSession session, final String code) {
FutureTask<BoxAuthenticationInfo> task = doCreate(session,code);
BoxAuthentication.AUTH_EXECUTOR.submit(task);
return task;
} | java | public synchronized FutureTask<BoxAuthenticationInfo> create(BoxSession session, final String code) {
FutureTask<BoxAuthenticationInfo> task = doCreate(session,code);
BoxAuthentication.AUTH_EXECUTOR.submit(task);
return task;
} | [
"public",
"synchronized",
"FutureTask",
"<",
"BoxAuthenticationInfo",
">",
"create",
"(",
"BoxSession",
"session",
",",
"final",
"String",
"code",
")",
"{",
"FutureTask",
"<",
"BoxAuthenticationInfo",
">",
"task",
"=",
"doCreate",
"(",
"session",
",",
"code",
")... | Create Oauth for the first time. This method should be called by ui to authenticate the user for the first time.
@param session a box session with all the necessary information to authenticate the user for the first time.
@param code the code returned by web page necessary to authenticate.
@return a future task allowing monitoring of the api call. | [
"Create",
"Oauth",
"for",
"the",
"first",
"time",
".",
"This",
"method",
"should",
"be",
"called",
"by",
"ui",
"to",
"authenticate",
"the",
"user",
"for",
"the",
"first",
"time",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L291-L295 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.refresh | public synchronized FutureTask<BoxAuthenticationInfo> refresh(BoxSession session) {
BoxUser user = session.getUser();
if (user == null) {
return doRefresh(session, session.getAuthInfo());
}
// Fetch auth info map from storage if not present.
getAuthInfoMap(session.getApplicationContext());
BoxAuthenticationInfo info = mCurrentAccessInfo.get(user.getId());
if (info == null) {
// session has info that we do not. ? is there any other situation we want to update our info based on session info? we can do checks against
// refresh time.
mCurrentAccessInfo.put(user.getId(), session.getAuthInfo());
info = mCurrentAccessInfo.get(user.getId());
}
// No need to refresh if we have already refreshed within 15 seconds or have a newer access token already.
if (session.getAuthInfo().accessToken() == null || (!session.getAuthInfo().accessToken().equals(info.accessToken()) && info.getRefreshTime() != null && System.currentTimeMillis() - info.getRefreshTime() < 15000)) {
final BoxAuthenticationInfo latestInfo = info;
// this session is probably using old information. Give it our information.
BoxAuthenticationInfo.cloneInfo(session.getAuthInfo(), info);
FutureTask task = new FutureTask<>(new Callable<BoxAuthenticationInfo>() {
@Override
public BoxAuthenticationInfo call() throws Exception {
return latestInfo;
}
});
AUTH_EXECUTOR.execute(task);
return task;
}
FutureTask task = mRefreshingTasks.get(user.getId());
if (task != null && !(task.isCancelled() || task.isDone())) {
// We already have a refreshing task for this user. No need to do anything.
return task;
}
// long currentTime = System.currentTimeMillis();
// if ((currentTime - info.refreshTime) > info.refreshTime - EXPIRATION_GRACE) {
// this access info is close to expiration or has passed expiration time needs to be refreshed before usage.
// }
// create the task to do the refresh and put it in mRefreshingTasks and execute it.
return doRefresh(session, info);
} | java | public synchronized FutureTask<BoxAuthenticationInfo> refresh(BoxSession session) {
BoxUser user = session.getUser();
if (user == null) {
return doRefresh(session, session.getAuthInfo());
}
// Fetch auth info map from storage if not present.
getAuthInfoMap(session.getApplicationContext());
BoxAuthenticationInfo info = mCurrentAccessInfo.get(user.getId());
if (info == null) {
// session has info that we do not. ? is there any other situation we want to update our info based on session info? we can do checks against
// refresh time.
mCurrentAccessInfo.put(user.getId(), session.getAuthInfo());
info = mCurrentAccessInfo.get(user.getId());
}
// No need to refresh if we have already refreshed within 15 seconds or have a newer access token already.
if (session.getAuthInfo().accessToken() == null || (!session.getAuthInfo().accessToken().equals(info.accessToken()) && info.getRefreshTime() != null && System.currentTimeMillis() - info.getRefreshTime() < 15000)) {
final BoxAuthenticationInfo latestInfo = info;
// this session is probably using old information. Give it our information.
BoxAuthenticationInfo.cloneInfo(session.getAuthInfo(), info);
FutureTask task = new FutureTask<>(new Callable<BoxAuthenticationInfo>() {
@Override
public BoxAuthenticationInfo call() throws Exception {
return latestInfo;
}
});
AUTH_EXECUTOR.execute(task);
return task;
}
FutureTask task = mRefreshingTasks.get(user.getId());
if (task != null && !(task.isCancelled() || task.isDone())) {
// We already have a refreshing task for this user. No need to do anything.
return task;
}
// long currentTime = System.currentTimeMillis();
// if ((currentTime - info.refreshTime) > info.refreshTime - EXPIRATION_GRACE) {
// this access info is close to expiration or has passed expiration time needs to be refreshed before usage.
// }
// create the task to do the refresh and put it in mRefreshingTasks and execute it.
return doRefresh(session, info);
} | [
"public",
"synchronized",
"FutureTask",
"<",
"BoxAuthenticationInfo",
">",
"refresh",
"(",
"BoxSession",
"session",
")",
"{",
"BoxUser",
"user",
"=",
"session",
".",
"getUser",
"(",
")",
";",
"if",
"(",
"user",
"==",
"null",
")",
"{",
"return",
"doRefresh",
... | Refresh the OAuth in the given BoxSession. This method is called when OAuth token expires.
@param session a box session with all the necessary information to authenticate the user for the first time.
@return a future task allowing monitoring of the api call. | [
"Refresh",
"the",
"OAuth",
"in",
"the",
"given",
"BoxSession",
".",
"This",
"method",
"is",
"called",
"when",
"OAuth",
"token",
"expires",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L302-L346 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.addListener | public synchronized void addListener(AuthListener listener) {
if (getListeners().contains(listener)){
return;
}
mListeners.add(new WeakReference<>(listener));
} | java | public synchronized void addListener(AuthListener listener) {
if (getListeners().contains(listener)){
return;
}
mListeners.add(new WeakReference<>(listener));
} | [
"public",
"synchronized",
"void",
"addListener",
"(",
"AuthListener",
"listener",
")",
"{",
"if",
"(",
"getListeners",
"(",
")",
".",
"contains",
"(",
"listener",
")",
")",
"{",
"return",
";",
"}",
"mListeners",
".",
"add",
"(",
"new",
"WeakReference",
"<>... | Add listener to listen to the authentication process for this BoxSession.
@param listener listener for authentication | [
"Add",
"listener",
"to",
"listen",
"to",
"the",
"authentication",
"process",
"for",
"this",
"BoxSession",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L401-L406 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.startAuthenticateUI | private synchronized void startAuthenticateUI(BoxSession session) {
Context context = session.getApplicationContext();
Intent intent = OAuthActivity.createOAuthActivityIntent(context, session, BoxAuthentication.isBoxAuthAppAvailable(context) && session.isEnabledBoxAppAuthentication());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} | java | private synchronized void startAuthenticateUI(BoxSession session) {
Context context = session.getApplicationContext();
Intent intent = OAuthActivity.createOAuthActivityIntent(context, session, BoxAuthentication.isBoxAuthAppAvailable(context) && session.isEnabledBoxAppAuthentication());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} | [
"private",
"synchronized",
"void",
"startAuthenticateUI",
"(",
"BoxSession",
"session",
")",
"{",
"Context",
"context",
"=",
"session",
".",
"getApplicationContext",
"(",
")",
";",
"Intent",
"intent",
"=",
"OAuthActivity",
".",
"createOAuthActivityIntent",
"(",
"con... | Start authentication UI.
@param session the session to authenticate. | [
"Start",
"authentication",
"UI",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L413-L418 | train |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.isBoxAuthAppAvailable | public static boolean isBoxAuthAppAvailable(final Context context) {
Intent intent = new Intent(BoxConstants.REQUEST_BOX_APP_FOR_AUTH_INTENT_ACTION);
List<ResolveInfo> infos = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_RESOLVED_FILTER);
return infos.size() > 0;
} | java | public static boolean isBoxAuthAppAvailable(final Context context) {
Intent intent = new Intent(BoxConstants.REQUEST_BOX_APP_FOR_AUTH_INTENT_ACTION);
List<ResolveInfo> infos = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_RESOLVED_FILTER);
return infos.size() > 0;
} | [
"public",
"static",
"boolean",
"isBoxAuthAppAvailable",
"(",
"final",
"Context",
"context",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"BoxConstants",
".",
"REQUEST_BOX_APP_FOR_AUTH_INTENT_ACTION",
")",
";",
"List",
"<",
"ResolveInfo",
">",
"infos",
... | A check to see if an official box application supporting third party authentication is available.
This lets users authenticate without re-entering credentials.
@param context current context
@return true if an official box application that supports third party authentication is installed. | [
"A",
"check",
"to",
"see",
"if",
"an",
"official",
"box",
"application",
"supporting",
"third",
"party",
"authentication",
"is",
"available",
".",
"This",
"lets",
"users",
"authenticate",
"without",
"re",
"-",
"entering",
"credentials",
"."
] | a621ad5ddebf23067fec27529130d72718fc0e88 | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L925-L929 | train |
liaohuqiu/android-GridViewWithHeaderAndFooter | src/in/srain/cube/views/GridViewWithHeaderAndFooter.java | GridViewWithHeaderAndFooter.removeHeaderView | public boolean removeHeaderView(View v) {
if (mHeaderViewInfos.size() > 0) {
boolean result = false;
ListAdapter adapter = getAdapter();
if (adapter != null && ((HeaderViewGridAdapter) adapter).removeHeader(v)) {
result = true;
}
removeFixedViewInfo(v, mHeaderViewInfos);
return result;
}
return false;
} | java | public boolean removeHeaderView(View v) {
if (mHeaderViewInfos.size() > 0) {
boolean result = false;
ListAdapter adapter = getAdapter();
if (adapter != null && ((HeaderViewGridAdapter) adapter).removeHeader(v)) {
result = true;
}
removeFixedViewInfo(v, mHeaderViewInfos);
return result;
}
return false;
} | [
"public",
"boolean",
"removeHeaderView",
"(",
"View",
"v",
")",
"{",
"if",
"(",
"mHeaderViewInfos",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"ListAdapter",
"adapter",
"=",
"getAdapter",
"(",
")",
";",
"if",
"("... | Removes a previously-added header view.
@param v The view to remove
@return true if the view was removed, false if the view was not a header
view | [
"Removes",
"a",
"previously",
"-",
"added",
"header",
"view",
"."
] | d4a99eff0f46febdd338a7b93b69d924826ba6fe | https://github.com/liaohuqiu/android-GridViewWithHeaderAndFooter/blob/d4a99eff0f46febdd338a7b93b69d924826ba6fe/src/in/srain/cube/views/GridViewWithHeaderAndFooter.java#L219-L230 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/batch/BatchClient.java | BatchClient.listJobs | public ListJobsResponse listJobs(String marker, int maxKeys) {
return listJobs(new ListJobsRequest().withMaxKeys(maxKeys).withMarker(marker));
} | java | public ListJobsResponse listJobs(String marker, int maxKeys) {
return listJobs(new ListJobsRequest().withMaxKeys(maxKeys).withMarker(marker));
} | [
"public",
"ListJobsResponse",
"listJobs",
"(",
"String",
"marker",
",",
"int",
"maxKeys",
")",
"{",
"return",
"listJobs",
"(",
"new",
"ListJobsRequest",
"(",
")",
".",
"withMaxKeys",
"(",
"maxKeys",
")",
".",
"withMarker",
"(",
"marker",
")",
")",
";",
"}"... | List Batch-Compute jobs owned by the authenticated user.
@param marker The start record of jobs.
@param maxKeys The maximum number of jobs returned.
@return The response containing a list of the Batch-Compute jobs owned by the authenticated sender of the
request.
The jobs' records start from the marker and the size of list is limited below maxKeys. | [
"List",
"Batch",
"-",
"Compute",
"jobs",
"owned",
"by",
"the",
"authenticated",
"user",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/batch/BatchClient.java#L141-L143 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/batch/BatchClient.java | BatchClient.createJob | public CreateJobResponse createJob(CreateJobRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getName(), "The name should not be null or empty string.");
checkStringNotEmpty(request.getVmType(), "The vmType should not be null or empty string.");
checkStringNotEmpty(request.getJobDagJson(), "The jobDagJson should not be null or empty string.");
checkIsTrue(request.getVmCount() > 0, "The vmCount should greater than 0");
StringWriter writer = new StringWriter();
try {
JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("name", request.getName());
jsonGenerator.writeStringField("vmType", request.getVmType());
jsonGenerator.writeNumberField("vmCount", request.getVmCount());
jsonGenerator.writeStringField("jobDagJson", request.getJobDagJson());
if (request.getJobTimeoutInSeconds() != null) {
jsonGenerator.writeNumberField("jobTimeoutInSeconds", request.getJobTimeoutInSeconds());
}
if (request.getMemo() != null) {
jsonGenerator.writeStringField("memo", request.getMemo());
}
jsonGenerator.writeEndObject();
jsonGenerator.close();
} catch (IOException e) {
throw new BceClientException("Fail to generate json", e);
}
byte[] json = null;
try {
json = writer.toString().getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Fail to get UTF-8 bytes", e);
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, JOB);
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json");
internalRequest.setContent(RestartableInputStream.wrap(json));
internalRequest.addParameter("run", "immediate");
if (request.getClientToken() != null) {
internalRequest.addParameter("clientToken", request.getClientToken());
}
return this.invokeHttpClient(internalRequest, CreateJobResponse.class);
} | java | public CreateJobResponse createJob(CreateJobRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getName(), "The name should not be null or empty string.");
checkStringNotEmpty(request.getVmType(), "The vmType should not be null or empty string.");
checkStringNotEmpty(request.getJobDagJson(), "The jobDagJson should not be null or empty string.");
checkIsTrue(request.getVmCount() > 0, "The vmCount should greater than 0");
StringWriter writer = new StringWriter();
try {
JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("name", request.getName());
jsonGenerator.writeStringField("vmType", request.getVmType());
jsonGenerator.writeNumberField("vmCount", request.getVmCount());
jsonGenerator.writeStringField("jobDagJson", request.getJobDagJson());
if (request.getJobTimeoutInSeconds() != null) {
jsonGenerator.writeNumberField("jobTimeoutInSeconds", request.getJobTimeoutInSeconds());
}
if (request.getMemo() != null) {
jsonGenerator.writeStringField("memo", request.getMemo());
}
jsonGenerator.writeEndObject();
jsonGenerator.close();
} catch (IOException e) {
throw new BceClientException("Fail to generate json", e);
}
byte[] json = null;
try {
json = writer.toString().getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Fail to get UTF-8 bytes", e);
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, JOB);
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json");
internalRequest.setContent(RestartableInputStream.wrap(json));
internalRequest.addParameter("run", "immediate");
if (request.getClientToken() != null) {
internalRequest.addParameter("clientToken", request.getClientToken());
}
return this.invokeHttpClient(internalRequest, CreateJobResponse.class);
} | [
"public",
"CreateJobResponse",
"createJob",
"(",
"CreateJobRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getName",
"(",
")",
",",
"\"The name should not be nu... | Create a Batch-Compute job with the specified options.
@param request The request containing all options for creating a Batch-Compute job.
@return The response containing the ID of the newly created job. | [
"Create",
"a",
"Batch",
"-",
"Compute",
"job",
"with",
"the",
"specified",
"options",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/batch/BatchClient.java#L177-L222 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/batch/BatchClient.java | BatchClient.cancelJob | public void cancelJob(CancelJobRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getJobId(), "The parameter jobId should not be null or empty string.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, JOB, request.getJobId());
internalRequest.addParameter("cancel", null);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void cancelJob(CancelJobRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getJobId(), "The parameter jobId should not be null or empty string.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, JOB, request.getJobId());
internalRequest.addParameter("cancel", null);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"cancelJob",
"(",
"CancelJobRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getJobId",
"(",
")",
",",
"\"The parameter jobId should not be nul... | Cancel a Batch-Compute job.
@param request The request containing the ID of the job to be cancelled. | [
"Cancel",
"a",
"Batch",
"-",
"Compute",
"job",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/batch/BatchClient.java#L229-L238 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/batch/BatchClient.java | BatchClient.createRequest | private InternalRequest createRequest(
AbstractBceRequest bceRequest, HttpMethodName httpMethod, String... pathVariables) {
List<String> path = new ArrayList<String>();
path.add(VERSION);
if (pathVariables != null) {
for (String pathVariable : pathVariables) {
path.add(pathVariable);
}
}
URI uri = HttpUtils.appendUri(this.getEndpoint(), path.toArray(new String[path.size()]));
InternalRequest request = new InternalRequest(httpMethod, uri);
SignOptions signOptions = new SignOptions();
signOptions.setHeadersToSign(new HashSet<String>(Arrays.asList(HEADERS_TO_SIGN)));
request.setSignOptions(signOptions);
request.setCredentials(bceRequest.getRequestCredentials());
return request;
} | java | private InternalRequest createRequest(
AbstractBceRequest bceRequest, HttpMethodName httpMethod, String... pathVariables) {
List<String> path = new ArrayList<String>();
path.add(VERSION);
if (pathVariables != null) {
for (String pathVariable : pathVariables) {
path.add(pathVariable);
}
}
URI uri = HttpUtils.appendUri(this.getEndpoint(), path.toArray(new String[path.size()]));
InternalRequest request = new InternalRequest(httpMethod, uri);
SignOptions signOptions = new SignOptions();
signOptions.setHeadersToSign(new HashSet<String>(Arrays.asList(HEADERS_TO_SIGN)));
request.setSignOptions(signOptions);
request.setCredentials(bceRequest.getRequestCredentials());
return request;
} | [
"private",
"InternalRequest",
"createRequest",
"(",
"AbstractBceRequest",
"bceRequest",
",",
"HttpMethodName",
"httpMethod",
",",
"String",
"...",
"pathVariables",
")",
"{",
"List",
"<",
"String",
">",
"path",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")... | Creates and initializes a new request object for the specified resource.
@param bceRequest The original BCE request created by the user.
@param httpMethod The HTTP method to use when sending the request.
@param pathVariables The optional variables used in the URI path.
@return A new request object populated with endpoint, resource path and specific
parameters to send. | [
"Creates",
"and",
"initializes",
"a",
"new",
"request",
"object",
"for",
"the",
"specified",
"resource",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/batch/BatchClient.java#L258-L277 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/ruleengine/RuleEngineClient.java | RuleEngineClient.listRules | public ListRuleResponse listRules(ListRuleRequest request) {
InternalRequest internalRequest =
createRequest(request, HttpMethodName.GET, RULES);
if (request.getPageNo() > 0) {
internalRequest.addParameter("pageNo", String.valueOf(request.getPageNo()));
}
if (request.getPageSize() > 0) {
internalRequest.addParameter("pageSize", String.valueOf(request.getPageSize()));
}
return this.invokeHttpClient(internalRequest, ListRuleResponse.class);
} | java | public ListRuleResponse listRules(ListRuleRequest request) {
InternalRequest internalRequest =
createRequest(request, HttpMethodName.GET, RULES);
if (request.getPageNo() > 0) {
internalRequest.addParameter("pageNo", String.valueOf(request.getPageNo()));
}
if (request.getPageSize() > 0) {
internalRequest.addParameter("pageSize", String.valueOf(request.getPageSize()));
}
return this.invokeHttpClient(internalRequest, ListRuleResponse.class);
} | [
"public",
"ListRuleResponse",
"listRules",
"(",
"ListRuleRequest",
"request",
")",
"{",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"request",
",",
"HttpMethodName",
".",
"GET",
",",
"RULES",
")",
";",
"if",
"(",
"request",
".",
"getPageNo",
... | list all the rules under this account
@param request: specify the pageNo, pageSize etc.
@return all or a subset of rules according to pageNo, and pageSize | [
"list",
"all",
"the",
"rules",
"under",
"this",
"account"
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/ruleengine/RuleEngineClient.java#L74-L84 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.createRequest | private InternalRequest createRequest(AbstractBceRequest bceRequest, HttpMethodName httpMethod,
String... pathVariables) {
List<String> path = new ArrayList<String>();
path.add(VERSION);
if (pathVariables != null) {
for (String pathVariable : pathVariables) {
path.add(pathVariable);
}
}
URI uri = HttpUtils.appendUri(this.getEndpoint(), path.toArray(new String[path.size()]));
InternalRequest request = new InternalRequest(httpMethod, uri);
request.setCredentials(bceRequest.getRequestCredentials());
return request;
} | java | private InternalRequest createRequest(AbstractBceRequest bceRequest, HttpMethodName httpMethod,
String... pathVariables) {
List<String> path = new ArrayList<String>();
path.add(VERSION);
if (pathVariables != null) {
for (String pathVariable : pathVariables) {
path.add(pathVariable);
}
}
URI uri = HttpUtils.appendUri(this.getEndpoint(), path.toArray(new String[path.size()]));
InternalRequest request = new InternalRequest(httpMethod, uri);
request.setCredentials(bceRequest.getRequestCredentials());
return request;
} | [
"private",
"InternalRequest",
"createRequest",
"(",
"AbstractBceRequest",
"bceRequest",
",",
"HttpMethodName",
"httpMethod",
",",
"String",
"...",
"pathVariables",
")",
"{",
"List",
"<",
"String",
">",
"path",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")... | Creates and initializes a new request object for the specified bcc resource. This method is responsible
for determining the right way to address resources.
@param bceRequest The original request, as created by the user.
@param httpMethod The HTTP method to use when sending the request.
@param pathVariables The optional variables used in the URI path.
@return A new request object, populated with endpoint, resource path, ready for callers to populate
any additional headers or parameters, and execute. | [
"Creates",
"and",
"initializes",
"a",
"new",
"request",
"object",
"for",
"the",
"specified",
"bcc",
"resource",
".",
"This",
"method",
"is",
"responsible",
"for",
"determining",
"the",
"right",
"way",
"to",
"address",
"resources",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L163-L178 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.fillPayload | private void fillPayload(InternalRequest internalRequest, AbstractBceRequest bceRequest) {
if (internalRequest.getHttpMethod() == HttpMethodName.POST
|| internalRequest.getHttpMethod() == HttpMethodName.PUT) {
String strJson = JsonUtils.toJsonString(bceRequest);
byte[] requestJson = null;
try {
requestJson = strJson.getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Unsupported encode.", e);
}
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(requestJson.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
internalRequest.setContent(RestartableInputStream.wrap(requestJson));
}
} | java | private void fillPayload(InternalRequest internalRequest, AbstractBceRequest bceRequest) {
if (internalRequest.getHttpMethod() == HttpMethodName.POST
|| internalRequest.getHttpMethod() == HttpMethodName.PUT) {
String strJson = JsonUtils.toJsonString(bceRequest);
byte[] requestJson = null;
try {
requestJson = strJson.getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Unsupported encode.", e);
}
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(requestJson.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
internalRequest.setContent(RestartableInputStream.wrap(requestJson));
}
} | [
"private",
"void",
"fillPayload",
"(",
"InternalRequest",
"internalRequest",
",",
"AbstractBceRequest",
"bceRequest",
")",
"{",
"if",
"(",
"internalRequest",
".",
"getHttpMethod",
"(",
")",
"==",
"HttpMethodName",
".",
"POST",
"||",
"internalRequest",
".",
"getHttpM... | The method to fill the internalRequest's content field with bceRequest.
Only support HttpMethodName.POST or HttpMethodName.PUT
@param internalRequest A request object, populated with endpoint, resource path, ready for callers to populate
any additional headers or parameters, and execute.
@param bceRequest The original request, as created by the user. | [
"The",
"method",
"to",
"fill",
"the",
"internalRequest",
"s",
"content",
"field",
"with",
"bceRequest",
".",
"Only",
"support",
"HttpMethodName",
".",
"POST",
"or",
"HttpMethodName",
".",
"PUT"
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L188-L202 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.aes128WithFirst16Char | private String aes128WithFirst16Char(String content, String privateKey) throws GeneralSecurityException {
byte[] crypted = null;
SecretKeySpec skey = new SecretKeySpec(privateKey.substring(0, 16).getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, skey);
crypted = cipher.doFinal(content.getBytes());
return new String(Hex.encodeHex(crypted));
} | java | private String aes128WithFirst16Char(String content, String privateKey) throws GeneralSecurityException {
byte[] crypted = null;
SecretKeySpec skey = new SecretKeySpec(privateKey.substring(0, 16).getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, skey);
crypted = cipher.doFinal(content.getBytes());
return new String(Hex.encodeHex(crypted));
} | [
"private",
"String",
"aes128WithFirst16Char",
"(",
"String",
"content",
",",
"String",
"privateKey",
")",
"throws",
"GeneralSecurityException",
"{",
"byte",
"[",
"]",
"crypted",
"=",
"null",
";",
"SecretKeySpec",
"skey",
"=",
"new",
"SecretKeySpec",
"(",
"privateK... | The encryption implement for AES-128 algorithm for BCE password encryption.
Only the first 16 bytes of privateKey will be used to encrypt the content.
See more detail on
<a href = "https://bce.baidu.com/doc/BCC/API.html#.7A.E6.31.D8.94.C1.A1.C2.1A.8D.92.ED.7F.60.7D.AF">
BCE API doc</a>
@param content The content String to encrypt.
@param privateKey The security key to encrypt.
Only the first 16 bytes of privateKey will be used to encrypt the content.
@return The encrypted string of the original content with AES-128 algorithm.
@throws GeneralSecurityException | [
"The",
"encryption",
"implement",
"for",
"AES",
"-",
"128",
"algorithm",
"for",
"BCE",
"password",
"encryption",
".",
"Only",
"the",
"first",
"16",
"bytes",
"of",
"privateKey",
"will",
"be",
"used",
"to",
"encrypt",
"the",
"content",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L229-L236 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.listInstances | public ListInstancesResponse listInstances(ListInstancesRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, INSTANCE_PREFIX);
if (request.getMarker() != null) {
internalRequest.addParameter("marker", request.getMarker());
}
if (request.getMaxKeys() > 0) {
internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
}
if (!Strings.isNullOrEmpty(request.getInternalIp())) {
internalRequest.addParameter("internalIp", request.getInternalIp());
}
if (!Strings.isNullOrEmpty(request.getDedicatedHostId())) {
internalRequest.addParameter("dedicatedHostId", request.getDedicatedHostId());
}
if (!Strings.isNullOrEmpty(request.getZoneName())) {
internalRequest.addParameter("zoneName", request.getZoneName());
}
return invokeHttpClient(internalRequest, ListInstancesResponse.class);
} | java | public ListInstancesResponse listInstances(ListInstancesRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, INSTANCE_PREFIX);
if (request.getMarker() != null) {
internalRequest.addParameter("marker", request.getMarker());
}
if (request.getMaxKeys() > 0) {
internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
}
if (!Strings.isNullOrEmpty(request.getInternalIp())) {
internalRequest.addParameter("internalIp", request.getInternalIp());
}
if (!Strings.isNullOrEmpty(request.getDedicatedHostId())) {
internalRequest.addParameter("dedicatedHostId", request.getDedicatedHostId());
}
if (!Strings.isNullOrEmpty(request.getZoneName())) {
internalRequest.addParameter("zoneName", request.getZoneName());
}
return invokeHttpClient(internalRequest, ListInstancesResponse.class);
} | [
"public",
"ListInstancesResponse",
"listInstances",
"(",
"ListInstancesRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"this",
".",
"createRequest",
"(",
"request",... | Return a list of instances owned by the authenticated user.
@param request The request containing all options for listing own's bcc Instance.
@return The response containing a list of instances owned by the authenticated user. | [
"Return",
"a",
"list",
"of",
"instances",
"owned",
"by",
"the",
"authenticated",
"user",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L314-L333 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.getInstance | public GetInstanceResponse getInstance(GetInstanceRequest request) {
checkNotNull(request, "request should not be null.");
checkNotNull(request.getInstanceId(), "request instanceId should not be null.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.GET, INSTANCE_PREFIX, request.getInstanceId());
return this.invokeHttpClient(internalRequest, GetInstanceResponse.class);
} | java | public GetInstanceResponse getInstance(GetInstanceRequest request) {
checkNotNull(request, "request should not be null.");
checkNotNull(request.getInstanceId(), "request instanceId should not be null.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.GET, INSTANCE_PREFIX, request.getInstanceId());
return this.invokeHttpClient(internalRequest, GetInstanceResponse.class);
} | [
"public",
"GetInstanceResponse",
"getInstance",
"(",
"GetInstanceRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkNotNull",
"(",
"request",
".",
"getInstanceId",
"(",
")",
",",
"\"request instanceId s... | Get the detail information of specified instance.
@param request The request containing all options for getting the instance info.
@return A instance detail model for the instanceId. | [
"Get",
"the",
"detail",
"information",
"of",
"specified",
"instance",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L351-L357 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.startInstance | public void startInstance(StartInstanceRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, INSTANCE_PREFIX, request.getInstanceId());
internalRequest.addParameter(InstanceAction.start.name(), null);
fillPayload(internalRequest, request);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void startInstance(StartInstanceRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, INSTANCE_PREFIX, request.getInstanceId());
internalRequest.addParameter(InstanceAction.start.name(), null);
fillPayload(internalRequest, request);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"startInstance",
"(",
"StartInstanceRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getInstanceId",
"(",
")",
",",
"\"request instanceId shoul... | Starting the instance owned by the user.
You can start the instance only when the instance is Stopped,
otherwise,it's will get <code>409</code> errorCode.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getInstance(GetInstanceRequest)}
@param request The request containing all options for starting the instance. | [
"Starting",
"the",
"instance",
"owned",
"by",
"the",
"user",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L385-L393 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.modifyInstanceAttributes | public void modifyInstanceAttributes(ModifyInstanceAttributesRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
checkStringNotEmpty(request.getName(), "request name should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, INSTANCE_PREFIX, request.getInstanceId());
internalRequest.addParameter(InstanceAction.modifyAttribute.name(), null);
fillPayload(internalRequest, request);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void modifyInstanceAttributes(ModifyInstanceAttributesRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
checkStringNotEmpty(request.getName(), "request name should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, INSTANCE_PREFIX, request.getInstanceId());
internalRequest.addParameter(InstanceAction.modifyAttribute.name(), null);
fillPayload(internalRequest, request);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"modifyInstanceAttributes",
"(",
"ModifyInstanceAttributesRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getInstanceId",
"(",
")",
",",
"\"re... | Modifying the special attribute to new value of the instance.
You can reboot the instance only when the instance is Running or Stopped ,
otherwise,it's will get <code>409</code> errorCode.
@param request The request containing all options for modifying the instance attribute. | [
"Modifying",
"the",
"special",
"attribute",
"to",
"new",
"value",
"of",
"the",
"instance",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L565-L574 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.rebuildInstance | public void rebuildInstance(String instanceId, String imageId, String adminPass) throws BceClientException {
this.rebuildInstance(new RebuildInstanceRequest().withInstanceId(instanceId)
.withImageId(imageId).withAdminPass(adminPass));
} | java | public void rebuildInstance(String instanceId, String imageId, String adminPass) throws BceClientException {
this.rebuildInstance(new RebuildInstanceRequest().withInstanceId(instanceId)
.withImageId(imageId).withAdminPass(adminPass));
} | [
"public",
"void",
"rebuildInstance",
"(",
"String",
"instanceId",
",",
"String",
"imageId",
",",
"String",
"adminPass",
")",
"throws",
"BceClientException",
"{",
"this",
".",
"rebuildInstance",
"(",
"new",
"RebuildInstanceRequest",
"(",
")",
".",
"withInstanceId",
... | Rebuilding the instance owned by the user.
After rebuilding the instance,
all of snapshots created from original instance system disk will be deleted,
all of customized images will be saved for using in the future.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getInstance(GetInstanceRequest)}
@param instanceId The id of the instance.
@param imageId The id of the image which is used to rebuild the instance.
@param adminPass The admin password to login the instance.
The admin password will be encrypted in AES-128 algorithm
with the substring of the former 16 characters of user SecretKey.
See more detail on
<a href = "https://bce.baidu.com/doc/BCC/API.html#.7A.E6.31.D8.94.C1.A1.C2.1A.8D.92.ED.7F.60.7D.AF">
BCE API doc</a>
@throws BceClientException | [
"Rebuilding",
"the",
"instance",
"owned",
"by",
"the",
"user",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L597-L600 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.releaseInstance | public void releaseInstance(ReleaseInstanceRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.DELETE, INSTANCE_PREFIX, request.getInstanceId());
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void releaseInstance(ReleaseInstanceRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.DELETE, INSTANCE_PREFIX, request.getInstanceId());
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"releaseInstance",
"(",
"ReleaseInstanceRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getInstanceId",
"(",
")",
",",
"\"request instanceId s... | Releasing the instance owned by the user.
Only the Postpaid instance or Prepaid which is expired can be released.
After releasing the instance,
all of the data will be deleted.
all of volumes attached will be detached,but the volume snapshots will be saved.
all of snapshots created from original instance system disk will be deleted,
all of customized images created from original instance system disk will be reserved.
@param request The request containing all options for releasing the instance. | [
"Releasing",
"the",
"instance",
"owned",
"by",
"the",
"user",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L666-L672 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.resizeInstance | public void resizeInstance(ResizeInstanceRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
if (request.getCpuCount() <= 0) {
throw new IllegalArgumentException("request cpuCount should be positive.");
}
if (request.getMemoryCapacityInGB() <= 0) {
throw new IllegalArgumentException("request memoryCapacityInGB should be positive.");
}
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, INSTANCE_PREFIX, request.getInstanceId());
internalRequest.addParameter(InstanceAction.resize.name(), null);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void resizeInstance(ResizeInstanceRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
if (request.getCpuCount() <= 0) {
throw new IllegalArgumentException("request cpuCount should be positive.");
}
if (request.getMemoryCapacityInGB() <= 0) {
throw new IllegalArgumentException("request memoryCapacityInGB should be positive.");
}
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, INSTANCE_PREFIX, request.getInstanceId());
internalRequest.addParameter(InstanceAction.resize.name(), null);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"resizeInstance",
"(",
"ResizeInstanceRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"request",
".",
"getClientToken",
"(",
")",
")... | Resizing the instance owned by the user.
The Prepaid instance can not be downgrade.
Only the Running/Stopped instance can be resized,otherwise,it's will get <code>409</code> errorCode.
After resizing the instance,it will be reboot once.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getInstance(GetInstanceRequest)}
@param request The request containing all options for resizing the instance. | [
"Resizing",
"the",
"instance",
"owned",
"by",
"the",
"user",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L686-L704 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.getInstanceVnc | public GetInstanceVncResponse getInstanceVnc(GetInstanceVncRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.GET, INSTANCE_PREFIX, request.getInstanceId(), "vnc");
return this.invokeHttpClient(internalRequest, GetInstanceVncResponse.class);
} | java | public GetInstanceVncResponse getInstanceVnc(GetInstanceVncRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.GET, INSTANCE_PREFIX, request.getInstanceId(), "vnc");
return this.invokeHttpClient(internalRequest, GetInstanceVncResponse.class);
} | [
"public",
"GetInstanceVncResponse",
"getInstanceVnc",
"(",
"GetInstanceVncRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getInstanceId",
"(",
")",
",",
"\"requ... | Getting the vnc url to access the instance.
The vnc url can be used once.
@param request The request containing all options for getting the vnc url. | [
"Getting",
"the",
"vnc",
"url",
"to",
"access",
"the",
"instance",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L780-L786 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.purchaseReservedInstance | public void purchaseReservedInstance(PurchaseReservedInstanceRequeset request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
if (null == request.getBilling()) {
request.setBilling(generateDefaultBillingWithReservation());
}
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, INSTANCE_PREFIX, request.getInstanceId());
internalRequest.addParameter(InstanceAction.purchaseReserved.name(), null);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void purchaseReservedInstance(PurchaseReservedInstanceRequeset request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
if (null == request.getBilling()) {
request.setBilling(generateDefaultBillingWithReservation());
}
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, INSTANCE_PREFIX, request.getInstanceId());
internalRequest.addParameter(InstanceAction.purchaseReserved.name(), null);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"purchaseReservedInstance",
"(",
"PurchaseReservedInstanceRequeset",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"request",
".",
"getClientToken... | Renewing the instance with fixed duration.
You can not renew the instance which is resizing.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getInstance(GetInstanceRequest)}
@param request The request containing all options for renewing the instance with fixed duration. | [
"Renewing",
"the",
"instance",
"with",
"fixed",
"duration",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L819-L834 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.createVolume | public CreateVolumeResponse createVolume(CreateVolumeRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
if (null == request.getBilling()) {
request.setBilling(generateDefaultBilling());
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, VOLUME_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateVolumeResponse.class);
} | java | public CreateVolumeResponse createVolume(CreateVolumeRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
if (null == request.getBilling()) {
request.setBilling(generateDefaultBilling());
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, VOLUME_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateVolumeResponse.class);
} | [
"public",
"CreateVolumeResponse",
"createVolume",
"(",
"CreateVolumeRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"request",
".",
"getClientToken",
"(",... | Create a volume with the specified options.
You can use this method to create a new empty volume by specified options
or you can create a new volume from customized volume snapshot but not system disk snapshot.
By using the cdsSizeInGB parameter you can create a newly empty volume.
By using snapshotId parameter to create a volume form specific snapshot.
@param request The request containing all options for creating a volume.
@return The response with list of id of volumes newly created. | [
"Create",
"a",
"volume",
"with",
"the",
"specified",
"options",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L882-L894 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.listVolumes | public ListVolumesResponse listVolumes(ListVolumesRequest request) {
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, VOLUME_PREFIX);
if (request.getMarker() != null) {
internalRequest.addParameter("marker", request.getMarker());
}
if (request.getMaxKeys() > 0) {
internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
}
if (!Strings.isNullOrEmpty(request.getInstanceId())) {
internalRequest.addParameter("instanceId", request.getInstanceId());
}
if (!Strings.isNullOrEmpty(request.getZoneName())) {
internalRequest.addParameter("zoneName", request.getZoneName());
}
return invokeHttpClient(internalRequest, ListVolumesResponse.class);
} | java | public ListVolumesResponse listVolumes(ListVolumesRequest request) {
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, VOLUME_PREFIX);
if (request.getMarker() != null) {
internalRequest.addParameter("marker", request.getMarker());
}
if (request.getMaxKeys() > 0) {
internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
}
if (!Strings.isNullOrEmpty(request.getInstanceId())) {
internalRequest.addParameter("instanceId", request.getInstanceId());
}
if (!Strings.isNullOrEmpty(request.getZoneName())) {
internalRequest.addParameter("zoneName", request.getZoneName());
}
return invokeHttpClient(internalRequest, ListVolumesResponse.class);
} | [
"public",
"ListVolumesResponse",
"listVolumes",
"(",
"ListVolumesRequest",
"request",
")",
"{",
"InternalRequest",
"internalRequest",
"=",
"this",
".",
"createRequest",
"(",
"request",
",",
"HttpMethodName",
".",
"GET",
",",
"VOLUME_PREFIX",
")",
";",
"if",
"(",
"... | Listing volumes owned by the authenticated user.
@param request The request containing all options for listing volumes owned by the authenticated user.
@return The response containing a list of volume owned by the authenticated user. | [
"Listing",
"volumes",
"owned",
"by",
"the",
"authenticated",
"user",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L911-L926 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.getVolume | public GetVolumeResponse getVolume(GetVolumeRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getVolumeId(), "request volumeId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.GET, VOLUME_PREFIX, request.getVolumeId());
return invokeHttpClient(internalRequest, GetVolumeResponse.class);
} | java | public GetVolumeResponse getVolume(GetVolumeRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getVolumeId(), "request volumeId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.GET, VOLUME_PREFIX, request.getVolumeId());
return invokeHttpClient(internalRequest, GetVolumeResponse.class);
} | [
"public",
"GetVolumeResponse",
"getVolume",
"(",
"GetVolumeRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getVolumeId",
"(",
")",
",",
"\"request volumeId shou... | Get the detail information of specified volume.
@param request The request containing all options for getting the detail information of specified volume.
@return The response containing the detail information of specified volume. | [
"Get",
"the",
"detail",
"information",
"of",
"specified",
"volume",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L944-L950 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.releaseVolume | public void releaseVolume(ReleaseVolumeRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getVolumeId(), "request volumeId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.DELETE, VOLUME_PREFIX, request.getVolumeId());
invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void releaseVolume(ReleaseVolumeRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getVolumeId(), "request volumeId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.DELETE, VOLUME_PREFIX, request.getVolumeId());
invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"releaseVolume",
"(",
"ReleaseVolumeRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getVolumeId",
"(",
")",
",",
"\"request volumeId should no... | Releasing the specified volume owned by the user.
You can release the specified volume only
when the volume is Available/Expired/Error,
otherwise,it's will get <code>409</code> errorCode.
@param request The request containing all options for releasing the specified volume. | [
"Releasing",
"the",
"specified",
"volume",
"owned",
"by",
"the",
"user",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1044-L1050 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.createImageFromInstance | public CreateImageResponse createImageFromInstance(String imageName, String instanceId) {
return createImage(new CreateImageRequest()
.withImageName(imageName).withInstanceId(instanceId));
} | java | public CreateImageResponse createImageFromInstance(String imageName, String instanceId) {
return createImage(new CreateImageRequest()
.withImageName(imageName).withInstanceId(instanceId));
} | [
"public",
"CreateImageResponse",
"createImageFromInstance",
"(",
"String",
"imageName",
",",
"String",
"instanceId",
")",
"{",
"return",
"createImage",
"(",
"new",
"CreateImageRequest",
"(",
")",
".",
"withImageName",
"(",
"imageName",
")",
".",
"withInstanceId",
"(... | Creating a customized image from the instance..
<p>
While creating an image from an instance,the instance must be Running or Stopped,
otherwise,it's will get <code>409</code> errorCode.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getImage(GetImageRequest)}
@param imageName The name of image that will be created.
@param instanceId The id of instance which will be used to create image.
@return The response with id of image newly created. | [
"Creating",
"a",
"customized",
"image",
"from",
"the",
"instance",
".."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1206-L1209 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.createImageFromSnapshot | public CreateImageResponse createImageFromSnapshot(String imageName, String snapshotId) {
return createImage(new CreateImageRequest()
.withImageName(imageName).withSnapshotId(snapshotId));
} | java | public CreateImageResponse createImageFromSnapshot(String imageName, String snapshotId) {
return createImage(new CreateImageRequest()
.withImageName(imageName).withSnapshotId(snapshotId));
} | [
"public",
"CreateImageResponse",
"createImageFromSnapshot",
"(",
"String",
"imageName",
",",
"String",
"snapshotId",
")",
"{",
"return",
"createImage",
"(",
"new",
"CreateImageRequest",
"(",
")",
".",
"withImageName",
"(",
"imageName",
")",
".",
"withSnapshotId",
"(... | Creating a customized image from specified snapshot.
You can create the image only from system snapshot.
While creating an image from a system snapshot,the snapshot must be Available,
otherwise,it's will get <code>409</code> errorCode.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getImage(GetImageRequest)}
@param imageName The name of image that will be created.
@param snapshotId The id of snapshot which will be used to create image.
@return The response with id of image newly created. | [
"Creating",
"a",
"customized",
"image",
"from",
"specified",
"snapshot",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1225-L1228 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.createImage | public CreateImageResponse createImage(CreateImageRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
checkStringNotEmpty(request.getImageName(), "request imageName should not be empty.");
if (Strings.isNullOrEmpty(request.getInstanceId()) && Strings.isNullOrEmpty(request.getSnapshotId())) {
throw new IllegalArgumentException("request instanceId or snapshotId should not be empty .");
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, IMAGE_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateImageResponse.class);
} | java | public CreateImageResponse createImage(CreateImageRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
checkStringNotEmpty(request.getImageName(), "request imageName should not be empty.");
if (Strings.isNullOrEmpty(request.getInstanceId()) && Strings.isNullOrEmpty(request.getSnapshotId())) {
throw new IllegalArgumentException("request instanceId or snapshotId should not be empty .");
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, IMAGE_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateImageResponse.class);
} | [
"public",
"CreateImageResponse",
"createImage",
"(",
"CreateImageRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"request",
".",
"getClientToken",
"(",
... | Creating a customized image which can be used for creating instance in the future.
<p>
You can create an image from an instance or you can create from an snapshot.
The parameters of instanceId and snapshotId can no be null simultaneously.
when both instanceId and snapshotId are assigned,only instanceId will be used.
<p>
While creating an image from an instance,the instance must be Running or Stopped,
otherwise,it's will get <code>409</code> errorCode.
<p>
You can create the image only from system snapshot.
While creating an image from a system snapshot,the snapshot must be Available,
otherwise,it's will get <code>409</code> errorCode.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getImage(GetImageRequest)}
@param request The request containing all options for creating a new image.
@return The response with id of image newly created. | [
"Creating",
"a",
"customized",
"image",
"which",
"can",
"be",
"used",
"for",
"creating",
"instance",
"in",
"the",
"future",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1251-L1264 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.listImages | public ListImagesResponse listImages(ListImagesRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, IMAGE_PREFIX);
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.getImageType())) {
internalRequest.addParameter("imageType", request.getImageType());
}
return invokeHttpClient(internalRequest, ListImagesResponse.class);
} | java | public ListImagesResponse listImages(ListImagesRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, IMAGE_PREFIX);
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.getImageType())) {
internalRequest.addParameter("imageType", request.getImageType());
}
return invokeHttpClient(internalRequest, ListImagesResponse.class);
} | [
"public",
"ListImagesResponse",
"listImages",
"(",
"ListImagesRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"this",
".",
"createRequest",
"(",
"request",
",",
... | Listing images owned by the authenticated user.
@param request The request containing all options for listing images owned by user.
@return The response with list of images. | [
"Listing",
"images",
"owned",
"by",
"the",
"authenticated",
"user",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1281-L1294 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.getImage | public GetImageResponse getImage(GetImageRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getImageId(), "request imageId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.GET, IMAGE_PREFIX, request.getImageId());
return invokeHttpClient(internalRequest, GetImageResponse.class);
} | java | public GetImageResponse getImage(GetImageRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getImageId(), "request imageId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.GET, IMAGE_PREFIX, request.getImageId());
return invokeHttpClient(internalRequest, GetImageResponse.class);
} | [
"public",
"GetImageResponse",
"getImage",
"(",
"GetImageRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getImageId",
"(",
")",
",",
"\"request imageId should no... | Get the detail information of specified image.
@param request The request containing all options for getting the detail information of specified image.
@return The response with the image detail information. | [
"Get",
"the",
"detail",
"information",
"of",
"specified",
"image",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1312-L1318 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.deleteImage | public void deleteImage(DeleteImageRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getImageId(), "request imageId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.DELETE, IMAGE_PREFIX, request.getImageId());
invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void deleteImage(DeleteImageRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getImageId(), "request imageId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.DELETE, IMAGE_PREFIX, request.getImageId());
invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"deleteImage",
"(",
"DeleteImageRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getImageId",
"(",
")",
",",
"\"request imageId should not be e... | Deleting the specified image.
Only the customized image can be deleted,
otherwise,it's will get <code>403</code> errorCode.
@param request The request containing all options for deleting the specified image. | [
"Deleting",
"the",
"specified",
"image",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1340-L1346 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.listSnapshots | public ListSnapshotsResponse listSnapshots(ListSnapshotsRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, SNAPSHOT_PREFIX);
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.getVolumeId())) {
internalRequest.addParameter("volumeId", request.getVolumeId());
}
return invokeHttpClient(internalRequest, ListSnapshotsResponse.class);
} | java | public ListSnapshotsResponse listSnapshots(ListSnapshotsRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, SNAPSHOT_PREFIX);
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.getVolumeId())) {
internalRequest.addParameter("volumeId", request.getVolumeId());
}
return invokeHttpClient(internalRequest, ListSnapshotsResponse.class);
} | [
"public",
"ListSnapshotsResponse",
"listSnapshots",
"(",
"ListSnapshotsRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"this",
".",
"createRequest",
"(",
"request",... | Listing snapshots owned by the authenticated user.
@param request The request containing all options for listing snapshot.
@return The response contains a list of snapshots owned by the user. | [
"Listing",
"snapshots",
"owned",
"by",
"the",
"authenticated",
"user",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1425-L1438 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.getSnapshot | public GetSnapshotResponse getSnapshot(GetSnapshotRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getSnapshotId(), "request snapshotId should no be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.GET, SNAPSHOT_PREFIX, request.getSnapshotId());
return invokeHttpClient(internalRequest, GetSnapshotResponse.class);
} | java | public GetSnapshotResponse getSnapshot(GetSnapshotRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getSnapshotId(), "request snapshotId should no be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.GET, SNAPSHOT_PREFIX, request.getSnapshotId());
return invokeHttpClient(internalRequest, GetSnapshotResponse.class);
} | [
"public",
"GetSnapshotResponse",
"getSnapshot",
"(",
"GetSnapshotRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getSnapshotId",
"(",
")",
",",
"\"request snaps... | Getting the detail information of specified snapshot.
@param request The request containing all options for getting the detail information of specified snapshot.
@return The response with the snapshot detail information. | [
"Getting",
"the",
"detail",
"information",
"of",
"specified",
"snapshot",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1456-L1462 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.deleteSnapshot | public void deleteSnapshot(DeleteSnapshotRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getSnapshotId(), "request snapshotId should no be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.DELETE, SNAPSHOT_PREFIX, request.getSnapshotId());
invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void deleteSnapshot(DeleteSnapshotRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getSnapshotId(), "request snapshotId should no be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.DELETE, SNAPSHOT_PREFIX, request.getSnapshotId());
invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"deleteSnapshot",
"(",
"DeleteSnapshotRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getSnapshotId",
"(",
")",
",",
"\"request snapshotId sho... | Deleting the specified snapshot.
Only when the snapshot is CreatedFailed or Available,the specified snapshot can be deleted.
otherwise,it's will get <code>403</code> errorCode.
@param request The request containing all options for deleting the specified snapshot. | [
"Deleting",
"the",
"specified",
"snapshot",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1484-L1490 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.listSecurityGroups | public ListSecurityGroupsResponse listSecurityGroups(ListSecurityGroupsRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, SECURITYGROUP_PREFIX);
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.getInstanceId())) {
internalRequest.addParameter("instanceId", request.getInstanceId());
}
if (!Strings.isNullOrEmpty(request.getVpcId())) {
internalRequest.addParameter("vpcId", request.getVpcId());
}
return invokeHttpClient(internalRequest, ListSecurityGroupsResponse.class);
} | java | public ListSecurityGroupsResponse listSecurityGroups(ListSecurityGroupsRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, SECURITYGROUP_PREFIX);
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.getInstanceId())) {
internalRequest.addParameter("instanceId", request.getInstanceId());
}
if (!Strings.isNullOrEmpty(request.getVpcId())) {
internalRequest.addParameter("vpcId", request.getVpcId());
}
return invokeHttpClient(internalRequest, ListSecurityGroupsResponse.class);
} | [
"public",
"ListSecurityGroupsResponse",
"listSecurityGroups",
"(",
"ListSecurityGroupsRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"this",
".",
"createRequest",
"(... | Listing SecurityGroup owned by the authenticated user.
@param request The request containing all options for listing SecurityGroup owned by user.
@return The response with list of SecurityGroup which contains SecurityGroup rules owned by user. | [
"Listing",
"SecurityGroup",
"owned",
"by",
"the",
"authenticated",
"user",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1500-L1516 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.createSecurityGroup | public CreateSecurityGroupResponse createSecurityGroup(CreateSecurityGroupRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
checkStringNotEmpty(request.getName(), "request name should not be empty.");
if (null == request.getRules() || request.getRules().isEmpty()) {
throw new IllegalArgumentException("request rules should not be empty");
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, SECURITYGROUP_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateSecurityGroupResponse.class);
} | java | public CreateSecurityGroupResponse createSecurityGroup(CreateSecurityGroupRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
checkStringNotEmpty(request.getName(), "request name should not be empty.");
if (null == request.getRules() || request.getRules().isEmpty()) {
throw new IllegalArgumentException("request rules should not be empty");
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, SECURITYGROUP_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateSecurityGroupResponse.class);
} | [
"public",
"CreateSecurityGroupResponse",
"createSecurityGroup",
"(",
"CreateSecurityGroupRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"request",
".",
"ge... | Creating a newly SecurityGroup with specified rules.
@param request The request containing all options for creating a new SecurityGroup.
@return The response with the id of SecurityGroup that was created newly. | [
"Creating",
"a",
"newly",
"SecurityGroup",
"with",
"specified",
"rules",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1524-L1537 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.authorizeSecurityGroupRule | public void authorizeSecurityGroupRule(SecurityGroupRuleOperateRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getSecurityGroupId(), "securityGroupId should not be empty.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
if (null == request.getRule()) {
throw new IllegalArgumentException("request rule should not be null");
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT, SECURITYGROUP_PREFIX,
request.getSecurityGroupId());
internalRequest.addParameter("authorizeRule", null);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void authorizeSecurityGroupRule(SecurityGroupRuleOperateRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getSecurityGroupId(), "securityGroupId should not be empty.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
if (null == request.getRule()) {
throw new IllegalArgumentException("request rule should not be null");
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT, SECURITYGROUP_PREFIX,
request.getSecurityGroupId());
internalRequest.addParameter("authorizeRule", null);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"authorizeSecurityGroupRule",
"(",
"SecurityGroupRuleOperateRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getSecurityGroupId",
"(",
")",
",",
... | authorizing a security group rule to a specified security group
@param request The request containing all options for authorizing security group rule | [
"authorizing",
"a",
"security",
"group",
"rule",
"to",
"a",
"specified",
"security",
"group"
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1543-L1558 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.deleteSecurityGroup | public void deleteSecurityGroup(DeleteSecurityGroupRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getSecurityGroupId(), "request securityGroupId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.DELETE, SECURITYGROUP_PREFIX, request.getSecurityGroupId());
invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void deleteSecurityGroup(DeleteSecurityGroupRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getSecurityGroupId(), "request securityGroupId should not be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.DELETE, SECURITYGROUP_PREFIX, request.getSecurityGroupId());
invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"deleteSecurityGroup",
"(",
"DeleteSecurityGroupRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getSecurityGroupId",
"(",
")",
",",
"\"request... | Deleting the specified SecurityGroup.
@param request The request containing all options for deleting the specified SecurityGroup owned by user. | [
"Deleting",
"the",
"specified",
"SecurityGroup",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1595-L1601 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/model/ObjectMetadata.java | ObjectMetadata.getUserMetaDataOf | public String getUserMetaDataOf(String key) {
return this.userMetadata == null ? null : this.userMetadata.get(key);
} | java | public String getUserMetaDataOf(String key) {
return this.userMetadata == null ? null : this.userMetadata.get(key);
} | [
"public",
"String",
"getUserMetaDataOf",
"(",
"String",
"key",
")",
"{",
"return",
"this",
".",
"userMetadata",
"==",
"null",
"?",
"null",
":",
"this",
".",
"userMetadata",
".",
"get",
"(",
"key",
")",
";",
"}"
] | For internal use only. Returns the value of the userMetadata for the specified key.
@param key the key of the userMetadata
@return the value of the userMetadata | [
"For",
"internal",
"use",
"only",
".",
"Returns",
"the",
"value",
"of",
"the",
"userMetadata",
"for",
"the",
"specified",
"key",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/model/ObjectMetadata.java#L164-L166 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vod/VodClient.java | VodClient.listMediaResources | public ListMediaResourceResponse listMediaResources(
int pageNo,
int pageSize,
String status,
Date begin,
Date end,
String title) {
ListMediaResourceRequest request =
new ListMediaResourceRequest()
.withPageNo(pageNo)
.withPageSize(pageSize)
.withStatus(status)
.withBegin(begin)
.withEnd(end)
.withTitle(title);
return listMediaResources(request);
} | java | public ListMediaResourceResponse listMediaResources(
int pageNo,
int pageSize,
String status,
Date begin,
Date end,
String title) {
ListMediaResourceRequest request =
new ListMediaResourceRequest()
.withPageNo(pageNo)
.withPageSize(pageSize)
.withStatus(status)
.withBegin(begin)
.withEnd(end)
.withTitle(title);
return listMediaResources(request);
} | [
"public",
"ListMediaResourceResponse",
"listMediaResources",
"(",
"int",
"pageNo",
",",
"int",
"pageSize",
",",
"String",
"status",
",",
"Date",
"begin",
",",
"Date",
"end",
",",
"String",
"title",
")",
"{",
"ListMediaResourceRequest",
"request",
"=",
"new",
"Li... | List the properties of all media resource managed by VOD service.
recommend use marker mode to get high performance
<p>
The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair.
@param pageNo The pageNo need to list, must be greater than 0
@param pageSize The pageSize ,must in range [LIST_MIN_PAGESIZE,LIST_MAX_PAGESIZE]
@param status The media status, can be null
@param begin The media create date after begin
@param end The media create date before end
@param title The media title, use prefix search
@return The properties of all specific media resources | [
"List",
"the",
"properties",
"of",
"all",
"media",
"resource",
"managed",
"by",
"VOD",
"service",
".",
"recommend",
"use",
"marker",
"mode",
"to",
"get",
"high",
"performance"
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L509-L526 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vod/VodClient.java | VodClient.listMediaResourcesByMarker | public ListMediaResourceByMarkerResponse listMediaResourcesByMarker(
String marker,
int maxSize,
String status,
Date begin,
Date end,
String title) {
ListMediaResourceByMarkerRequest request =
new ListMediaResourceByMarkerRequest().withMarker(marker).withMaxSize(maxSize)
.withStatus(status).withBegin(begin).withEnd(end).withTitle(title);
return listMediaResourcesByMarker(request);
} | java | public ListMediaResourceByMarkerResponse listMediaResourcesByMarker(
String marker,
int maxSize,
String status,
Date begin,
Date end,
String title) {
ListMediaResourceByMarkerRequest request =
new ListMediaResourceByMarkerRequest().withMarker(marker).withMaxSize(maxSize)
.withStatus(status).withBegin(begin).withEnd(end).withTitle(title);
return listMediaResourcesByMarker(request);
} | [
"public",
"ListMediaResourceByMarkerResponse",
"listMediaResourcesByMarker",
"(",
"String",
"marker",
",",
"int",
"maxSize",
",",
"String",
"status",
",",
"Date",
"begin",
",",
"Date",
"end",
",",
"String",
"title",
")",
"{",
"ListMediaResourceByMarkerRequest",
"reque... | Use marker mode to List the properties of all media resource managed by VOD service.
If media size beyond 1000, strongly recommend to use marker mode
<p>
The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair.
@param marker The marker labels the query begining; first query use NULL.
@param maxSize The maxSize returned ,must in range [LIST_MIN_PAGESIZE,LIST_MAX_PAGESIZE]
@param status The media status, can be null
@param begin The media create date after begin
@param end The media create date before end
@param title The media title, use prefix search
@return The properties of all specific media resources | [
"Use",
"marker",
"mode",
"to",
"List",
"the",
"properties",
"of",
"all",
"media",
"resource",
"managed",
"by",
"VOD",
"service",
".",
"If",
"media",
"size",
"beyond",
"1000",
"strongly",
"recommend",
"to",
"use",
"marker",
"mode"
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L575-L587 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vod/VodClient.java | VodClient.getMediaSourceDownload | public GetMediaSourceDownloadResponse getMediaSourceDownload(String mediaId, long expiredInSeconds) {
GetMediaSourceDownloadRequest request = new GetMediaSourceDownloadRequest()
.withMediaId(mediaId)
.withExpiredInSeconds(expiredInSeconds);
return getMediaSourceDownload(request);
} | java | public GetMediaSourceDownloadResponse getMediaSourceDownload(String mediaId, long expiredInSeconds) {
GetMediaSourceDownloadRequest request = new GetMediaSourceDownloadRequest()
.withMediaId(mediaId)
.withExpiredInSeconds(expiredInSeconds);
return getMediaSourceDownload(request);
} | [
"public",
"GetMediaSourceDownloadResponse",
"getMediaSourceDownload",
"(",
"String",
"mediaId",
",",
"long",
"expiredInSeconds",
")",
"{",
"GetMediaSourceDownloadRequest",
"request",
"=",
"new",
"GetMediaSourceDownloadRequest",
"(",
")",
".",
"withMediaId",
"(",
"mediaId",
... | get media source download url.
@param mediaId The unique ID for each media resource
@param expiredInSeconds The expire time
@return | [
"get",
"media",
"source",
"download",
"url",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L905-L910 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/tsdb/model/Datapoint.java | Datapoint.addLongValue | 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;
} | java | 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;
} | [
"public",
"Datapoint",
"addLongValue",
"(",
"long",
"time",
",",
"long",
"value",
")",
"{",
"initialValues",
"(",
")",
";",
"checkType",
"(",
"TsdbConstants",
".",
"TYPE_LONG",
")",
";",
"values",
".",
"add",
"(",
"Lists",
".",
"<",
"JsonNode",
">",
"new... | Add datapoint of long type value.
@param time datapoint's timestamp
@param value datapoint's value
@return Datapoint | [
"Add",
"datapoint",
"of",
"long",
"type",
"value",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/Datapoint.java#L110-L116 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/tsdb/model/Datapoint.java | Datapoint.addDoubleValue | 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;
} | java | 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;
} | [
"public",
"Datapoint",
"addDoubleValue",
"(",
"long",
"time",
",",
"double",
"value",
")",
"{",
"initialValues",
"(",
")",
";",
"checkType",
"(",
"TsdbConstants",
".",
"TYPE_DOUBLE",
")",
";",
"values",
".",
"add",
"(",
"Lists",
".",
"<",
"JsonNode",
">",
... | Add datapoint of double type value.
@param time datapoint's timestamp
@param value datapoint's value
@return Datapoint | [
"Add",
"datapoint",
"of",
"double",
"type",
"value",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/Datapoint.java#L125-L131 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/tsdb/model/Datapoint.java | Datapoint.addStringValue | 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;
} | java | 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;
} | [
"public",
"Datapoint",
"addStringValue",
"(",
"long",
"time",
",",
"String",
"value",
")",
"{",
"initialValues",
"(",
")",
";",
"checkType",
"(",
"TsdbConstants",
".",
"TYPE_STRING",
")",
";",
"values",
".",
"add",
"(",
"Lists",
".",
"<",
"JsonNode",
">",
... | Add datapoint of String type value.
@param time datapoint's timestamp
@param value datapoint's value
@return Datapoint | [
"Add",
"datapoint",
"of",
"String",
"type",
"value",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/Datapoint.java#L140-L146 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/tsdb/model/Datapoint.java | Datapoint.addTag | public Datapoint addTag(String tagKey, String tagValue) {
initialTags();
tags.put(tagKey, tagValue);
return this;
} | java | public Datapoint addTag(String tagKey, String tagValue) {
initialTags();
tags.put(tagKey, tagValue);
return this;
} | [
"public",
"Datapoint",
"addTag",
"(",
"String",
"tagKey",
",",
"String",
"tagValue",
")",
"{",
"initialTags",
"(",
")",
";",
"tags",
".",
"put",
"(",
"tagKey",
",",
"tagValue",
")",
";",
"return",
"this",
";",
"}"
] | Add tag for the datapoint.
@param tagKey
@param tagValue
@return Datapoint | [
"Add",
"tag",
"for",
"the",
"datapoint",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/Datapoint.java#L166-L170 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssUtils.java | LssUtils.hmacSha256 | 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));
} | java | 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));
} | [
"public",
"static",
"String",
"hmacSha256",
"(",
"String",
"input",
",",
"String",
"secretKey",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"input\"",
")",
";",
"}",
"else",
"if",
"(",
"secretKey",
... | Encodes the input String using the UTF8 charset and calls hmacSha256;
@param input data to calculate mac
@param secretKey secret key
@return String, sha256 mac | [
"Encodes",
"the",
"input",
"String",
"using",
"the",
"UTF8",
"charset",
"and",
"calls",
"hmacSha256",
";"
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssUtils.java#L27-L34 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/BceClientConfiguration.java | BceClientConfiguration.getEndpoint | 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;
} | java | 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;
} | [
"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",
... | Returns the service endpoint URL to which the client will connect.
@return the service endpoint URL to which the client will connect. | [
"Returns",
"the",
"service",
"endpoint",
"URL",
"to",
"which",
"the",
"client",
"will",
"connect",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/BceClientConfiguration.java#L729-L737 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/auth/BceV1Signer.java | BceV1Signer.sign | @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);
} | java | @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);
} | [
"@",
"Override",
"public",
"void",
"sign",
"(",
"InternalRequest",
"request",
",",
"BceCredentials",
"credentials",
",",
"SignOptions",
"options",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"if",
"(",
"credentials",
... | Sign the given request with the given set of credentials. Modifies the passed-in request to apply the signature.
@param request the request to sign.
@param credentials the credentials to sign the request with.
@param options the options for signing. | [
"Sign",
"the",
"given",
"request",
"with",
"the",
"given",
"set",
"of",
"credentials",
".",
"Modifies",
"the",
"passed",
"-",
"in",
"request",
"to",
"apply",
"the",
"signature",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/auth/BceV1Signer.java#L80-L141 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/route/RouteClient.java | RouteClient.deleteRouteRule | 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);
} | java | 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);
} | [
"public",
"void",
"deleteRouteRule",
"(",
"DeleteRouteRequest",
"deleteRouteRequest",
")",
"{",
"checkNotNull",
"(",
"deleteRouteRequest",
",",
"\"request should not be null.\"",
")",
";",
"checkNotNull",
"(",
"deleteRouteRequest",
".",
"getRouteRuleId",
"(",
")",
",",
... | Delete the specific route rule
@param deleteRouteRequest the request containing all options for deleting route rule. | [
"Delete",
"the",
"specific",
"route",
"rule"
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/route/RouteClient.java#L225-L236 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/moladb/model/BatchGetItemResponse.java | BatchGetItemResponse.setResponses | public void setResponses(Map<String, List<Map<String, AttributeValue>>> responses) {
this.responses = responses;
} | java | public void setResponses(Map<String, List<Map<String, AttributeValue>>> responses) {
this.responses = responses;
} | [
"public",
"void",
"setResponses",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
">",
">",
"responses",
")",
"{",
"this",
".",
"responses",
"=",
"responses",
";",
"}"
] | Set the processed items' content for this BatchGetItem request.
@param responses The processed items' content for this BatchGetItem request. | [
"Set",
"the",
"processed",
"items",
"content",
"for",
"this",
"BatchGetItem",
"request",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/moladb/model/BatchGetItemResponse.java#L75-L77 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.createTranscodingJob | 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);
} | java | 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);
} | [
"public",
"CreateTranscodingJobResponse",
"createTranscodingJob",
"(",
"String",
"pipelineName",
",",
"String",
"sourceKey",
",",
"String",
"targetKey",
",",
"String",
"presetName",
",",
"String",
"watermarkId",
",",
"DelogoArea",
"delogoArea",
")",
"{",
"CreateTranscod... | Creates a new transcoder job which converts media files in BOS buckets with specified preset, watermarkId, and
delogoArea.
@param pipelineName The name of pipeline used by this job.
@param sourceKey The key of the source media file in the bucket specified in the pipeline.
@param targetKey The key of the target media file in the bucket specified in the pipeline.
@param presetName The name of the preset used by this job.
@param watermarkId Single watermarkId associated with the job.
@param delogoArea The delogo area (x, y, width, height).
@return The newly created job ID. | [
"Creates",
"a",
"new",
"transcoder",
"job",
"which",
"converts",
"media",
"files",
"in",
"BOS",
"buckets",
"with",
"specified",
"preset",
"watermarkId",
"and",
"delogoArea",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L319-L340 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.listPipelines | 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);
} | java | 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);
} | [
"public",
"ListPipelinesResponse",
"listPipelines",
"(",
"ListPipelinesRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"HttpMethodNa... | List all your pipelines.
@param request The request object containing all options for listing all pipelines.
@return The list of all your pipelines | [
"List",
"all",
"your",
"pipelines",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L606-L610 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.deletePipeline | 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);
} | java | 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);
} | [
"public",
"void",
"deletePipeline",
"(",
"DeletePipelineRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getPipelineName",
"(",
")",
",",
"\"The pa... | Deletes a pipeline with the specified pipeline name.
@param request The request object containing all options for deleting a pipelines. | [
"Deletes",
"a",
"pipeline",
"with",
"the",
"specified",
"pipeline",
"name",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L660-L668 | train |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.createPreset | public CreatePresetResponse createPreset(String presetName, String container) {
return createPreset(presetName, null, container, true, null, null, null, null, null);
} | java | public CreatePresetResponse createPreset(String presetName, String container) {
return createPreset(presetName, null, container, true, null, null, null, null, null);
} | [
"public",
"CreatePresetResponse",
"createPreset",
"(",
"String",
"presetName",
",",
"String",
"container",
")",
"{",
"return",
"createPreset",
"(",
"presetName",
",",
"null",
",",
"container",
",",
"true",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
... | Create a preset which only convert source media file to a different container format without changing the file
contents.
@param presetName The name of the new preset.
@param container The container type for the output file. Valid values include mp4, flv, hls, mp3, m4a. | [
"Create",
"a",
"preset",
"which",
"only",
"convert",
"source",
"media",
"file",
"to",
"a",
"different",
"container",
"format",
"without",
"changing",
"the",
"file",
"contents",
"."
] | f7140f28dd82121515c88ded7bfe769a37d0ec4a | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L833-L835 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.