-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r/aws_amplify_backend_environment: First compiling version.
- Loading branch information
Showing
7 changed files
with
182 additions
and
129 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package amplify | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
const backendEnvironmentResourceIDSeparator = "/" | ||
|
||
func BackendEnvironmentCreateResourceID(appID, environmentName string) string { | ||
parts := []string{appID, environmentName} | ||
id := strings.Join(parts, backendEnvironmentResourceIDSeparator) | ||
|
||
return id | ||
} | ||
|
||
func BackendEnvironmentParseResourceID(id string) (string, string, error) { | ||
parts := strings.Split(id, backendEnvironmentResourceIDSeparator) | ||
|
||
if len(parts) == 2 && parts[0] != "" && parts[1] != "" { | ||
return parts[0], parts[1], nil | ||
} | ||
|
||
return "", "", fmt.Errorf("unexpected format for ID (%[1]s), expected APPID%[2]sENVIRONMENTNAME", id, backendEnvironmentResourceIDSeparator) | ||
} |
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.