Skip to content

Commit

Permalink
Update shell scripts for API register (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinyoo authored May 9, 2024
1 parent 421b61d commit 0a6bacd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/register-api.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Register API Definition to Azure API Center
name: Register API

on:
workflow_dispatch:
Expand Down
6 changes: 3 additions & 3 deletions infra/scripts/New-ApiRegistration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ if (($ResourceId -eq "") -and ($ResourceGroup -eq "" -or $ApiCenterService -eq "
Write-Host "`ResourceId` must be provided, or both `ResourceGroup` and `ApiCenterService` must be provided"
Exit 0
}
if ($FileLocation -eq "" -and $ApiManagementId -eq "") {
if (($FileLocation -eq "") -and ($ApiManagementId -eq "")) {
Write-Host "`FileLocation` must be provided"
Exit 0
}
if ($ApiManagementId -notlike "/subscriptions/*") {
if (($FileLocation -eq "") -and ($ApiManagementId -notlike "/subscriptions/*")) {
Write-Host "`ApiManagementId` must be a valid resource ID"
Exit 0
}
Expand Down Expand Up @@ -99,5 +99,5 @@ if ($ApiManagementId -eq "") {
$registered = az apic service import-from-apim `
-g $ResourceGroup `
-s $ApiCenterService `
--source-resource-ids "$APIM_ID/apis/*"
--source-resource-ids "$ApiManagementId/apis/*"
}
2 changes: 1 addition & 1 deletion infra/scripts/new-apiregistration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ if [ -z "$FILE_LOCATION" ] && [ -z "$API_MANAGEMENT_ID" ] ; then
echo "'file-lcation' must be provided"
exit 0
fi
if [[ "$API_MANAGEMENT_ID" != /subscriptions/* ]] ; then
if [ -z "$FILE_LOCATION" ] && [[ "$API_MANAGEMENT_ID" != /subscriptions/* ]] ; then
echo "'api-management-id' must be a valid resource ID"
exit 0
fi
Expand Down

0 comments on commit 0a6bacd

Please sign in to comment.