-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added unsupported apis in report #637
Merged
OmidTahouri
merged 5 commits into
apigee:main
from
SamPriyadarshi:report-unsupported-apis
Feb 8, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0f7e994
feat: added unsupported apis in report
g-devpat 173c65c
fix: user details in report
g-devpat 35cd4ca
fix: report data representation changed
g-devpat c7b960f
fix: remove heading named unsupported
g-devpat 130e19f
chore: removing an extra space
OmidTahouri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,62 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# <http://www.apache.org/licenses/LICENSE-2.0> | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
echo "<h3>Companies</h3>" >> "$report_html" | ||
|
||
mkdir -p "$export_folder/$organization/config/resources/edge/env/$environment/company" | ||
|
||
sackmesser list "organizations/$organization/companies"| jq -r -c '.[]|.' | while read -r companyname; do | ||
sackmesser list "organizations/$organization/companies/$(urlencode "$companyname")" > "$export_folder/$organization/config/resources/edge/env/$environment/company/$(urlencode "$companyname")".json | ||
done | ||
|
||
if ls "$export_folder/$organization/config/resources/edge/env/$environment/company"/*.json 1> /dev/null 2>&1; then | ||
jq -n '[inputs]' "$export_folder/$organization/config/resources/edge/env/$environment/company"/*.json > "$export_folder/$organization/config/resources/edge/env/$environment/companies".json | ||
fi | ||
|
||
echo "<div><table id=\"company-lint\" data-toggle=\"table\" class=\"table\">" >> "$report_html" | ||
echo "<thead class=\"thead-dark\"><tr>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"id\">Name</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"name\">Display Name</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"status\">Status</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"apps\">Apps</th>" >> "$report_html" | ||
echo "</tr></thead>" >> "$report_html" | ||
|
||
echo "<tbody class=\"mdc-data-table__content\">" >> "$report_html" | ||
|
||
if [ -f "$export_folder/$organization/config/resources/edge/env/$environment/companies".json ]; then | ||
jq -c '.[]' "$export_folder/$organization/config/resources/edge/env/$environment/companies".json | while read i; do | ||
name=$(echo "$i" | jq -r '.name') | ||
displayName=$(echo "$i" | jq -r '.displayName') | ||
_status=$(echo "$i" | jq -r '.status') | ||
apps=$(echo "$i" | jq -r '.apps[]?') | ||
|
||
if [ $_status = "active" ] | ||
then | ||
status="✅" | ||
else | ||
status="❌" | ||
fi | ||
|
||
echo "<tr class=\"$highlightclass\">" >> "$report_html" | ||
echo "<td>$name</td>" >> "$report_html" | ||
echo "<td>"$displayName"</td>" >> "$report_html" | ||
echo "<td>$status</td>" >> "$report_html" | ||
echo "<td>$apps</td>" >> "$report_html" | ||
echo "</tr>" >> "$report_html" | ||
done | ||
fi | ||
|
||
echo "</tbody></table></div>" >> "$report_html" |
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,93 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# <http://www.apache.org/licenses/LICENSE-2.0> | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
echo "<h3>Company Apps</h3>" >> "$report_html" | ||
|
||
mkdir -p "$export_folder/$organization/config/resources/edge/env/$environment/companyapps" | ||
|
||
sackmesser list "organizations/$organization/companies" | jq -r -c '.[]|.' | while read -r companyname; do | ||
loginfo "download company: $companyname" | ||
mkdir "$export_folder/$organization/config/resources/edge/env/$environment/companyapps/$companyname" | ||
sackmesser list "organizations/$organization/companies/$companyname/apps" | jq -r -c '.[]|.' | while read -r appId; do | ||
loginfo "download company app: $appId for company: $companyname" | ||
full_app=$(sackmesser list "organizations/$organization/companies/$companyname/apps/$(urlencode "$appId")") | ||
echo "$full_app" | jq 'del(.credentials)' > "$export_folder/$organization/config/resources/edge/env/$environment/companyapps/$appId".json | ||
echo "$full_app" | jq -r -c '.credentials[]' | while read -r credential; do | ||
appkey=$(echo "$credential" | jq -r '.consumerKey') | ||
done | ||
done | ||
done | ||
|
||
if ls "$export_folder/$organization/config/resources/edge/env/$environment/companyapps"/*.json 1> /dev/null 2>&1; then | ||
jq -n '[inputs]' "$export_folder/$organization/config/resources/edge/env/$environment/companyapps"/*.json > "$export_folder/$organization/config/resources/edge/env/$environment/companyapps".json | ||
fi | ||
|
||
echo "<div><table id=\"ts-lint\" data-toggle=\"table\" class=\"table\">" >> "$report_html" | ||
echo "<thead class=\"thead-dark\"><tr>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"name\">Name</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"status\">Status</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"company\">Company Name</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"app_id\">App ID</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"app_fam\">App Family</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"callback\">Callback URL</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"access\">Access Type</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"created\">Created At</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"modified\">Last Modified</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"credentialsLoaded\">Credentials Loaded</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"scopes\">Scopes</th>" >> "$report_html" | ||
echo "</tr></thead>" >> "$report_html" | ||
|
||
echo "<tbody class=\"mdc-data-table__content\">" >> "$report_html" | ||
|
||
if [ -f "$export_folder/$organization/config/resources/edge/env/$environment/companyapps".json ]; then | ||
jq -c '.[]' "$export_folder/$organization/config/resources/edge/env/$environment/companyapps".json | while read i; do | ||
name=$(echo "$i" | jq -r '.name') | ||
status=$(echo "$i" | jq -r '.status') | ||
companyName=$(echo "$i" | jq -r '.companyName') | ||
appId=$(echo "$i" | jq -r '.appId') | ||
appFamily=$(echo "$i" | jq -r '.appFamily') | ||
callbackUrl=$(echo "$i" | jq -r '.callbackUrl') | ||
accessType=$(echo "$i" | jq -r '.accessType') | ||
createdAt=$(echo "$i" | jq -r '.createdAt' | date -u) | ||
lastModifiedAt=$(echo "$i" | jq -r '.lastModifiedAt' | date -u) | ||
_credentialsLoaded=$(echo "$i" | jq -r '.credentialsLoaded') | ||
scopes=$(echo "$i" | jq -r '.scopes') | ||
|
||
|
||
if [ $_credentialsLoaded = true ] | ||
then | ||
credentialsLoaded="✅" | ||
else | ||
credentialsLoaded="❌" | ||
fi | ||
|
||
echo "<tr class=\"$highlightclass\">" >> "$report_html" | ||
echo "<td>$name</td>" >> "$report_html" | ||
echo "<td>$status</td>" >> "$report_html" | ||
echo "<td>$companyName</td>" >> "$report_html" | ||
echo "<td>$appId</td>" >> "$report_html" | ||
echo "<td>$appFamily</td>" >> "$report_html" | ||
echo "<td>$callbackUrl</td>" >> "$report_html" | ||
echo "<td>$accessType</td>" >> "$report_html" | ||
echo "<td>$createdAt</td>" >> "$report_html" | ||
echo "<td>$lastModifiedAt</td>" >> "$report_html" | ||
echo "<td>$credentialsLoaded</td>" >> "$report_html" | ||
echo "<td>$scopes</td>" >> "$report_html" | ||
echo "</tr>" >> "$report_html" | ||
done | ||
fi | ||
|
||
echo "</tbody></table></div>" >> "$report_html" |
55 changes: 55 additions & 0 deletions
55
tools/apigee-sackmesser/cmd/report/helpers/ldapresources.sh
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,55 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# <http://www.apache.org/licenses/LICENSE-2.0> | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
echo "<h3>LDAP Resources</h3>" >> "$report_html" | ||
|
||
mkdir -p "$export_folder/$organization/config/resources/edge/env/$environment/ldapresource" | ||
|
||
sackmesser list "organizations/$organization/environments/$environment/ldapresources"| jq -r -c '.[]|.' | while read -r ldapresourcename; do | ||
sackmesser list "organizations/$organization/environments/$environment/ldapresources/$(urlencode "$ldapresourcename")" > "$export_folder/$organization/config/resources/edge/env/$environment/ldapresource/$(urlencode "$ldapresourcename")".json | ||
done | ||
|
||
if ls "$export_folder/$organization/config/resources/edge/env/$environment/ldapresource"/*.json 1> /dev/null 2>&1; then | ||
jq -n '[inputs]' "$export_folder/$organization/config/resources/edge/env/$environment/ldapresource"/*.json > "$export_folder/$organization/config/resources/edge/env/$environment/ldapresources".json | ||
fi | ||
|
||
echo "<div><table id=\"ldapresource-lint\" data-toggle=\"table\" class=\"table\">" >> "$report_html" | ||
echo "<thead class=\"thead-dark\"><tr>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"id\">Name</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"admin\">Admin</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"connectPool\">Connect Pool</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"connection\">connection</th>" >> "$report_html" | ||
echo "</tr></thead>" >> "$report_html" | ||
|
||
echo "<tbody class=\"mdc-data-table__content\">" >> "$report_html" | ||
|
||
if [ -f "$export_folder/$organization/config/resources/edge/env/$environment/ldapresources".json ]; then | ||
jq -c '.[]' "$export_folder/$organization/config/resources/edge/env/$environment/ldapresources".json | while read i; do | ||
name=$(echo "$i" | jq -r '.name') | ||
admin=$(echo "$i" | jq -r '.admin' | jq -r 'keys[] as $k | "<li>\($k): \(.[$k] | .)</li>"') | ||
connectPool=$(echo "$i" | jq -r '.connectPool' | jq -r 'keys[] as $k | "<li>\($k): \(.[$k] | .)</li>"') | ||
connection=$(echo "$i" | jq -r '.connection' | jq -r 'keys[] as $k | "<li>\($k): \(.[$k] | .)</li>"') | ||
|
||
echo "<tr class=\"$highlightclass\">" >> "$report_html" | ||
echo "<td>$name</td>" >> "$report_html" | ||
echo "<td><ul>$admin</ul></td>" >> "$report_html" | ||
echo "<td><ul>$connectPool</ul></td>" >> "$report_html" | ||
echo "<td><ul>$connection</ul></td>" >> "$report_html" | ||
echo "</tr>" >> "$report_html" | ||
done | ||
fi | ||
|
||
echo "</tbody></table></div>" >> "$report_html" |
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,53 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# <http://www.apache.org/licenses/LICENSE-2.0> | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
echo "<h3>Users</h3>" >> "$report_html" | ||
|
||
mkdir -p "$export_folder/$organization/config/resources/edge/env/$environment/user" | ||
|
||
sackmesser list "users"| jq -r -c '.[]|.[]' | while read -r userdetail; do | ||
email=$(echo "$userdetail" | jq -r '.name') | ||
sackmesser list "users/$email" > "$export_folder/$organization/config/resources/edge/env/$environment/user/$email".json | ||
done | ||
|
||
if ls "$export_folder/$organization/config/resources/edge/env/$environment/user"/*.json 1> /dev/null 2>&1; then | ||
jq -n '[inputs]' "$export_folder/$organization/config/resources/edge/env/$environment/user"/*.json > "$export_folder/$organization/config/resources/edge/env/$environment/users".json | ||
fi | ||
|
||
echo "<div><table id=\"user-lint\" data-toggle=\"table\" class=\"table\">" >> "$report_html" | ||
echo "<thead class=\"thead-dark\"><tr>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"id\">Email</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"firstname\">First Name</th>" >> "$report_html" | ||
echo "<th data-sortable=\"true\" data-field=\"lastname\">Last Name</th>" >> "$report_html" | ||
echo "</tr></thead>" >> "$report_html" | ||
|
||
echo "<tbody class=\"mdc-data-table__content\">" >> "$report_html" | ||
|
||
if [ -f "$export_folder/$organization/config/resources/edge/env/$environment/users".json ]; then | ||
jq -c '.[]' "$export_folder/$organization/config/resources/edge/env/$environment/users".json | while read i; do | ||
emailId=$(echo "$i" | jq -r '.emailId') | ||
firstName=$(echo "$i" | jq -r '.firstName') | ||
lastName=$(echo "$i" | jq -r '.lastName') | ||
|
||
echo "<tr class=\"$highlightclass\">" >> "$report_html" | ||
echo "<td>$emailId</td>" >> "$report_html" | ||
echo "<td>$firstName</td>" >> "$report_html" | ||
echo "<td>$lastName</td>" >> "$report_html" | ||
echo "</tr>" >> "$report_html" | ||
done | ||
fi | ||
|
||
echo "</tbody></table></div>" >> "$report_html" |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/company
instead of/companies
but I see the existing implementation has an inconsistent approach for dir names of other resources, so I won't request this changeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raised #644 to track this later