Model/RenewalMetricsInfo.ps1

#
# Cloud Governance Api
# Contact: support@avepoint.com
#

<#
RenewalMetricsInfo<PSCustomObject>
#>


function New-RenewalMetricsInfo {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ObjectId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ObjectUrl},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ObjectName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${TriggerTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${SubmittedTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${CompletedTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedOrDemotedOwnerCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedExternalUserCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedInternalUserCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedOrDemotedPrivateChannelOwnerCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedPrivateChannelMemberCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedOrDemotedSharedChannelOwnerCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedSharedChannelMemberCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedSiteAdminCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedInternalUserFromOwnersOrFullControlCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedInternalUserFromSPGroupCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedExternalUserFromOwnersOrFullControlCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedExternalUserFromSPGroupCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedInternalUserFromUniqueDirectAccessCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedExternalUserFromUniqueDirectAccessCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${RemovedSharingLinkCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${TaskAssigneeSkipCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TaskAssigneeTriggerRenewalAction},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsDeletedByEscalation} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Owners},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${StorageSize} = 0
    )

    Process {
        'Creating PSCustomObject: Cloud.Governance.Client => RenewalMetricsInfo' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        
        $PSO = [PSCustomObject]@{
            "ObjectId" = ${ObjectId}
            "ObjectUrl" = ${ObjectUrl}
            "ObjectName" = ${ObjectName}
            "TriggerTime" = ${TriggerTime}
            "SubmittedTime" = ${SubmittedTime}
            "CompletedTime" = ${CompletedTime}
            "RemovedOrDemotedOwnerCount" = ${RemovedOrDemotedOwnerCount}
            "RemovedExternalUserCount" = ${RemovedExternalUserCount}
            "RemovedInternalUserCount" = ${RemovedInternalUserCount}
            "RemovedOrDemotedPrivateChannelOwnerCount" = ${RemovedOrDemotedPrivateChannelOwnerCount}
            "RemovedPrivateChannelMemberCount" = ${RemovedPrivateChannelMemberCount}
            "RemovedOrDemotedSharedChannelOwnerCount" = ${RemovedOrDemotedSharedChannelOwnerCount}
            "RemovedSharedChannelMemberCount" = ${RemovedSharedChannelMemberCount}
            "RemovedSiteAdminCount" = ${RemovedSiteAdminCount}
            "RemovedInternalUserFromOwnersOrFullControlCount" = ${RemovedInternalUserFromOwnersOrFullControlCount}
            "RemovedInternalUserFromSPGroupCount" = ${RemovedInternalUserFromSPGroupCount}
            "RemovedExternalUserFromOwnersOrFullControlCount" = ${RemovedExternalUserFromOwnersOrFullControlCount}
            "RemovedExternalUserFromSPGroupCount" = ${RemovedExternalUserFromSPGroupCount}
            "RemovedInternalUserFromUniqueDirectAccessCount" = ${RemovedInternalUserFromUniqueDirectAccessCount}
            "RemovedExternalUserFromUniqueDirectAccessCount" = ${RemovedExternalUserFromUniqueDirectAccessCount}
            "RemovedSharingLinkCount" = ${RemovedSharingLinkCount}
            "TaskAssigneeSkipCount" = ${TaskAssigneeSkipCount}
            "TaskAssigneeTriggerRenewalAction" = ${TaskAssigneeTriggerRenewalAction}
            "IsDeletedByEscalation" = ${IsDeletedByEscalation}
            "Owners" = ${Owners}
            "StorageSize" = ${StorageSize}
        }

        return $PSO
    }
}

<#
RenewalMetricsInfo<PSCustomObject>
#>

