Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
79a3cf9
init PR
hmmorales Jul 31, 2024
87fa923
Merge branch 'main' into release/0.7.0-preview
hmmorales Aug 6, 2024
8a31865
remove placeholder
hmmorales Aug 6, 2024
a8e12c3
Revert "remove placeholder"
hmmorales Aug 6, 2024
8210669
init 2024-08-15-preview
hmmorales Aug 6, 2024
c445d1e
enforce only latest version gets changed
hmmorales Aug 6, 2024
71115eb
remove placeholder
hmmorales Aug 6, 2024
fe64a6b
Release/0.7.0 preview (#30109)
chgennar Aug 7, 2024
acb8907
revert old examples
hmmorales Aug 7, 2024
73a36bd
remaining files
hmmorales Aug 7, 2024
d980f18
Updating secret ref (#30113)
chgennar Aug 7, 2024
ad86d9f
Release/0.7.0 preview (#30114)
chgennar Aug 8, 2024
fbbf300
feat: Add support for Identity and service accounts in instance (#30127)
nonsocode Aug 8, 2024
13e30a7
bring auth into props (#30121)
hmmorales Aug 8, 2024
405f904
Add clientId (#30130)
chgennar Aug 8, 2024
fad0a04
Merge branch 'main' into release/0.7.0-preview
hmmorales Aug 8, 2024
90fbc35
Rm @disciminator (#30131)
chgennar Aug 8, 2024
d0d176c
Bring back examples (#30132)
chgennar Aug 8, 2024
7a56163
add example file back (#30134)
hmmorales Aug 8, 2024
c8008a0
Make auth required (#30136)
hmmorales Aug 9, 2024
32f3b9d
feat: add flags for aio services (#30135)
nonsocode Aug 9, 2024
bb9d53b
examples (#30139)
hmmorales Aug 9, 2024
d29b13b
spell check
hmmorales Aug 9, 2024
c2079d3
spellcheck
hmmorales Aug 9, 2024
3d3331b
feat: Add identity support to patch operation (#30145)
nonsocode Aug 9, 2024
42339d5
Patch Fix & Update ClientId Doc (#30140)
hmmorales Aug 9, 2024
4639533
x509CertificateSettings in BrokerAuth (#30146)
nonsocode Aug 9, 2024
6792517
fix: revert brokerauth x509 changes (#30149)
nonsocode Aug 9, 2024
528d682
Add examples for Broker (#30152)
jlian Aug 12, 2024
d25a7f8
fix up examples and remove example gen (#30171)
hmmorales Aug 12, 2024
f9173bc
Remove reference to orchestrator
hmmorales Aug 12, 2024
5c85bb4
chore: Feedback from 8/9 (#30187)
nonsocode Aug 13, 2024
7084075
Add dataflow examples (#30192)
jlian Aug 13, 2024
a4a0497
fix examples (#30195)
hmmorales Aug 14, 2024
cb4438b
fix: Remove service accounts from instance (#30198)
nonsocode Aug 14, 2024
23df743
fix: re-add Instance examples to (#30199)
nonsocode Aug 14, 2024
4c7d606
chore: Fix typos in Aio types (#30205)
nonsocode Aug 14, 2024
091a472
fix: Rename secretName to secretRef (#30208)
nonsocode Aug 14, 2024
1a09ca5
suppression (#30209)
hmmorales Aug 14, 2024
b7dfde4
fix secretName (#30211)
hmmorales Aug 14, 2024
1c3d569
fix: update examples (#30212)
nonsocode Aug 14, 2024
eeaa77f
typo (#30213)
hmmorales Aug 14, 2024
f06c2b2
fix: Adressed half of the issues (#30216)
nonsocode Aug 14, 2024
3388a0d
model validation pass
hmmorales Aug 14, 2024
9eed678
model validation (#30218)
hmmorales Aug 14, 2024
10ba7d1
201 (#30219)
hmmorales Aug 14, 2024
95fc669
fix
hmmorales Aug 14, 2024
d73c5c8
Model validation pass 4 (#30220)
hmmorales Aug 14, 2024
615bc3c
Model validation pass 5 (#30221)
hmmorales Aug 14, 2024
f922a3f
fix: lower case d (#30236)
nonsocode Aug 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cSpell.json
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,9 @@
"opcua",
"websockets",
"opentelemetry",
"parquet"
"parquet",
"mqttbroker",
"schemaregistry"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
# Run this script in the /specifications/iotoperations directory to generate the specs and the examples. #
# #
############################################################################################################
cd ../..
if [ ! -d "resource-manager" ] || [ ! -d "IoTOperations.Management" ]; then
echo "Please run this script in the /specifications/iotoperations/IoTOperations.Management/eng directory."
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
pushd "$script_dir/../.." || {
echo "Could not change to the script directory. Exiting..."
exit 1
fi
}

echo "Deleting the examples in the resource-manager directory and the management directory..."
rm -r resource-manager/Microsoft.IoTOperations/preview/2024-07-01-preview/examples
rm -r IoTOperations.Management/examples/2024-07-01-preview
# echo "Deleting the examples in the resource-manager directory and the management directory..."
# rm -r resource-manager/Microsoft.IoTOperations/preview/2024-08-15-preview/examples
# rm -r IoTOperations.Management/examples/2024-08-15-preview

echo "Generating the specs and the examples!"

Expand All @@ -22,51 +22,68 @@ echo "Compiling the typespecs in the iotoperations directory..."
npx tsp compile IoTOperations.Management/.

# Generate examples for all the openapi specs
echo "Generating examples for all the openapi specs..."
oav generate-examples resource-manager/Microsoft.IoTOperations/preview/2024-07-01-preview/iotoperations.json --max -p
# echo "Generating examples for all the openapi specs..."
# oav generate-examples resource-manager/Microsoft.IoTOperations/preview/2024-08-15-preview/iotoperations.json --max -p

# Search each example file and replace the default string with resource-name123
for file in resource-manager/Microsoft.IoTOperations/preview/2024-07-01-preview/examples/*.json; do
jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp ^[a-z0-9][a-z0-9-]*[a-z0-9]$" then "resource-name123" else . end)' $file > temp.json && mv temp.json $file
jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp ^[0-9]+[KMGTPE]$" then "500M" else . end)' $file > temp.json && mv temp.json $file
jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp ^https://.*$" then "https://www.example.com" else . end)' $file > temp.json && mv temp.json $file
jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp .+\\..+\\.kusto\\.windows\\.net" then "<cluster>.<region>.kusto.windows.net" else . end)' $file > temp.json && mv temp.json $file
jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp .+\\.blob\\.core\\.windows\\.net" then "<account>.blob.core.windows.net" else . end)' $file > temp.json && mv temp.json $file
jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp .+\\.fabric\\.microsoft\\.com" then "https://<host>.fabric.microsoft.com" else . end)' $file > temp.json && mv temp.json $file
done

for file in resource-manager/Microsoft.IoTOperations/preview/2024-07-01-preview/examples/*.json; do

# The following Jq commands replace ids with properly formatted ARM Ids
operationId=$(jq -r '.operationId' $file)
if [[ $operationId == Instance* ]]; then
jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("Instance") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
elif [[ $operationId == BrokerAuthentication* ]]; then
jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("BrokerAuthentication") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authentications/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
elif [[ $operationId == BrokerAuthorization* ]]; then
jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("BrokerAuthorization") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authorizations/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
elif [[ $operationId == BrokerListener* ]]; then
jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("BrokerListener") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
elif [[ $operationId == Broker* ]]; then
jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("Broker") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
elif [[ $operationId == DataFlowProfile* ]]; then
jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("DataFlowProfile") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
elif [[ $operationId == DataFlowEndpoint* ]]; then
jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("DataFlowEndpoint") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowEndpoints/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
elif [[ $operationId == DataFlow* ]]; then
jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("DataFlow") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
fi

# The following Jq command chops down numbers that are greater than 10000 to 10000, the OAV generate examples tool will not respect the min/max value required by typespec
jq 'walk(if type == "number" then . % 10000 else . end)' $file > temp.json && mv temp.json $file
done

#####################################################################
#
# Don't make any changes to examples for now through this script.
#
#####################################################################
# for file in resource-manager/Microsoft.IoTOperations/preview/2024-08-15-preview/examples/*.json; do
# jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp ^[a-z0-9][a-z0-9-]*[a-z0-9]$" then "resource-name123" else . end)' $file > temp.json && mv temp.json $file
# jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp ^[0-9]+[KMGTPE]$" then "500M" else . end)' $file > temp.json && mv temp.json $file
# jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp ^https://.*$" then "https://www.example.com" else . end)' $file > temp.json && mv temp.json $file
# jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp .+\\..+\\.kusto\\.windows\\.net" then "<cluster>.<region>.kusto.windows.net" else . end)' $file > temp.json && mv temp.json $file
# jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp .+\\.blob\\.core\\.windows\\.net" then "<account>.blob.core.windows.net" else . end)' $file > temp.json && mv temp.json $file
# jq 'walk(if type == "string" and . == "Replace this value with a string matching RegExp .+\\.fabric\\.microsoft\\.com" then "https://<host>.fabric.microsoft.com" else . end)' $file > temp.json && mv temp.json $file
# done

# for file in resource-manager/Microsoft.IoTOperations/preview/2024-08-15-preview/examples/*.json; do

# # The following Jq commands replace ids with properly formatted ARM Ids
# operationId=$(jq -r '.operationId' $file)
# if [[ $operationId == Instance* ]]; then
# jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("Instance") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
# elif [[ $operationId == BrokerAuthentication* ]]; then
# jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("BrokerAuthentication") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authentications/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
# elif [[ $operationId == BrokerAuthorization* ]]; then
# jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("BrokerAuthorization") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authorizations/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
# elif [[ $operationId == BrokerListener* ]]; then
# jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("BrokerListener") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
# elif [[ $operationId == Broker* ]]; then
# jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("Broker") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
# elif [[ $operationId == DataflowProfile* ]]; then
# jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("DataflowProfile") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
# elif [[ $operationId == DataflowEndpoint* ]]; then
# jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("DataflowEndpoint") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowEndpoints/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
# elif [[ $operationId == Dataflow* ]]; then
# jq --arg operationId "$operationId" 'walk(if type == "object" and .id? then if $operationId | startswith("Dataflow") then .id = "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123" else . end else . end)' $file > temp.json && mv temp.json $file
# fi

# # The following Jq command chops down numbers that are greater than 10000 to 10000, the OAV generate examples tool will not respect the min/max value required by typespec
# jq 'walk(if type == "number" then . % 10000 else . end)' $file > temp.json && mv temp.json $file

# # Set spanChannelCapacity to correct value for minimum.
# jq 'walk(if type == "object" and .spanChannelCapacity? then .spanChannelCapacity = 1000 else . end)' $file > temp.json && mv temp.json $file

# # Replace description strings with some Lorem Ipsum text.
# jq 'walk(if type == "object" and .description? then .description = "Lorem ipsum odor amet, consectetuer adipiscing elit." else . end)' $file > temp.json && mv temp.json $file

# # Replace identity strings with GUIDs.
# jq 'walk(if type == "object" and .principalId? then .principalId = "4a6e4195-75b8-4685-aa0c-0b5704779327" else . end)' $file > temp.json && mv temp.json $file
# jq 'walk(if type == "object" and .tenantId? then .tenantId = "ed060aa2-71ff-4d3f-99c4-a9138356fdec" else . end)' $file > temp.json && mv temp.json $file
# jq 'walk(if type == "object" and .clientId? then .clientId = "fb90f267-8872-431a-a76a-a1cec5d3c4d2" else . end)' $file > temp.json && mv temp.json $file
# done

# Copy the examples to the management directory
echo "Copying the examples to the management directory..."
cp -r resource-manager/Microsoft.IoTOperations/preview/2024-07-01-preview/examples/. IoTOperations.Management/examples/2024-07-01-preview/
# echo "Copying the examples to the management directory..."
# cp -r resource-manager/Microsoft.IoTOperations/preview/2024-08-15-preview/examples/. IoTOperations.Management/examples/2024-08-15-preview/

# Recompile the typespecs in the management directory
echo "Recompiling the typespecs in the management directory..."
# echo "Recompiling the typespecs in the management directory..."
npx tsp compile IoTOperations.Management/.
npx tsv IoTOperations.Management/.

Expand Down
Loading