huaweicloud / huaweicloud-sdk-python-obs

Apache License 2.0
73 stars 41 forks source link

Delete nonexistent object won't give any special response #4

Closed namoshizun closed 4 years ago

namoshizun commented 4 years ago

Hii, It appears that while deleting an object, the response payload will always include status code "204" regardless of the object actually exist or not, in which case, there is no easy way for me to raise a warning in my application in the titled scenario... Is there a way to know if the object to be deleted already exist on the storage?

Asa-Lee commented 4 years ago

You can try these two apis:

  1. client.listObjects
  2. client.headObject
namoshizun commented 4 years ago

You can try these two apis:

  1. client.listObjects
  2. client.headObject

Yeah that's certainly a possible solution for this, but what I actually hoped is that the response of object delete will be different if the target does not exist, so that I don't need to send another query before or after just to confirm the target existence. Would be better if deleteObject raise an exception in such case, or accept an keyword param like "ensure_exist" which will raise the exception if is set to True.

Asa-Lee commented 4 years ago

You can try these two apis:

  1. client.listObjects
  2. client.headObject

Yeah that's certainly a possible solution for this, but what I actually hoped is that the response of object delete will be different if the target does not exist, so that I don't need to send another query before or after just to confirm the target existence. Would be better if deleteObject raise an exception in such case, or accept an keyword param like "ensure_exist" which will raise the exception if is set to True.

This feature is not supported currently. We'll evaluate it as soon as possible.