function ConvertFrom-JsonToRenewalMetricsInfo {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

    Process {
        'Converting JSON to PSCustomObject: Cloud.Governance.Client => RenewalMetricsInfo' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in RenewalMetricsInfo
        $AllProperties = $("ObjectId", "ObjectUrl", "ObjectName", "TriggerTime", "SubmittedTime", "CompletedTime", "RemovedOrDemotedOwnerCount", "RemovedExternalUserCount", "RemovedInternalUserCount", "RemovedOrDemotedPrivateChannelOwnerCount", "RemovedPrivateChannelMemberCount", "RemovedOrDemotedSharedChannelOwnerCount", "RemovedSharedChannelMemberCount", "RemovedSiteAdminCount", "RemovedInternalUserFromOwnersOrFullControlCount", "RemovedInternalUserFromSPGroupCount", "RemovedExternalUserFromOwnersOrFullControlCount", "RemovedExternalUserFromSPGroupCount", "RemovedInternalUserFromUniqueDirectAccessCount", "RemovedExternalUserFromUniqueDirectAccessCount", "RemovedSharingLinkCount", "TaskAssigneeSkipCount", "TaskAssigneeTriggerRenewalAction", "IsDeletedByEscalation", "Owners", "StorageSize")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "ObjectId"))) { #optional property not found
            $ObjectId = $null
        } else {
            $ObjectId = $JsonParameters.PSobject.Properties["ObjectId"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "ObjectUrl"))) { #optional property not found
            $ObjectUrl = $null
        } else {
            $ObjectUrl = $JsonParameters.PSobject.Properties["ObjectUrl"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "ObjectName"))) { #optional property not found
            $ObjectName = $null
        } else {
            $ObjectName = $JsonParameters.PSobject.Properties["ObjectName"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "TriggerTime"))) { #optional property not found
            $TriggerTime = $null
        } else {
            $TriggerTime = $JsonParameters.PSobject.Properties["TriggerTime"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "SubmittedTime"))) { #optional property not found
            $SubmittedTime = $null
        } else {
            $SubmittedTime = $JsonParameters.PSobject.Properties["SubmittedTime"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "CompletedTime"))) { #optional property not found
            $CompletedTime = $null
        } else {
            $CompletedTime = $JsonParameters.PSobject.Properties["CompletedTime"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedOrDemotedOwnerCount"))) { #optional property not found
            $RemovedOrDemotedOwnerCount = $null
        } else {
            $RemovedOrDemotedOwnerCount = $JsonParameters.PSobject.Properties["RemovedOrDemotedOwnerCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedExternalUserCount"))) { #optional property not found
            $RemovedExternalUserCount = $null
        } else {
            $RemovedExternalUserCount = $JsonParameters.PSobject.Properties["RemovedExternalUserCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedInternalUserCount"))) { #optional property not found
            $RemovedInternalUserCount = $null
        } else {
            $RemovedInternalUserCount = $JsonParameters.PSobject.Properties["RemovedInternalUserCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedOrDemotedPrivateChannelOwnerCount"))) { #optional property not found
            $RemovedOrDemotedPrivateChannelOwnerCount = $null
        } else {
            $RemovedOrDemotedPrivateChannelOwnerCount = $JsonParameters.PSobject.Properties["RemovedOrDemotedPrivateChannelOwnerCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedPrivateChannelMemberCount"))) { #optional property not found
            $RemovedPrivateChannelMemberCount = $null
        } else {
            $RemovedPrivateChannelMemberCount = $JsonParameters.PSobject.Properties["RemovedPrivateChannelMemberCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedOrDemotedSharedChannelOwnerCount"))) { #optional property not found
            $RemovedOrDemotedSharedChannelOwnerCount = $null
        } else {
            $RemovedOrDemotedSharedChannelOwnerCount = $JsonParameters.PSobject.Properties["RemovedOrDemotedSharedChannelOwnerCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedSharedChannelMemberCount"))) { #optional property not found
            $RemovedSharedChannelMemberCount = $null
        } else {
            $RemovedSharedChannelMemberCount = $JsonParameters.PSobject.Properties["RemovedSharedChannelMemberCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedSiteAdminCount"))) { #optional property not found
            $RemovedSiteAdminCount = $null
        } else {
            $RemovedSiteAdminCount = $JsonParameters.PSobject.Properties["RemovedSiteAdminCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedInternalUserFromOwnersOrFullControlCount"))) { #optional property not found
            $RemovedInternalUserFromOwnersOrFullControlCount = $null
        } else {
            $RemovedInternalUserFromOwnersOrFullControlCount = $JsonParameters.PSobject.Properties["RemovedInternalUserFromOwnersOrFullControlCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedInternalUserFromSPGroupCount"))) { #optional property not found
            $RemovedInternalUserFromSPGroupCount = $null
        } else {
            $RemovedInternalUserFromSPGroupCount = $JsonParameters.PSobject.Properties["RemovedInternalUserFromSPGroupCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedExternalUserFromOwnersOrFullControlCount"))) { #optional property not found
            $RemovedExternalUserFromOwnersOrFullControlCount = $null
        } else {
            $RemovedExternalUserFromOwnersOrFullControlCount = $JsonParameters.PSobject.Properties["RemovedExternalUserFromOwnersOrFullControlCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedExternalUserFromSPGroupCount"))) { #optional property not found
            $RemovedExternalUserFromSPGroupCount = $null
        } else {
            $RemovedExternalUserFromSPGroupCount = $JsonParameters.PSobject.Properties["RemovedExternalUserFromSPGroupCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedInternalUserFromUniqueDirectAccessCount"))) { #optional property not found
            $RemovedInternalUserFromUniqueDirectAccessCount = $null
        } else {
            $RemovedInternalUserFromUniqueDirectAccessCount = $JsonParameters.PSobject.Properties["RemovedInternalUserFromUniqueDirectAccessCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedExternalUserFromUniqueDirectAccessCount"))) { #optional property not found
            $RemovedExternalUserFromUniqueDirectAccessCount = $null
        } else {
            $RemovedExternalUserFromUniqueDirectAccessCount = $JsonParameters.PSobject.Properties["RemovedExternalUserFromUniqueDirectAccessCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RemovedSharingLinkCount"))) { #optional property not found
            $RemovedSharingLinkCount = $null
        } else {
            $RemovedSharingLinkCount = $JsonParameters.PSobject.Properties["RemovedSharingLinkCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "TaskAssigneeSkipCount"))) { #optional property not found
            $TaskAssigneeSkipCount = $null
        } else {
            $TaskAssigneeSkipCount = $JsonParameters.PSobject.Properties["TaskAssigneeSkipCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "TaskAssigneeTriggerRenewalAction"))) { #optional property not found
            $TaskAssigneeTriggerRenewalAction = $null
        } else {
            $TaskAssigneeTriggerRenewalAction = $JsonParameters.PSobject.Properties["TaskAssigneeTriggerRenewalAction"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "IsDeletedByEscalation"))) { #optional property not found
            $IsDeletedByEscalation = $null
        } else {
            $IsDeletedByEscalation = $JsonParameters.PSobject.Properties["IsDeletedByEscalation"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "Owners"))) { #optional property not found
            $Owners = $null
        } else {
            $Owners = $JsonParameters.PSobject.Properties["Owners"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "StorageSize"))) { #optional property not found
            $StorageSize = $null
        } else {
            $StorageSize = $JsonParameters.PSobject.Properties["StorageSize"].value
        }

        $PSO = [PSCustomObject]@{
            "ObjectId" = ${ObjectId}
            "ObjectUrl" = ${ObjectUrl}
            "ObjectName" = ${ObjectName}
            "TriggerTime" = ${TriggerTime}
            "SubmittedTime" = ${SubmittedTime}
            "CompletedTime" = ${CompletedTime}
            "RemovedOrDemotedOwnerCount" = ${RemovedOrDemotedOwnerCount}
            "RemovedExternalUserCount" = ${RemovedExternalUserCount}
            "RemovedInternalUserCount" = ${RemovedInternalUserCount}
            "RemovedOrDemotedPrivateChannelOwnerCount" = ${RemovedOrDemotedPrivateChannelOwnerCount}
            "RemovedPrivateChannelMemberCount" = ${RemovedPrivateChannelMemberCount}
            "RemovedOrDemotedSharedChannelOwnerCount" = ${RemovedOrDemotedSharedChannelOwnerCount}
            "RemovedSharedChannelMemberCount" = ${RemovedSharedChannelMemberCount}
            "RemovedSiteAdminCount" = ${RemovedSiteAdminCount}
            "RemovedInternalUserFromOwnersOrFullControlCount" = ${RemovedInternalUserFromOwnersOrFullControlCount}
            "RemovedInternalUserFromSPGroupCount" = ${RemovedInternalUserFromSPGroupCount}
            "RemovedExternalUserFromOwnersOrFullControlCount" = ${RemovedExternalUserFromOwnersOrFullControlCount}
            "RemovedExternalUserFromSPGroupCount" = ${RemovedExternalUserFromSPGroupCount}
            "RemovedInternalUserFromUniqueDirectAccessCount" = ${RemovedInternalUserFromUniqueDirectAccessCount}
            "RemovedExternalUserFromUniqueDirectAccessCount" = ${RemovedExternalUserFromUniqueDirectAccessCount}
            "RemovedSharingLinkCount" = ${RemovedSharingLinkCount}
            "TaskAssigneeSkipCount" = ${TaskAssigneeSkipCount}
            "TaskAssigneeTriggerRenewalAction" = ${TaskAssigneeTriggerRenewalAction}
            "IsDeletedByEscalation" = ${IsDeletedByEscalation}
            "Owners" = ${Owners}
            "StorageSize" = ${StorageSize}
        }

        return $PSO
    }

}