-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
131077f
commit 310147b
Showing
26 changed files
with
1,650 additions
and
1 deletion.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
app/src/main/java/com/obs/services/model/BaseBucketRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Copyright 2019 Huawei Technologies Co.,Ltd. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed | ||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package com.obs.services.model; | ||
|
||
/** | ||
* Basic class of bucket requests | ||
* | ||
* @since 3.20.3 | ||
* | ||
*/ | ||
public class BaseBucketRequest extends GenericRequest { | ||
private String bucketName; | ||
|
||
public BaseBucketRequest() { | ||
|
||
} | ||
|
||
public BaseBucketRequest(String bucketName) { | ||
this.bucketName = bucketName; | ||
} | ||
|
||
/** | ||
* Obtain the bucket name. | ||
* | ||
* @return Bucket name | ||
*/ | ||
public String getBucketName() { | ||
return bucketName; | ||
} | ||
|
||
/** | ||
* Set the bucket name. | ||
* | ||
* @param bucketName | ||
* Bucket name | ||
*/ | ||
public void setBucketName(String bucketName) { | ||
this.bucketName = bucketName; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "BaseBucketRequest [bucketName=" + bucketName + ", isRequesterPays()=" + isRequesterPays() + "]"; | ||
} | ||
} |
102 changes: 102 additions & 0 deletions
102
app/src/main/java/com/obs/services/model/BaseObjectRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/** | ||
* Copyright 2019 Huawei Technologies Co.,Ltd. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed | ||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package com.obs.services.model; | ||
|
||
/** | ||
* Basic class of object requests | ||
* | ||
* @since 3.20.3 | ||
*/ | ||
public class BaseObjectRequest extends GenericRequest { | ||
private String bucketName; | ||
private String objectKey; | ||
private String versionId; | ||
|
||
public BaseObjectRequest() { | ||
} | ||
|
||
public BaseObjectRequest(String bucketName, String objectKey) { | ||
this.bucketName = bucketName; | ||
this.objectKey = objectKey; | ||
} | ||
|
||
public BaseObjectRequest(String bucketName, String objectKey, String versionId) { | ||
this(bucketName, objectKey); | ||
this.versionId = versionId; | ||
} | ||
|
||
/** | ||
* Obtain the bucket name. | ||
* | ||
* @return Bucket name | ||
*/ | ||
public String getBucketName() { | ||
return bucketName; | ||
} | ||
|
||
/** | ||
* Set the bucket name. | ||
* | ||
* @param bucketName | ||
* Bucket name | ||
*/ | ||
public void setBucketName(String bucketName) { | ||
this.bucketName = bucketName; | ||
} | ||
|
||
/** | ||
* Obtain the object name. | ||
* | ||
* @return Object name | ||
*/ | ||
public String getObjectKey() { | ||
return objectKey; | ||
} | ||
|
||
/** | ||
* Set the object name. | ||
* | ||
* @param objectKey | ||
* Object name | ||
*/ | ||
public void setObjectKey(String objectKey) { | ||
this.objectKey = objectKey; | ||
} | ||
|
||
/** | ||
* Obtain the object version ID. | ||
* | ||
* @return Version ID of the object | ||
*/ | ||
public String getVersionId() { | ||
return versionId; | ||
} | ||
|
||
/** | ||
* Set the version ID of the object. | ||
* | ||
* @param versionId | ||
* Version ID of the object | ||
*/ | ||
public void setVersionId(String versionId) { | ||
this.versionId = versionId; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "BaseObjectRequest [bucketName=" + bucketName + ", objectKey=" + objectKey + ", versionId=" + versionId | ||
+ ", isRequesterPays()=" + isRequesterPays() + "]"; | ||
} | ||
} |
124 changes: 124 additions & 0 deletions
124
app/src/main/java/com/obs/services/model/DeleteObjectRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/** | ||
* Copyright 2019 Huawei Technologies Co.,Ltd. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed | ||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package com.obs.services.model; | ||
|
||
/** | ||
* Request parameters for deleting an object. | ||
* | ||
* @since 3.20.3 | ||
*/ | ||
public class DeleteObjectRequest extends GenericRequest { | ||
private String bucketName; | ||
|
||
private String objectKey; | ||
|
||
private String versionId; | ||
|
||
public DeleteObjectRequest() { | ||
|
||
} | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param bucketName | ||
* Bucket name | ||
* @param objectKey | ||
* Object name | ||
*/ | ||
public DeleteObjectRequest(String bucketName, String objectKey) { | ||
this.bucketName = bucketName; | ||
this.objectKey = objectKey; | ||
} | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param bucketName | ||
* Bucket name | ||
* @param objectKey | ||
* Object name | ||
* @param versionId | ||
* Object version ID | ||
*/ | ||
public DeleteObjectRequest(String bucketName, String objectKey, String versionId) { | ||
this(bucketName, objectKey); | ||
this.versionId = versionId; | ||
} | ||
|
||
/** | ||
* Obtain the version ID of the object to be deleted. | ||
* | ||
* @return Version ID of the object to be deleted | ||
*/ | ||
public String getVersionId() { | ||
return versionId; | ||
} | ||
|
||
/** | ||
* Set the version ID of the object to be deleted. | ||
* @param versionId | ||
* Version ID of the object to be deleted | ||
*/ | ||
public void setVersionId(String versionId) { | ||
this.versionId = versionId; | ||
} | ||
|
||
/** | ||
* Obtain the name of the bucket to which the to-be-deleted object belongs. | ||
* | ||
* @return Name of the bucket to which the to-be-deleted object belongs | ||
*/ | ||
public String getBucketName() { | ||
return bucketName; | ||
} | ||
|
||
/** | ||
* Set the name of the bucket to which the to-be-deleted object belongs. | ||
* | ||
* @param bucketName | ||
* Name of the bucket to which the to-be-deleted object belongs | ||
*/ | ||
public void setBucketName(String bucketName) { | ||
this.bucketName = bucketName; | ||
} | ||
|
||
/** | ||
* Obtain the name of the object to be deleted. | ||
* | ||
* @return Name of the object to be deleted | ||
*/ | ||
public String getObjectKey() { | ||
return objectKey; | ||
} | ||
|
||
/** | ||
* Set the name of the object to be deleted. | ||
* | ||
* @param objectKey | ||
* Name of the object to be deleted | ||
*/ | ||
public void setObjectKey(String objectKey) { | ||
this.objectKey = objectKey; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "AbortMultipartUploadRequest [bucketName=" + bucketName + ", objectKey=" | ||
+ objectKey + ", versionId=" + versionId + "]"; | ||
} | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
app/src/main/java/com/obs/services/model/GenericRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Copyright 2019 Huawei Technologies Co.,Ltd. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed | ||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package com.obs.services.model; | ||
|
||
/** | ||
* Basic class of all requests, which encapsulates common parameters used by all requests. | ||
* | ||
* @since 3.20.3 | ||
*/ | ||
public class GenericRequest { | ||
/** | ||
* If the requester-pays function is enabled, the requester pays for his/her operations on the bucket. | ||
*/ | ||
private boolean isRequesterPays; | ||
|
||
/** | ||
* If the requester is allowed to pay, true is returned. Otherwise, false is returned. | ||
* | ||
* <p> | ||
* If the requester-pays function is enabled for a bucket, this attribute must be set to true when the bucket is requested by a requester other than the bucket owner. Otherwise, status code 403 is returned. | ||
* | ||
* <p> | ||
* After the requester-pays function is enabled, anonymous access to the bucket is not allowed. | ||
* | ||
* @return If the requester is allowed to pay, true is returned. Otherwise, false is returned. | ||
*/ | ||
public boolean isRequesterPays() { | ||
return isRequesterPays; | ||
} | ||
|
||
/** | ||
* Used to configure whether to enable the requester-pays function. | ||
* | ||
* <p> | ||
* If the requester-pays function is enabled for a bucket, this attribute must be set to true when the bucket is requested by a requester other than the bucket owner. Otherwise, status code 403 is returned. | ||
* | ||
* <p> | ||
* After the requester-pays function is enabled, anonymous access to the bucket is not allowed. | ||
* | ||
* @param isRequesterPays True indicates to enable the requester-pays function. False indicates to disable the requester-pays function. | ||
*/ | ||
public void setRequesterPays(boolean isRequesterPays) { | ||
this.isRequesterPays = isRequesterPays; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "GenericRequest [isRequesterPays=" + isRequesterPays + "]"; | ||
} | ||
} |
Oops, something went wrong.