Stub in framework for new .net Open Jibo cloud

This commit is contained in:
Jacob Dubin
2026-04-11 07:12:57 -05:00
parent 0c040d1348
commit 8f838787a0
54 changed files with 1933 additions and 897 deletions

View File

@@ -0,0 +1,32 @@
param(
[string]$BaseUrl = "http://localhost:5000"
)
$checks = @(
@{ Name = "Health"; Method = "GET"; Url = "$BaseUrl/health"; Headers = @{}; Body = $null },
@{ Name = "CreateHubToken"; Method = "POST"; Url = "$BaseUrl/"; Headers = @{ "X-Amz-Target" = "Account_20160715.CreateHubToken"; Host = "api.jibo.com" }; Body = "{}" },
@{ Name = "NewRobotToken"; Method = "POST"; Url = "$BaseUrl/"; Headers = @{ "X-Amz-Target" = "Notification_20160715.NewRobotToken"; Host = "api.jibo.com" }; Body = '{"deviceId":"my-robot-serial-number"}' }
)
foreach ($check in $checks) {
try {
$response = Invoke-WebRequest -Uri $check.Url -Method $check.Method -Headers $check.Headers -Body $check.Body -ContentType "application/json"
[pscustomobject]@{
Name = $check.Name
StatusCode = $response.StatusCode
Success = $true
}
}
catch {
$statusCode = $null
if ($_.Exception.Response -and $_.Exception.Response.StatusCode) {
$statusCode = [int]$_.Exception.Response.StatusCode
}
[pscustomobject]@{
Name = $check.Name
StatusCode = $statusCode
Success = $false
}
}
}

View File

@@ -0,0 +1,37 @@
param(
[string]$BaseUrl = "http://localhost:5000",
[string]$FixturePath
)
if ([string]::IsNullOrWhiteSpace($FixturePath)) {
throw "FixturePath is required."
}
$fixture = Get-Content $FixturePath | ConvertFrom-Json
$headers = @{}
foreach ($property in $fixture.headers.PSObject.Properties) {
$headers[$property.Name] = [string]$property.Value
}
if (-not $headers.ContainsKey("Host") -and $fixture.host) {
$headers["Host"] = [string]$fixture.host
}
$body = ""
if ($null -ne $fixture.body) {
$body = $fixture.body | ConvertTo-Json -Depth 10
}
$response = Invoke-WebRequest `
-Uri ($BaseUrl + [string]$fixture.path) `
-Method ([string]$fixture.method) `
-Headers $headers `
-Body $body `
-ContentType "application/json"
[pscustomobject]@{
Fixture = $FixturePath
StatusCode = $response.StatusCode
Body = $response.Content
}

View File

@@ -0,0 +1,8 @@
# Cloud Scripts
These scripts help exercise the new .NET hosted cloud locally.
- `Invoke-CloudSmoke.ps1`
Runs a few quick HTTP checks against a local OpenJibo cloud instance.
- `Invoke-ProtocolFixture.ps1`
Replays a sanitized HTTP fixture against a running local instance.