rubrikinc / rubrik-powershell-sdk

The Rubrik Security Cloud SDK
https://www.powershellgallery.com/packages/RubrikSecurityCloud
MIT License
7 stars 9 forks source link

Get-RscCluster fails #118

Closed benwa closed 1 month ago

benwa commented 1 month ago

RSC-G fedramp-v2.4.2-89

Get-RscCluster
Invoke-Rsc: PowerShell\Modules\RubrikSecurityCloud\1.5\Toolkit\Public\Get-RscCluster.ps1:160
Line |
 160 |          $response = Invoke-Rsc $query
     |                      ~~~~~~~~~~~~~~~~~
     |  One or more errors occurred. (The request generated an error.  Query: query QueryClusterConnection($first:
     | Int,$after: String,$last: Int,$before: String,$filter: ClusterFilterInput,$sortOrder: SortOrder,$sortBy:
     | ClusterSortByEnum) {   clusterConnection   (   first: $first   after: $after   last: $last   before: $before
     | filter: $filter   sortOrder: $sortOrder   sortBy: $sortBy   )   {   count   nodes {       pauseStatus
     | status       subStatus       systemStatus       type       id       isAirGapped       name
     | systemStatusMessage       version    __typename }   pageInfo {     endCursor     hasNextPage     hasPreviousPage
     | startCursor    __typename }    __typename }  __typename }  Variables: {"first":50} Operation Name:
     | QueryClusterConnection   GraphQLResponse<JObject>: Data: null Errors: null HTTP Status Code: 400 BadRequest
     | [QueryAnalysisError] [ForgePlatform Team] Encountered Client error (400) executing query with operations:
     | [QueryClusterConnection] and variables {"first":50}. Error: Query does not pass validation. Violations:  Cannot
     | query field 'isAirGapped' on type 'Cluster'. Did you mean 'isTprEnabled'? (line 22, column 7):       isAirGapped
     | ^) The request generated an error.  Query: query QueryClusterConnection($first: Int,$after: String,$last:
     | Int,$before: String,$filter: ClusterFilterInput,$sortOrder: SortOrder,$sortBy: ClusterSortByEnum) {
     | clusterConnection   (   first: $first   after: $after   last: $last   before: $before   filter: $filter
     | sortOrder: $sortOrder   sortBy: $sortBy   )   {   count   nodes {       pauseStatus       status       subStatus
     | systemStatus       type       id       isAirGapped       name       systemStatusMessage       version
     | __typename }   pageInfo {     endCursor     hasNextPage     hasPreviousPage     startCursor    __typename }
     | __typename }  __typename }  Variables: {"first":50} Operation Name: QueryClusterConnection
     | GraphQLResponse<JObject>: Data: null Errors: null HTTP Status Code: 400 BadRequest   [QueryAnalysisError]
     | [ForgePlatform Team] Encountered Client error (400) executing query with operations: [QueryClusterConnection]
     | and variables {"first":50}. Error: Query does not pass validation. Violations:  Cannot query field 'isAirGapped'
     | on type 'Cluster'. Did you mean 'isTprEnabled'? (line 22, column 7):       isAirGapped       ^

Just attempting to get all of the clusters fails.

jakerobinson commented 1 month ago

@benwa When you connected to RSC did it give you a schema mismatch warning? I suspect you may have to downgrade to the 1.4 version of the module as the RSC-G API schema is not updated to the latest SaaS version of the API.

benwa commented 1 month ago

I do think you're on the right track, but 1.4 doesn't look like it's the right one either. Is there a matrix of what version of the module I should use for my RSC instance schema version?

PS > Import-Module RubrikSecurityCloud -MaximumVersion 1.4
PS > Get-Module

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Manifest   7.0.0.0               Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-It…
Manifest   7.0.0.0               Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Ob…
Script     2.3.5                 PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, …
Script     1.4                   RubrikSecurityCloud                 {Connect-Rsc, Disconnect-Rsc, Get-RscCmdlet, Get-…

PS > Connect-Rsc
WARNING: Connect_Rsc: The installed RSC SDK version does not match the server version.

ClientId                                    AuthenticationState SdkSchemaVersion ServerVersion
--------                                    ------------------- ---------------- -------------
client|REDACTED                             AUTHORIZED v20240506-29     fedramp-v2.4.2-89

PS > Get-RscCluster
PS >
jakerobinson commented 1 month ago

Looks like 1.3 should probably work... I looked internally at the fedramp version comparison and found the API schema version in the repo. I'm going to file an internal issue to account for the fedramp schema versions.

fedramp_v2.4.2 | 05/29/2024 | 2.4.2 | fedramp-v2.4.2 | v20240429

https://github.com/rubrikinc/rubrik-powershell-sdk/blob/Version_1.3/RubrikSecurityCloud/RubrikSecurityCloud.Schema/Elements/SchemaMeta.cs

benwa commented 1 month ago

1.3 worked for me, thank you!