Api/MachineIdentityLifecycleActionsApi.ps1
|
# # Identity Security Cloud API - Machine Identity Lifecycle Actions # Use these APIs to submit, list, retrieve, and cancel machine identity lifecycle actions (for example agent activate and deactivate). We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs. # Version: v1 # Generated by OpenAPI Generator: https://openapi-generator.tech # <# .SYNOPSIS Cancel lifecycle action .DESCRIPTION Attempts to cancel a lifecycle request before provisioning starts. The path `requestId` is authoritative for lookup and authorization. The request body is optional and may carry cancel metadata such as `comment`. Any `requestId` value in the body is ignored. Workflow cancel signaling is attempted before the request is persisted as `CANCELING`. If signaling fails, the service returns **503** (`DOWNSTREAM_SERVICE_UNAVAILABLE`, cause `workflow-signal-failed`) and the lifecycle request status is unchanged. Invalid cancel states are returned as **400** (`INVALID_REQUEST_IN_CURRENT_STATE` variants). Cancel authorization matches https://developer.sailpoint.com/docs/api/get-machine-identity-lifecycle-action-v-1: the original submitter is always allowed; otherwise callers must have the `idn:machine-identity-lifecycle-action:manage` scope **and** target role-context access. **403 Forbidden** - `FORBIDDEN.lifecycle-request-access-denied` - caller is not the submitter and lacks both the `idn:machine-identity-lifecycle-action:manage` scope and target role-context. - `FORBIDDEN.unsupported-type` - the persisted lifecycle row is not scoped to `AI_AGENT`. **404 Not Found** - `NOT_FOUND.detailed` - unknown `requestId`, or persisted `targetType`/target-identity subtype mismatch. .PARAMETER RequestId Lifecycle request identifier. .PARAMETER XSailPointExperimental Use this header to enable this experimental API. .PARAMETER CancelLifecycleActionRequest No description available. .PARAMETER WithHttpInfo A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response .OUTPUTS CancelLifecycleActionResponse #> function Suspend-MachineIdentityLifecycleActionV1 { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${RequestId}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] $XSailPointExperimental = "true", [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [PSCustomObject] ${CancelLifecycleActionRequest}, [Switch] $WithHttpInfo ) Process { 'Calling method: Suspend-MachineIdentityLifecycleActionV1' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null # HTTP header 'Accept' (if needed) $LocalVarAccepts = @('application/json') # HTTP header 'Content-Type' $LocalVarContentTypes = @('application/json') $LocalVarUri = '/machine-identities/v1/lifecycle-actions/{requestId}/cancel' if (!$RequestId) { throw "Error! The required parameter `RequestId` missing when calling cancelMachineIdentityLifecycleActionV1." } $LocalVarUri = $LocalVarUri.replace('{requestId}', [System.Web.HTTPUtility]::UrlEncode($RequestId)) if (!$XSailPointExperimental) { throw "Error! The required parameter `XSailPointExperimental` missing when calling cancelMachineIdentityLifecycleActionV1." } $LocalVarHeaderParameters['X-SailPoint-Experimental'] = $XSailPointExperimental if ($LocalVarContentTypes.Contains('application/json-patch+json') -or ($CancelLifecycleActionRequest -is [array])) { $LocalVarBodyParameter = $CancelLifecycleActionRequest | ConvertTo-Json -AsArray -Depth 100 } else { $LocalVarBodyParameter = $CancelLifecycleActionRequest | ForEach-Object { # Get array of names of object properties that can be cast to boolean TRUE # PSObject.Properties - https://msdn.microsoft.com/en-us/library/system.management.automation.psobject.properties.aspx $NonEmptyProperties = $_.psobject.Properties | Where-Object {$null -ne $_.Value} | Select-Object -ExpandProperty Name # Convert object to JSON with only non-empty properties $_ | Select-Object -Property $NonEmptyProperties | ConvertTo-Json -Depth 100 } } $LocalVarResult = Invoke-ApiClient -Method 'POST' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "CancelLifecycleActionResponse" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { return $LocalVarResult } else { return $LocalVarResult["Response"] } } } <# .SYNOPSIS Get lifecycle action by requestId .DESCRIPTION Returns one lifecycle request snapshot by `requestId`. Used for request-level inspection, including cancel acceptance and subsequent status changes. The original requester is always allowed to read their request. Otherwise, callers must have the `idn:machine-identity-lifecycle-action:manage` scope **and** role-context access to the target machine identity (organization admin, source admin, scoped source sub-admin, or effective owner). **403 Forbidden** - `FORBIDDEN.lifecycle-request-access-denied` - caller is not the submitter and lacks both the `idn:machine-identity-lifecycle-action:manage` scope and target role-context (response includes `requestId` as a parameter). - `FORBIDDEN.unsupported-type` - the persisted lifecycle row is not scoped to `AI_AGENT` (`targetType` on read-by-request-id paths). **404 Not Found** - `NOT_FOUND.detailed` - unknown `requestId`, or persisted `targetType` does not match the target machine identity's subtype-to-resource-type mapping. .PARAMETER RequestId Lifecycle request identifier. .PARAMETER XSailPointExperimental Use this header to enable this experimental API. .PARAMETER WithHttpInfo A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response .OUTPUTS LifecycleActionRequest #> function Get-MachineIdentityLifecycleActionV1 { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${RequestId}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] $XSailPointExperimental = "true", [Switch] $WithHttpInfo ) Process { 'Calling method: Get-MachineIdentityLifecycleActionV1' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null # HTTP header 'Accept' (if needed) $LocalVarAccepts = @('application/json') $LocalVarUri = '/machine-identities/v1/lifecycle-actions/{requestId}' if (!$RequestId) { throw "Error! The required parameter `RequestId` missing when calling getMachineIdentityLifecycleActionV1." } $LocalVarUri = $LocalVarUri.replace('{requestId}', [System.Web.HTTPUtility]::UrlEncode($RequestId)) if (!$XSailPointExperimental) { throw "Error! The required parameter `XSailPointExperimental` missing when calling getMachineIdentityLifecycleActionV1." } $LocalVarHeaderParameters['X-SailPoint-Experimental'] = $XSailPointExperimental $LocalVarResult = Invoke-ApiClient -Method 'GET' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "LifecycleActionRequest" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { return $LocalVarResult } else { return $LocalVarResult["Response"] } } } <# .SYNOPSIS List lifecycle actions .DESCRIPTION Lists lifecycle requests visible to the requester identity in the current request context. Results are automatically scoped to the calling identity. If requester identity context is missing, an empty list is returned. When `limit` is omitted, this endpoint applies a default limit of 50. .PARAMETER XSailPointExperimental Use this header to enable this experimental API. .PARAMETER Filters Filter results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#filtering-results) Filtering is supported for the following fields and operators: **resourceType**: *eq, in* **operationType**: *eq, in* **status**: *eq, in* **completed**: *eq* **targetId**: *eq* **targetName**: *eq, sw* **sourceId**: *eq* **created**: *gt, ge, lt, le* .PARAMETER Sorters Sort results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#sorting-results) Sorting is supported for the following fields: **created, modified, status** Default sort is **-created** (newest first). .PARAMETER Limit Max number of results to return. When omitted, the default limit is 50. The maximum allowed limit is 250. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. .PARAMETER Offset Offset into the full result set. Usually specified with *limit* to paginate through the results. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. .PARAMETER Count If *true* it will populate the *X-Total-Count* response header with the number of results that would be returned if *limit* and *offset* were ignored. Since requesting a total count can have a performance impact, it is recommended not to send **count=true** if that value will not be used. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. .PARAMETER WithHttpInfo A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response .OUTPUTS LifecycleActionRequest[] #> function Get-MachineIdentityLifecycleActionsV1 { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] $XSailPointExperimental = "true", [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${Filters}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${Sorters}, [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Int32]] ${Limit}, [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Int32]] ${Offset}, [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [System.Nullable[Boolean]] ${Count}, [Switch] $WithHttpInfo ) Process { 'Calling method: Get-MachineIdentityLifecycleActionsV1' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null # HTTP header 'Accept' (if needed) $LocalVarAccepts = @('application/json') $LocalVarUri = '/machine-identities/v1/lifecycle-actions' if (!$XSailPointExperimental) { throw "Error! The required parameter `XSailPointExperimental` missing when calling listMachineIdentityLifecycleActionsV1." } $LocalVarHeaderParameters['X-SailPoint-Experimental'] = $XSailPointExperimental if ($Filters) { $LocalVarQueryParameters['filters'] = $Filters } if ($Sorters) { $LocalVarQueryParameters['sorters'] = $Sorters } if ($Limit) { $LocalVarQueryParameters['limit'] = $Limit } if ($Offset) { $LocalVarQueryParameters['offset'] = $Offset } if ($Count) { $LocalVarQueryParameters['count'] = $Count } $LocalVarResult = Invoke-ApiClient -Method 'GET' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "LifecycleActionRequest[]" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { return $LocalVarResult } else { return $LocalVarResult["Response"] } } } <# .SYNOPSIS Submit machine identity lifecycle action .DESCRIPTION Creates a lifecycle request for the target machine identity and returns the created lifecycle snapshot. The response includes the generated `requestId`, which is used by https://developer.sailpoint.com/docs/api/list-machine-identity-lifecycle-actions-v-1, https://developer.sailpoint.com/docs/api/get-machine-identity-lifecycle-action-v-1, and https://developer.sailpoint.com/docs/api/cancel-machine-identity-lifecycle-action-v-1 Authorization is enforced in the service layer. Callers must have the `idn:machine-identity-lifecycle-action:manage` scope or role-context access to the target machine identity (organization admin, source admin, scoped source sub-admin, or effective owner). Supported actions are `DEACTIVATE`, `ACTIVATE`. .PARAMETER Id Machine identity ID. .PARAMETER XSailPointExperimental Use this header to enable this experimental API. .PARAMETER LifecycleActionSubmitRequest No description available. .PARAMETER WithHttpInfo A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response .OUTPUTS LifecycleActionSubmitResponse #> function Submit-MachineIdentityLifecycleActionV1 { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] ${Id}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [String] $XSailPointExperimental = "true", [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [PSCustomObject] ${LifecycleActionSubmitRequest}, [Switch] $WithHttpInfo ) Process { 'Calling method: Submit-MachineIdentityLifecycleActionV1' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null # HTTP header 'Accept' (if needed) $LocalVarAccepts = @('application/json') # HTTP header 'Content-Type' $LocalVarContentTypes = @('application/json') $LocalVarUri = '/machine-identities/v1/{id}/lifecycle-actions' if (!$Id) { throw "Error! The required parameter `Id` missing when calling submitMachineIdentityLifecycleActionV1." } $LocalVarUri = $LocalVarUri.replace('{id}', [System.Web.HTTPUtility]::UrlEncode($Id)) if (!$XSailPointExperimental) { throw "Error! The required parameter `XSailPointExperimental` missing when calling submitMachineIdentityLifecycleActionV1." } $LocalVarHeaderParameters['X-SailPoint-Experimental'] = $XSailPointExperimental if (!$LifecycleActionSubmitRequest) { throw "Error! The required parameter `LifecycleActionSubmitRequest` missing when calling submitMachineIdentityLifecycleActionV1." } if ($LocalVarContentTypes.Contains('application/json-patch+json') -or ($LifecycleActionSubmitRequest -is [array])) { $LocalVarBodyParameter = $LifecycleActionSubmitRequest | ConvertTo-Json -AsArray -Depth 100 } else { $LocalVarBodyParameter = $LifecycleActionSubmitRequest | ForEach-Object { # Get array of names of object properties that can be cast to boolean TRUE # PSObject.Properties - https://msdn.microsoft.com/en-us/library/system.management.automation.psobject.properties.aspx $NonEmptyProperties = $_.psobject.Properties | Where-Object {$null -ne $_.Value} | Select-Object -ExpandProperty Name # Convert object to JSON with only non-empty properties $_ | Select-Object -Property $NonEmptyProperties | ConvertTo-Json -Depth 100 } } $LocalVarResult = Invoke-ApiClient -Method 'POST' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "LifecycleActionSubmitResponse" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { return $LocalVarResult } else { return $LocalVarResult["Response"] } } } |