forked from hashicorp/terraform-provider-azurerm
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Site Recovery
- swap sdk and upgrade to 2022-10-01, support `networ…
…k_interface.is_primary` property (hashicorp#19571) Co-authored-by: kt <[email protected]>
- Loading branch information
Showing
451 changed files
with
23,903 additions
and
637 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,10 +1,38 @@ | ||
package recoveryservices | ||
|
||
import ( | ||
"net/http" | ||
"strings" | ||
|
||
"github.com/Azure/go-autorest/autorest" | ||
"github.com/Azure/go-autorest/autorest/azure" | ||
"github.com/hashicorp/go-azure-helpers/lang/response" | ||
) | ||
|
||
// This code is a workaround for this bug https://github.com/Azure/azure-sdk-for-go/issues/2824 | ||
func handleAzureSdkForGoBug2824(id string) string { | ||
return strings.Replace(id, "/Subscriptions/", "/subscriptions/", 1) | ||
} | ||
|
||
func wasBadRequestWithNotExist(resp *http.Response, err error) bool { | ||
e, ok := err.(autorest.DetailedError) | ||
if !ok { | ||
return false | ||
} | ||
|
||
r, ok := e.Original.(*azure.RequestError) | ||
if !ok { | ||
return false | ||
} | ||
|
||
if r.ServiceError == nil || len(r.ServiceError.Details) == 0 { | ||
return false | ||
} | ||
|
||
sc, ok := r.ServiceError.Details[0]["code"] | ||
if !ok { | ||
return false | ||
} | ||
|
||
return response.WasBadRequest(resp) && sc == "SubscriptionIdNotRegisteredWithSrs" | ||
} |
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
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
Oops, something went wrong.