BlobBaseClientExistsClassifier
using Azure.Core;
namespace Azure.Storage.Blobs.Models
{
internal class BlobBaseClientExistsClassifier
{
public static bool IsResourceNotFoundResponse(Response response)
{
ResponseHeaders headers = response.get_Headers();
string value = default(string);
if (headers.TryGetValue("x-ms-error-code", ref value) && (value == BlobErrorCode.BlobNotFound || value == BlobErrorCode.ContainerNotFound))
return true;
return false;
}
public static bool IsUsesCustomerSpecifiedEncryptionResponse(Response response)
{
ResponseHeaders headers = response.get_Headers();
string value = default(string);
if (headers.TryGetValue("x-ms-error-code", ref value) && value == BlobErrorCode.BlobUsesCustomerSpecifiedEncryption)
return true;
return false;
}
public override bool TryClassify(HttpMessage message, out bool isError)
{
if (IsResourceNotFoundResponse(message.get_Response()) || IsUsesCustomerSpecifiedEncryptionResponse(message.get_Response())) {
isError = false;
return true;
}
isError = false;
return false;
}
public BlobBaseClientExistsClassifier()
: this()
{
}
}
}