Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Shahram Kalantari <[email protected]>
  • Loading branch information
shahramk64 committed Nov 19, 2024
1 parent 60f23f1 commit 6a1f343
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions pkg/keymanagementprovider/azurekeyvault/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,16 +459,17 @@ func isSecretDisabledError(err error) bool {
const SecretDisabledCode = "SecretDisabled"
var httpErr *azcore.ResponseError
if errors.As(err, &httpErr) {
if httpErr.StatusCode == http.StatusForbidden {
var azureError AzureError
errorResponseBody, readErr := io.ReadAll(httpErr.RawResponse.Body)
if readErr != nil {
return false
}
jsonErr := json.Unmarshal(errorResponseBody, &azureError)
if jsonErr == nil && azureError.Error.Code == ErrorCodeForbidden && azureError.Error.InnerError.Code == SecretDisabledCode {
return true
}
if httpErr.StatusCode != http.StatusForbidden {
return false
}
var azureError AzureError
errorResponseBody, readErr := io.ReadAll(httpErr.RawResponse.Body)
if readErr != nil {
return false
}
jsonErr := json.Unmarshal(errorResponseBody, &azureError)
if jsonErr == nil && azureError.Error.Code == ErrorCodeForbidden && azureError.Error.InnerError.Code == SecretDisabledCode {
return true
}
}

Expand Down

0 comments on commit 6a1f343

Please sign in to comment.