Cleanup APIGateway ARN parsing
This commit is contained in:
parent
318bcf9542
commit
6710b919ea
3 changed files with 9 additions and 9 deletions
|
@ -38,10 +38,10 @@ func ParseDeploymentID(id resource.ID) (string, string, error) {
|
|||
return "", "", err
|
||||
}
|
||||
parts := strings.Split(res, "/")
|
||||
if len(parts) != 5 || parts[0] != "" || parts[1] != "restapis" || parts[3] != "deployments" {
|
||||
return "", "", fmt.Errorf("execpted Deployment ARN of the form arn:aws:apigateway:region::/restapis/api-id/deployments/deployment-id")
|
||||
if len(parts) != 4 || parts[0] != "restapis" || parts[2] != "deployments" {
|
||||
return "", "", fmt.Errorf("expected Deployment ARN of the form arn:aws:apigateway:region::/restapis/api-id/deployments/deployment-id: %v", id)
|
||||
}
|
||||
return parts[2], parts[4], nil
|
||||
return parts[1], parts[3], nil
|
||||
}
|
||||
|
||||
// NewDeploymentProvider creates a provider that handles APIGateway Deployment operations.
|
||||
|
|
|
@ -40,10 +40,10 @@ func ParseRestAPIID(id resource.ID) (string, error) {
|
|||
return "", err
|
||||
}
|
||||
parts := strings.Split(res, "/")
|
||||
if len(parts) != 3 || parts[0] != "" || parts[1] != "restapis" {
|
||||
return "", fmt.Errorf("execpted RestAPI ARN of the form arn:aws:apigateway:region::/restapis/api-id")
|
||||
if len(parts) != 2 || parts[0] != "restapis" {
|
||||
return "", fmt.Errorf("expected RestAPI ARN of the form arn:aws:apigateway:region::/restapis/api-id: %v", id)
|
||||
}
|
||||
return parts[2], nil
|
||||
return parts[1], nil
|
||||
}
|
||||
|
||||
// NewRestAPIProvider creates a provider that handles APIGateway RestAPI operations.
|
||||
|
|
|
@ -38,10 +38,10 @@ func ParseStageID(id resource.ID) (string, string, error) {
|
|||
return "", "", err
|
||||
}
|
||||
parts := strings.Split(res, "/")
|
||||
if len(parts) != 5 || parts[0] != "" || parts[1] != "restapis" || parts[3] != "stages" {
|
||||
return "", "", fmt.Errorf("execpted Stage ARN of the form arn:aws:apigateway:region::/restapis/api-id/stages/stage-id")
|
||||
if len(parts) != 4 || parts[0] != "restapis" || parts[2] != "stages" {
|
||||
return "", "", fmt.Errorf("expected Stage ARN of the form arn:aws:apigateway:region::/restapis/api-id/stages/stage-id: %v", id)
|
||||
}
|
||||
return parts[2], parts[4], nil
|
||||
return parts[1], parts[3], nil
|
||||
}
|
||||
|
||||
// NewStageProvider creates a provider that handles APIGateway Stage operations.
|
||||
|
|
Loading…
Reference in a new issue