Skip to content

Commit c9c2be2

Browse files
jworkmanjcgweinjc
andauthored
Cut 4903 system attributes update (#87)
* V1 RollUp * totp endpoint for v1 * attempt to get v2 to build * New V1 Functions * TODO: Correct Get-JcSdkReportArtifactContent output * fix inline refs * update search limit and skip * build changes * update github actions for build jobs * v1 changelog * v1 changes and patch release * Remove filter branch * updated swagger * add dontShow to skip+ limit * ordered skip and limit * mandatory APITransform Param * Generate date & build examples * latest changes * remove log * add to gitignore * attributes update for V1 * restore changelog dates * remove x-eventually-consistent --------- Co-authored-by: Geoffrey Wein <[email protected]>
1 parent a6e4b82 commit c9c2be2

19 files changed

+1721
-882
lines changed

ApiTransform.ps1

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ $TransformConfig = [Ordered]@{
3737
'"title":"System"' = '"title":"JcSystem"'; # error CS0426: The type name 'ComponentModel' does not exist in the type 'System'
3838
# V1 Issues
3939
# Command Result Model for new search endpoint (incorrectly defined in swagger)
40-
# remove extra filter/ fields param for search endpoints
41-
'"operationId":"search_systemusers_post","parameters":\[{"in":"body","name":"body","schema":{"\$ref":"#\/definitions\/search"}}.*{"\$ref":"#\/definitions\/systemuserslist"}},"401":{"description":"Unauthorized"}},"security":\[{"x-api-key":\[\]}\],"summary":"Search System Users"' = '"operationId":"search_systemusers_post","parameters":[{"in":"body","name":"body","schema":{"$ref":"#/definitions/search"}},{"$ref":"#/parameters/trait:limit:limit"},{"$ref":"#/parameters/trait:skip:skip"},{"$ref":"#/parameters/trait:multiTenantRequestHeaders:x-org-id"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/systemuserslist"}},"401":{"description":"Unauthorized"}},"security":[{"x-api-key":[]}],"summary":"Search System Users"'
42-
'"operationId":"search_commandresults_post","parameters":\[{"in":"body","name":"body","schema":{"\$ref":"#\/definitions\/search"}}.*{"\$ref":"#\/definitions\/commandresultslist"}}' = '"operationId":"search_commandresults_post","parameters":[{"in":"body","name":"body","schema":{"$ref":"#/definitions/search"}},{"$ref":"#/parameters/trait:limit:limit"},{"$ref":"#/parameters/trait:skip:skip"},{"$ref":"#/parameters/trait:multiTenantRequestHeaders:x-org-id"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/commandresultslist"}}'
43-
'"operationId":"search_commands_post","parameters":\[{"in":"body","name":"body","schema":{"\$ref":"#\/definitions\/search"}}.*{"\$ref":"#\/definitions\/commandslist"}}' = '"operationId":"search_commands_post","parameters":[{"in":"body","name":"body","schema":{"$ref":"#/definitions/search"}},{"$ref":"#/parameters/trait:limit:limit"},{"$ref":"#/parameters/trait:skip:skip"},{"$ref":"#/parameters/trait:multiTenantRequestHeaders:x-org-id"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/commandslist"}}'
44-
'"operationId":"search_organizations_post","parameters":\[{"in":"body","name":"body","schema":{"\$ref":"#\/definitions\/search"}}.*{"\$ref":"#\/definitions\/organizationslist"}}' = '"operationId":"search_organizations_post","parameters":[{"in":"body","name":"body","schema":{"$ref":"#/definitions/search"}},{"$ref":"#/parameters/trait:limit:limit"},{"$ref":"#/parameters/trait:skip:skip"},{"$ref":"#/parameters/trait:multiTenantRequestHeaders:x-org-id"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/organizationslist"}}'
45-
'"operationId":"search_systems_post","parameters":\[{"in":"body","name":"body","schema":{"\$ref":"#\/definitions\/search"}}.*{"\$ref":"#\/definitions\/systemslist"}},"401":{"description":"Unauthorized"}},"security":\[{"x-api-key":\[\]}\],"summary":"Search Systems"' = '"operationId":"search_systems_post","parameters":[{"in":"body","name":"body","schema":{"$ref":"#/definitions/search"}},{"$ref":"#/parameters/trait:limit:limit"},{"$ref":"#/parameters/trait:skip:skip"},{"$ref":"#/parameters/trait:multiTenantRequestHeaders:x-org-id"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/systemslist"}},"401":{"description":"Unauthorized"}},"security":[{"x-api-key":[]}],"summary":"Search Systems"'
4640
# new model commandresultssearchlist
4741
'"title":"CommandResultsList","type":"object"},"commandslist"' = '"title":"CommandResultsList","type":"object"},"commandresultssearchlist":{"properties":{"results":{"items":{"properties":{"_id":{"description":"The ID of the command result.","type":"string"},"command":{"description":"The command that was executed on the system.","type":"string"},"files":{"description":"An array of file ids that were included in the command","items":{"type":"string"},"type":"array"},"response":{"properties":{"data":{"properties":{"exitCode":{"description":"The stderr output from the command that ran.","type":"integer"},"output":{"description":"The output of the command that was executed.","type":"string"}},"type":"object"},"error":{"description":"The stderr output from the command that ran.","type":"string"},"id":{"description":"ID of the response.","type":"string"}},"type":"object"},"name":{"description":"The name of the command.","type":"string"},"requestTime":{"description":"The time (UTC) that the command was sent.","format":"date-time","type":"string"},"responseTime":{"description":"The time (UTC) that the command was completed.","format":"date-time","type":"string"},"sudo":{"description":"If the user had sudo rights.","type":"boolean"},"system":{"description":"The display name of the system the command was executed on.","type":"string"},"user":{"description":"The user the command ran as.","type":"string"},"workflowId":{"description":"The id for the command that ran on the system.","type":"string"},"workflowInstanceId":{"description":"The workflowInstanceId for the command that ran on the system.","type":"string"}},"type":"object"},"type":"array"},"totalCount":{"description":"The total number of command results.","type":"integer"}},"title":"CommandResultsSearchList","type":"object"},"commandslist"';
4842
# replace def commandresultslist with commandresultssearchlist
@@ -516,6 +510,50 @@ $TransformConfig = [Ordered]@{
516510
)
517511
}
518512
}
513+
function Remove-ParamsByOperationId {
514+
param (
515+
[Parameter(Mandatory = $true)]
516+
[object]$Swagger,
517+
[Parameter(Mandatory = $true)]
518+
[string[]]$OperationIds,
519+
[Parameter(Mandatory = $false)]
520+
[ValidateSet('fields', 'filter', 'X-Eventually-Consistent')]
521+
[string[]]$Params
522+
523+
)
524+
525+
#
526+
527+
# remove extra filter/ fields param for specific operationIds
528+
foreach ($pathProp in $Swagger.paths.keys) {
529+
$pathObj = $Swagger.paths.$pathProp
530+
foreach ($method in @('get', 'post', 'put', 'delete', 'patch')) {
531+
if ($pathObj.$method -and $pathObj.$method.operationId -and ($pathObj.$method.operationId -in $OperationIds)) {
532+
if ($pathObj.$method.parameters) {
533+
$filteredParams = @()
534+
foreach ($param in $pathObj.$method.parameters) {
535+
$isFilterOrFields = $false
536+
if ($param.'$ref') {
537+
$ref = $param.'$ref'
538+
if ($Params | Where-Object { $ref -match "trait:.*$_" }) {
539+
$isFilterOrFields = $true
540+
}
541+
} elseif ($param.name) {
542+
if ($param.name -eq 'filter' -or $param.name -eq 'fields') {
543+
$isFilterOrFields = $true
544+
}
545+
}
546+
if (-not $isFilterOrFields) {
547+
$filteredParams += ,$param
548+
}
549+
}
550+
$pathObj.$method.parameters = $filteredParams
551+
}
552+
}
553+
}
554+
}
555+
return $Swagger
556+
}
519557
Function Get-SwaggerItem {
520558
Param(
521559
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, HelpMessage = 'An object representing a swagger file.')]$InputObject
@@ -983,8 +1021,17 @@ $SDKName | ForEach-Object {
9831021
} Else {
9841022
$OASContent | ConvertFrom-Json -Depth:(100)
9851023
}
1024+
$operationIdsToClean = @(
1025+
'search_systemusers_post',
1026+
'search_systems_post',
1027+
'search_commandresults_post',
1028+
'search_commands_post',
1029+
'search_organizations_post'
1030+
)
1031+
$SwaggerObject = Remove-ParamsByOperationId -Swagger $SwaggerObjectContent -OperationIds $operationIdsToClean -Params @('fields', 'filter', 'X-Eventually-Consistent')
9861032
# Run the inlining on the whole Swagger object
987-
$SwaggerObject = Replace-InvalidPropertyRefs -Swagger $SwaggerObjectContent
1033+
$SwaggerObject = Replace-InvalidPropertyRefs -Swagger $SwaggerObject
1034+
9881035
# Find and replace on file
9891036
$SwaggerObject = $SwaggerObject | ConvertTo-Json -Depth:(100) -Compress
9901037
# Perform find and replace

