-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Aris van Ommeren
committed
Apr 10, 2020
1 parent
950fbaf
commit 293f029
Showing
6 changed files
with
3,737 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package web | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" | ||
) | ||
|
||
type FunctionAppSlotResourceID struct { | ||
ResourceGroup string | ||
FunctionAppName string | ||
Name string | ||
} | ||
|
||
func ParseFunctionAppSlotID(input string) (*FunctionAppSlotResourceID, error) { | ||
id, err := azure.ParseAzureResourceID(input) | ||
if err != nil { | ||
return nil, fmt.Errorf("[ERROR] Unable to parse App Service Slot ID %q: %+v", input, err) | ||
} | ||
|
||
slot := FunctionAppSlotResourceID{ | ||
ResourceGroup: id.ResourceGroup, | ||
FunctionAppName: id.Path["sites"], | ||
Name: id.Path["slots"], | ||
} | ||
|
||
if slot.FunctionAppName, err = id.PopSegment("sites"); err != nil { | ||
return nil, err | ||
} | ||
|
||
if slot.Name, err = id.PopSegment("slots"); err != nil { | ||
return nil, err | ||
} | ||
|
||
if err := id.ValidateNoEmptySegments(input); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &slot, nil | ||
} |
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.