Configs/JumpCloud.SDK.V1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ input-file:
3333
module-name: JumpCloud.SDK.V1
3434
namespace: JumpCloud.SDK.V1
3535
sample-generation: true
36-
module-version: 0.0.46
36+
module-version: 0.0.47
3737
dll-name: JumpCloud.SDK.V1.private
3838

3939
directive:

JumpCloud.SDK.V1.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
## JumpCloud.SDK.v1-0.0.47
2+
Release Date: September 22, 2025
3+
#### RELEASE NOTES
4+
```
5+
This is a rollup release for the V1 module, no functional changes have been made, a few changes have been made to the models to return additional parameters.
6+
```
7+
#### FEATURES:
8+
Updated model definitions for existing functions
9+
#### IMPROVEMENTS:
10+
NA
11+
#### BUG FIXES:
12+
NA
13+
#### Generated Changes:
14+
15+
<details>
16+
<summary>Functions Added</summary>
17+
18+
No changes
19+
</details>
20+
21+
<details>
22+
<summary>Functions Modified</summary>
23+
24+
No changes
25+
</details>
26+
27+
<details>
28+
<summary>Functions Removed</summary>
29+
30+
No changes
31+
</details>
32+
133
## JumpCloud.SDK.v1-0.0.46
234
Release Date: August 27, 2025
335
#### RELEASE NOTES

SDKs/PowerShell/JumpCloud.SDK.V1/JumpCloud.SDK.V1.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<Version>0.0.46</Version>
4+
<Version>0.0.47</Version>
55
<LangVersion>7.1</LangVersion>
66
<TargetFramework>netstandard2.0</TargetFramework>
77
<OutputType>Library</OutputType>

0 commit comments

Comments
 (0)